mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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