blob: 1e672e94575276883b479c02f0bbad1bc0d3fa8e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import React from 'react'
import {View} from 'react-native'
/**
* This utility function captures events and stops
* them from propagating upwards.
*/
export function EventStopper({children}: React.PropsWithChildren<{}>) {
const stop = (e: any) => {
e.stopPropagation()
}
return (
<View
onStartShouldSetResponder={_ => true}
onTouchEnd={stop}
// @ts-ignore web only -prf
onClick={stop}
onKeyDown={stop}>
{children}
</View>
)
}
|