airbnb/react-outside-click-handler but for React Native
npm install react-native-outside-pressairbnb/react-outside-click-handler but for React Native.
bash
yarn add react-native-outside-press
`Usage
$3
Wrap your app with EventProvider.`js
import { EventProvider } from 'react-native-outside-press';export default function App() {
return (
);
}
`#### Props
| Name | Description | Type | Default | Required? |
|-------------|---------------------|------------------------------------------------------------|---------------|-----------|
|
style | | ViewStyle | { flex: 1 } | false |
| ViewProps | Inherits ViewProps. | ViewProps | | false |$3
Wrap every component you want to detect outside press with OutsidePressHandler.`js
import { View } from 'react-native';
import OutsidePressHandler from 'react-native-outside-press';export default function MyComponent() {
return (
onOutsidePress={() => {
console.log('Pressed outside the box!');
}}
>
);
}
`#### Props
| Name | Description | Type | Default | Required? |
|------------------|------------------------------------------------------|------------------------------------------------------|---------------|-----------|
|
onOutsidePress | Function to run when pressed outside of component. | function | | true |
| disabled | Controls whether onOutsidePress should run or not. | boolean | false | false |
| ViewProps | Inherits ViewProps. | ViewProps | | false` |