Universal element contains for react, react-native, and react-native web
import { useRef } from "react",
import { View } from "react-native",
import contains from "react-native-contains";
function Component() {
const ref = useRef();
return (
<View>
<View ref={ref}>
<View onPress={((event) => {
contains(ref.current, event.target); // true
})}/>
</View>
<View onPress={((event) => {
contains(ref.current, event.target); // false
})}/>
</View>
)
}
Generated using TypeDoc