In react native, I want to replace a keyword in a string with red. What should I do?

The original idea of

was to use repace to replace keywords and then add < Text > to color both ends. But after discovering replace, < Text > is recognized as a string.

what should be done to achieve the effect described in the title?

  _replaceSeachWordToRed=(index,text)=>{
    let str = this.state.searchWord;
    let reg = new RegExp(str, "g");
    let redStr=()=>{return(<Text style={{color:"red"}}>str</Text>)};
    let replacedStr=text.replace(reg, redStr);
    return <Text style={[styles.contentFace]}>{index+1}. {replacedStr}</Text>;
  };
Mar.22,2021
The content returned by the

replace method must be a string

Menu