@@ -16,24 +16,32 @@ yarn add react-native-outside-press
1616```
1717
1818## Usage
19+
20+ ### EventProvider
1921Wrap your app with ` EventProvider ` .
22+
2023``` js
2124import { EventProvider } from ' react-native-outside-press' ;
2225
2326export default function App () {
2427 return (
25- < EventProvider style = {{ flex : 1 }} >
28+ < EventProvider>
2629 < RestOfYourApp / >
2730 < / EventProvider>
2831 );
2932}
3033```
31- ### ` EventProvider ` Props
32- | ** Name** | ** Type** | ** Default** |
33- | ----------| ----------| -----------------------------------------|
34- | All of [ ` ViewProps ` ] ( https://reactnative.dev/docs/view#props ) |
3534
36- Then wrap every component you want to detect outside press.
35+ #### Props
36+
37+ | Name | Description | Type | Default | Required? |
38+ | -------------| ---------------------| ------------------------------------------------------------| ---------------| -----------|
39+ | ` style ` | | [ ViewStyle] ( https://reactnative.dev/docs/view-style-props ) | ` { flex: 1 } ` | ` false ` |
40+ | ` ViewProps ` | Inherits ViewProps. | [ ViewProps] ( https://reactnative.dev/docs/view#props ) | | ` false ` |
41+
42+ ### OutsidePressHandler
43+ Wrap every component you want to detect outside press with ` OutsidePressHandler ` .
44+
3745``` js
3846import { View } from ' react-native' ;
3947import OutsidePressHandler from ' react-native-outside-press' ;
@@ -50,15 +58,17 @@ export default function MyComponent() {
5058 );
5159}
5260```
53- ### ` OutsidePressHandler ` Props
54- | ** Name** | ** Type** | ** Default** |
55- | ------------------| ----------| ---------------------------------|
56- | ` onOutsidePress ` | function | ` undefined ` |
57- | ` disabled ` | boolean | ` undefined ` |
58- | All of [ ` ViewProps ` ] ( https://reactnative.dev/docs/view#props ) |
61+
62+ #### Props
63+
64+ | Name | Description | Type | Default | Required? |
65+ | ------------------| ------------------------------------------------------| ------------------------------------------------------| ---------------| -----------|
66+ | ` onOutsidePress ` | Function to run when pressed outside of component. | function | | ` true ` |
67+ | ` disabled ` | Controls whether ` onOutsidePress ` should run or not. | boolean | ` false ` | ` false ` |
68+ | ` ViewProps ` | Inherits ViewProps. | [ ViewProps] ( https://reactnative.dev/docs/view#props ) | | ` false ` |
5969
6070## Changelogs
6171See [ CHANGELOGS.md] ( CHANGELOGS.md )
6272
6373## License
64- Copyright © 2022 David Angulo, released under the MIT license, see [ LICENSE] ( LICENSE ) .
74+ Copyright © 2023 David Angulo, released under the MIT license, see [ LICENSE] ( LICENSE ) .
0 commit comments