diff --git a/README.md b/README.md index 061cda02b..f137c3298 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ React Native v0.60 | Image | ✓ | Missing multiple sources ([#515](https://github.com/necolas/react-native-web/issues/515)) and HTTP headers ([#1019](https://github.com/necolas/react-native-web/issues/1019)). | | ImageBackground | ✓ | | | KeyboardAvoidingView | (✓) | Mock. No equivalent web APIs. | -| Modal | ✘ | Not started ([#1020](https://github.com/necolas/react-native-web/issues/1020)). | +| Modal | ✓ | | | Picker | ✓ | | | Pressable | ✓ | | | RefreshControl | ✘ | Not started ([#1027](https://github.com/necolas/react-native-web/issues/1027)). | diff --git a/packages/docs/src/components/Modal/Modal.stories.mdx b/packages/docs/src/components/Modal/Modal.stories.mdx new file mode 100644 index 000000000..89aad1d32 --- /dev/null +++ b/packages/docs/src/components/Modal/Modal.stories.mdx @@ -0,0 +1,86 @@ +import { Meta, Props, Story, Preview } from '@storybook/addon-docs/blocks'; +import * as Stories from './examples'; + + + +# Modal + +The Modal component is a basic way to present content above an enclosing view. +Modals may be nested within other Modals. + +## Props + +## Props + +| Name | Type | Default | +| ------------------------- | --------- | ------- | +| animationType | ?string | 'none' | +| disabled | ?boolean | false | +| onDismiss | ?Function | | +| onRequestClose | ?Function | | +| onShow | ?Function | | +| transparent | ?boolean | false | +| visible | ?boolean | false | + + +### animationType + +The `animationType` prop can be used to add animation to the modal +being opened or dismissed. + +* `none` - the modal appears without any animation. +* `slide` - the modal slides up from the bottom of the screen. +* `fade` - the modal fades in. + +By default this is `none`. + + + + + + + +### onDismiss + +The `onDismiss` callback is called after the modal has been dismissed and is no longer visible. + +### onRequestClose + +The `onRequestClose` callback is called when the user is attempting to close the modal - +such as when they hit `Escape`. + +Only the top-most Modal responds to hitting `Escape`. + + + + + + + +### onShow + +The `onShow` callback is called once the modal has been shown and may be visible. + +### transparent + +The `transparent` prop determines if the modal is rendered with a `transparent` backdrop or +a `white` backdrop. + + + + + + + +### visible + +Whether or not the modal is visible. + +When set to `false` the contents are not rendered and the modal removes itself +from the screen. + + + + + + diff --git a/packages/docs/src/components/Modal/examples/Animated.js b/packages/docs/src/components/Modal/examples/Animated.js new file mode 100644 index 000000000..72ebf0bff --- /dev/null +++ b/packages/docs/src/components/Modal/examples/Animated.js @@ -0,0 +1,32 @@ +import React, { useState } from 'react'; +import { Modal, Text, Button } from 'react-native'; + +function Animated({ animationType }) { + const [isVisible, setIsVisible] = useState(false); + + return ( + <> +