Something went wrong. Try again.
Mirror — see github.com/blacksky-algorithms/blacksky.community
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233import {View, type ViewStyle} from 'react-native'
/** * This utility function captures events and stops * them from propagating upwards. */export function EventStopper({ children, style, onKeyDown = true,}: React.PropsWithChildren<{ style?: ViewStyle | ViewStyle[] /** * Default `true`. Set to `false` to allow onKeyDown to propagate */ onKeyDown?: boolean}>) { const stop = (e: any) => { e.stopPropagation() } return ( <View onStartShouldSetResponder={_ => true} onTouchEnd={stop} // @ts-ignore web only -prf onClick={stop} onKeyDown={onKeyDown ? stop : undefined} style={style}> {children} </View> )}