Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 正在分析包含react组件的字符串_React Native - Fatal编程技术网

React native 正在分析包含react组件的字符串

React native 正在分析包含react组件的字符串,react-native,React Native,我从服务器返回了这个字符串,该字符串包含纯文本和RN.text组件之间的混合内容 { verse: "\u0630<Text style= {styles.madda_normal}>\u064e\u0672</Text>\u0644\u0650\u0643\u064e <Text style={styles.ham_wasl}>\u0671</Text>\u0644\u0652\u0643\u0650\u062a\u064e<Text st

我从服务器返回了这个字符串,该字符串包含纯文本和RN.text组件之间的混合内容

{
verse: "\u0630<Text style= {styles.madda_normal}>\u064e\u0672</Text>\u0644\u0650\u0643\u064e <Text style={styles.ham_wasl}>\u0671</Text>\u0644\u0652\u0643\u0650\u062a\u064e<Text style={styles.madda_normal}>\u0640\u0670</Text>\u0628\u064f \u0644\u064e\u0627 \u0631\u064e\u064a\u0652\u0628\u064e\u200c\u06db \u0641\u0650\u064a\u0647\u0650\u200c\u06db \u0647\u064f<Text style={styles.idgh_w_ghn}>\u062f\u064b\u0649 \u0644</Text>\u0651\u0650\u0644\u0652\u0645\u064f\u062a\u0651\u064e\u0642<Text style={styles.madda_permissible}>\u0650\u064a</Text>\u0646\u064e"
}
如何解析它?因此,可以将其渲染为React组件

...
render () {
  return (
    <Text>{response.verse}</Text>
  )
}
...
使用解码组件

...
render () {
  return (
    <Text>{response.verse}</Text>
  )
}
...
decodeURIComponent(item.verse)

在过去,可以在浏览器中直接使用JSXTransformer解析JSX字符串,但这种方法已被弃用


现在我推荐一个工具,比如。

我明白了,所以你也希望它被渲染。@ArionaRian所以你需要一个解析器。这一个听起来可以解决你的问题。是的,它能与react-native一起工作吗?我这里说的是react-native。不反应JS: