Bluesky app fork with some witchin' additions 馃挮
at readme-update 32 lines 691 B view raw
1import {View, type ViewStyle} from 'react-native' 2 3/** 4 * This utility function captures events and stops 5 * them from propagating upwards. 6 */ 7export function EventStopper({ 8 children, 9 style, 10 onKeyDown = true, 11}: React.PropsWithChildren<{ 12 style?: ViewStyle | ViewStyle[] 13 /** 14 * Default `true`. Set to `false` to allow onKeyDown to propagate 15 */ 16 onKeyDown?: boolean 17}>) { 18 const stop = (e: any) => { 19 e.stopPropagation() 20 } 21 return ( 22 <View 23 onStartShouldSetResponder={_ => true} 24 onTouchEnd={stop} 25 // @ts-ignore web only -prf 26 onClick={stop} 27 onKeyDown={onKeyDown ? stop : undefined} 28 style={style}> 29 {children} 30 </View> 31 ) 32}