1.0.5 • Published 2 years ago
react-native-highlight-word v1.0.5
react-native-highlight-word
Installation
# Using npm
npm install react-native-highlight-word# Using yarn
yarn add react-native-highlight-wordDemo
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 |