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