react-native-contains
TypeScript icon, indicating that this package has built-in type declarations

0.1.27 • Public • Published

react-native-contains

Universal element contains for react, react-native, and react-native web

Example 1

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>
  )
}

Documentation

API Docs

Package Sidebar

Install

npm i react-native-contains

Weekly Downloads

7

Version

0.1.27

License

MIT

Unpacked Size

18.1 kB

Total Files

12

Last publish

Collaborators

  • kmalakoff