1.0.5 • Published 8 months ago

react-native-highlight-word v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

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

TypeRequired
stringYes

substrings

substrings is array of strings

TypeRequired
arrayNo

numberOfLines

numberOfLines for showing lines of string, default is 0

TypeRequired
intNo

paragraphStyle

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

TypeRequired
objectNo

highlightStyle

style object for hightlight word/words

TypeRequired
objectNo

showHighlightColor

show background default color on tap, default value is true

TypeRequired
booleanNo

onPressWord

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

TypeRequired
functionNo

License

MIT