Files
bsky-social-app/src/view/com/util/EventStopper.tsx
T
Hailey fab6c286f4 Remove async resizing from external embed player (#2936)
* remove debug

adjust youtube shorts height

fix webview style

simplify styles

fix resizing

make it more clear

remove async resizes from external player

* remove comment

* ts

* reverse aspect
2024-02-20 11:38:56 -08:00

27 lines
562 B
TypeScript

import React from 'react'
import {View, ViewStyle} from 'react-native'
/**
* This utility function captures events and stops
* them from propagating upwards.
*/
export function EventStopper({
children,
style,
}: React.PropsWithChildren<{style?: ViewStyle | ViewStyle[]}>) {
const stop = (e: any) => {
e.stopPropagation()
}
return (
<View
onStartShouldSetResponder={_ => true}
onTouchEnd={stop}
// @ts-ignore web only -prf
onClick={stop}
onKeyDown={stop}
style={style}>
{children}
</View>
)
}