Text Highlighter for React Native Made with TypeScript

Text Highlighter for React Native Made with TypeScript

React Native component used to highlight words within a larger body of text. This is a port of react-native-highlight-words.

React Native Highlight Text

React Native component used to highlight words within a larger body of text. This is a port of react-native-highlight-words.

Installation

With npm:

npm i --save @sanar/react-native-highlight-text

With yarn:

yarn add @sanar/react-native-highlight-text

Usage

To use it, just provide it with an array of search terms and a body of text to highlight:

import HighlightText from '@sanar/react-native-highlight-text';

<HighlightText
  highlightStyle={{ backgroundColor: 'yellow' }}
  searchWords={['and', 'or', 'the']}
  textToHighlight="The dog is chasing the cat. Or perhaps they're just playing?"
/>;

And the HighlightText component will highlight all occurrences of search terms within the text:

screen shot 2015-12-19 at 8 23 43 am

Props

You can pass all Text style props like style to the Text component that is used as a wrapper.

Property Type Required? Description
searchWords Array Array of search words
textToHighlight String Text to highlight matches in
autoEscape Boolean Escape characters which are meaningful in regular expressions; defaults to false
caseSensitive Boolean Search should be case sensitive; defaults to false
sanitize Function Process each search word and text to highlight before comparing (eg remove accents); signature (text: string): string; defaults to undefined
highlightStyle Object Styles applied to highlighted text; defaults to undefined
textComponent Component Custom Text component to use instead of the default Text from React Native for the text. Should be TextProps compatible; defaults to undefined
highlightComponent Component Custom Text component to use instead of the default Text from React Native for the highlight. Should be TextProps compatible; defaults to undefined

Download Details:

Author: sanar

Source Code: https://github.com/sanar/react-native-highlight-text

react react-native mobile-apps

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How native is React Native? | React Native vs Native App Development

Article covers: How native is react native?, React Native vs (Ionic, Cordova), Similarities and difference between React Native and Native App Development.

React Native Mobile App Development

Skenix is providing React Native Development Services with qualified React Native App Developers. Get the best React Native App Development Services.

How React Native Is Shaping Mobile App Development

Are you a mobile app developer looking for more efficient tools for your projects? Mobile app development is getting tougher and tougher as the market continues to grow. As a developer, you need to develop Apps which meet the demands of your users. To achieve this, adopt the right tools, like the React Native development framework.

Top React Native Mobile App Development Companies in USA

Looking for top React Native mobile app development company in USA for Startups & Enterprise? Find out the top list of React Native mobile app development company in USA.

Which is the best React Native app development company in New York?

Hire top react native app development company in New York to build and develop custom react native mobile apps for Android & iOS with the latest features.