# react-native-text-highlighter

> A custom component to highlight the searched word in a provided sentence.

Latest version **1.0.5** (published 2023-09-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-text-highlighter
pnpm add react-native-text-highlighter
yarn add react-native-text-highlighter
bun add react-native-text-highlighter
```

## Health

**Score 30/100 (F)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2023-09-19 |
| First published | 2023-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 16.0.0 |
| Dependencies | 1 |
| Unpacked size | 17.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Kimsanlim |
| Maintainers | kimsanlim |
| Keywords | react-native, ios, android |

## Links

- npm: https://www.npmjs.com/package/react-native-text-highlighter
- Repository: https://github.com/limkimsan/react-native-text-highlight
- Homepage: https://github.com/limkimsan/react-native-text-highlight#readme
- Issues: https://github.com/limkimsan/react-native-text-highlight/issues
- npm.io page: https://npm.io/package/react-native-text-highlighter

## Dependencies (1)

- [highlight-words-core](https://npm.io/package/highlight-words-core.md) ^1.2.2

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2023-09-19
- 1.0.4 — 2023-04-18
- 1.0.3 — 2023-03-28
- 1.0.2 — 2023-03-28
- 1.0.1 — 2023-03-25
- 1.0.0 — 2023-03-25

## README

<span><img src="https://user-images.githubusercontent.com/18114944/227136134-d90f2305-420a-40c0-8a0e-02007b055ba4.png" width="250" height="500" /></span>

React Native Text Highlight is a custom component to highlight the searched word in a sentence using the [highlight-words-core](https://github.com/bvaughn/highlight-words-core).

## Support
iOS & Android

## Installation

```sh
npm install react-native-text-highlighter
```

#### Note:
You need to make configuration on iOS and Android by following the instruction from the above dependencies libraries.

## Usage

```js
import TextHighlight from 'react-native-text-highlighter';

//...

<TextHighlight
  textToHighlight='The quick brown fox jumps over the lazy dog'
  searchWords={["the", "fox"]}
  fontSize={18}
/>

```
## Properties
#### Basic
| Prop               |    Default    |       Type       |  Optional  | Description                                       |
| :----------------- | :-----------: | :--------------: | :--------: | :------------------------------------------------ |
| textToHighlight    |      ''       |     `string`     |   `false`  | The text for the search words to match            |
| searchWords        |      []       |     `array`      |   `false`  | The array of search words                         |
| fontSize           |       15      |     `number`     |   `true`   | The font size of the text                         |
| fontFamily         |      null     |     `string`     |   `true`   | The font family of the text                       |
| numberOfLines      |      null     |     `number`     |   `true`   | The number of lines to render the text            |

#### Custom styles

| Prop                  |    Default    |   Type    |  Optional  | Description                                         |
| :-------------------- | :-----------: | :-------: | :--------: | :-------------------------------------------------- |
| containerStyle        |     {...}     |  `style`  |   `true`   | Style of the container of the text                  |
| highlightTextStyle    |     {...}     |  `style`  |   `true`   | Style of the highlighted text                       |
| textStyle             |     {...}     |  `style`  |   `true`   | Style of the entire text (highlighted & not highlighted text)                 |


## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

---

Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)

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