当前位置:网站首页>RN search highlight
RN search highlight
2022-07-27 22:28:00 【When the wind blows, the clouds fly】
Highlighting search keywords is a common feature in the front end , Let's share briefly today , The code is as follows :
search = (text) => {
let list = [' Melon seed used car ', " I'm a melon seed used car, melon seed used car ", " Used car melon seeds "];
const list_ = list.map(item => {
const ui = []
const newArr = item.split(text)
for (let i = 0; i < newArr.length; i++) {
const v = newArr[i]
if (i!== 0) {
ui.push(<Text style={
[y.color('red')]}>{
text}</Text>)
}
ui.push(<Text>{
v}</Text>)
}
return <View style={
[y.udr]}>{
ui}</View>
})
this.setState({
result: list_
})
}
边栏推荐
- 饿了么input输入框设置type=‘number‘时,去掉后面的上下按钮
- The execution process, orphan process and zombie process of fork() function
- Time relay
- 8000字讲透OBSA原理与应用实践
- MySQL series - database tables, queries, sorting, and data processing functions
- A lock faster than read-write lock. Don't get to know it quickly
- Optocoupler relay
- 软件测试的就业前景到底怎么样?
- JVM memory model interview summary
- How to quickly pass the probation period for newly trained intermediate test engineers
猜你喜欢

High frequency relay

JVM garbage collection garbage collector and common combination parameters

基于简化的评分卡、Smote采样和随机森林的信贷违约预测

An2021 software installation and basic operation (new file / export)

Project analysis (from technology to project and product)
![[question 21] idiom Solitaire (Beijing Institute of Technology / Beijing University of Technology / programming methods and practice / primary school)](/img/dd/5ef46cff3988db57bfaf6fe925a0e0.jpg)
[question 21] idiom Solitaire (Beijing Institute of Technology / Beijing University of Technology / programming methods and practice / primary school)

七大排序之直接插入排序

Starfish OS X metabell strategic cooperation, metauniverse business ecosystem further

Deepfake 换脸真假难辨,马斯克分克已伪装成功
![[question 23] Sudoku game with rotation | DFS (Beijing Institute of Technology / Beijing Institute of Technology / programming methods and practice / primary school)](/img/75/c207f4f562fd5b547c5b3134113154.jpg)
[question 23] Sudoku game with rotation | DFS (Beijing Institute of Technology / Beijing Institute of Technology / programming methods and practice / primary school)
随机推荐
Encapsulate an array into a class
2022 / July daily report
Are Transformers Effective for Time Series Forecasting?|填坑
ApacheSpark-命令执行(CVE-2022-33891) 漏洞复现
[binary tree] count the number of good nodes in the binary tree
Interview questions that big companies need to prepare
Live broadcast software app development, uniapp scroll view hidden scroll bar
Multi tenant SaaS cloud platform framework
High frequency relay
Wireshark filter rule notes, with software
Yyds dry goods inventory # solve the real problem of famous enterprises: cycle number comparison
九天后我们一起,聚焦音视频、探秘技术新发展
Drawing three coordinate (axis) diagram with MATLAB
[untitled]
Leetcode-55-jump game
Nodejs npm常用指令总结
[question 23] Sudoku game with rotation | DFS (Beijing Institute of Technology / Beijing Institute of Technology / programming methods and practice / primary school)
JVM garbage collection garbage collector and common combination parameters
Solid state relay
If demand splitting is as simple as cutting a cake | agile practice