# react-native-contains

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

Latest version **1.0.16** (published 2026-09-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-contains
pnpm add react-native-contains
yarn add react-native-contains
bun add react-native-contains
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.0.16 |
| Published | 2026-09-12 |
| First published | 2022-06-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16 |
| Dependencies | 0 |
| Unpacked size | 18.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Kevin Malakoff |
| Maintainers | kmalakoff |
| Keywords | react-native, react-native-web, react, native, web, dom, contains, universal, typescript |

## Links

- npm: https://www.npmjs.com/package/react-native-contains
- Repository: https://github.com/kmalakoff/react-native-contains
- Homepage: https://github.com/kmalakoff/react-native-contains#readme
- Issues: https://github.com/kmalakoff/react-native-contains/issues
- npm.io page: https://npm.io/package/react-native-contains

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.0.16 (latest) — 2026-09-12
- 1.0.15 — 2026-05-22
- 1.0.13 — 2025-12-19
- 1.0.12 — 2025-12-12
- 1.0.11 — 2025-12-12
- 1.0.10 — 2025-12-12
- 1.0.9 — 2025-12-12
- 1.0.8 — 2025-12-04
- 1.0.7 — 2025-12-04
- 1.0.6 — 2025-12-03
- 1.0.5 — 2025-11-06
- 1.0.4 — 2025-10-21
- 1.0.3 — 2025-10-21
- 1.0.2 — 2025-07-08
- 1.0.1 — 2025-06-30
- … 33 more at https://npm.io/package/react-native-contains/versions

## README

# react-native-contains

Check whether one element or native view contains another element or native tag.

## Install

```sh
npm install react react-native react-native-contains
```

## Use

```tsx
import { useRef } from "react";
import { Pressable, View } from "react-native";
import contains from "react-native-contains";

function Component() {
  const ref = useRef(null);
  return (
    <View>
      <View ref={ref}>
        <Pressable onPress={(event) => {
          console.log(contains(ref.current, event.target)); // true
        }} />
      </View>
      <Pressable onPress={(event) => {
        console.log(contains(ref.current, event.target)); // false
      }} />
    </View>
  );
}
```

## Documentation

[API Docs](https://kmalakoff.github.io/react-native-contains/)

---
_Source: https://npm.io/package/react-native-contains · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
