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

1.0.5 • Public • Published

react-native-highlight-word

Installation

# Using npm

npm install react-native-highlight-word

# Using yarn

yarn add react-native-highlight-word

Demo

Code provided in Examples folder.

Usage

import HighLight from 'react-native-highlight-word';

...

const onPressHightlightWord = (value) => {
    console.log(value)
}
...

<HighLight
    paragraph="Lorem Ipsum is simply dummy text of the printing and typesetting industr"
    substrings={["Ipsum", "typesetting"]}
    paragraphStyle={{ fontSize: 20 }}
    highlightStyle={{ fontSize: 20, color: '#2980b9' }} 
    showHighlightColor={true}
    onPressWord={onPressHightlightWord}/>
    

Props

paragraph

paragraph is present default value

Type Required
string Yes

substrings

substrings is array of strings

Type Required
array No

numberOfLines

numberOfLines for showing lines of string, default is 0

Type Required
int No

paragraphStyle

paragraphStyle object for text/string, you can pass the default style of string/paragraph

Type Required
object No

highlightStyle

style object for hightlight word/words

Type Required
object No

showHighlightColor

show background default color on tap, default value is true

Type Required
boolean No

onPressWord

onPressWord is function, if use tap on hightlight word then get the value of word and it's index

Type Required
function No

License

MIT

Package Sidebar

Install

npm i react-native-highlight-word

Weekly Downloads

26

Version

1.0.5

License

ISC

Unpacked Size

8.01 kB

Total Files

6

Last publish

Collaborators

  • anju_dev