项目
在 GitHub 查看 
clauderic/react-native-highlight-words
关于
Find and highlight words within a larger body of text 🖍
其他项目实测星标增长
- 24小时
- +1
- 7天
- +1
- 15天
- +1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文React Native Highlight Words
React Native component used to highlight words within a larger body of text. This is a port of react-highlight-words.
Check out a demo using Exponent.
Installation
Using npm:
npm i --save react-native-highlight-words
Usage
To use it, just provide it with an array of search terms and a body of text to highlight:
import Highlighter from 'react-native-highlight-words';
<Highlighter
highlightStyle={{backgroundColor: 'yellow'}}
searchWords={['and', 'or', 'the']}
textToHighlight='The dog is chasing the cat. Or perhaps they're just playing?'
/>
And the Highlighter component will highlight all occurrences of search terms within the text:

Props
| Property | Type | Required? | Description |
|---|---|---|---|
| autoEscape | Boolean | Escape characters which are meaningful in regular expressions | |
| highlightStyle | Object | Styles applied to highlighted text | |
| sanitize | Function | Process each search word and text to highlight before comparing (eg remove accents); signature (text: string): string |
|
| searchWords | Array | ✓ | Array of search words |
| style | Object | Styles applied to the text wrapper | |
| textToHighlight | String | ✓ | Text to highlight matches in |
License
MIT License - fork, modify and use however you want.
探索相关项目
加载中…