Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.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 native render html中删除标记?_React Native_Expo_React Native Render Html - Fatal编程技术网

React native 如何从react native render html中删除标记?

React native 如何从react native render html中删除标记?,react-native,expo,react-native-render-html,React Native,Expo,React Native Render Html,如何删除只有标记的h2标记 您可以使用alterChildrenprop删除一些DOM节点: const html=` 你好,世界 同侧眼睑 `; 函数HASONLYBCHILDREN(节点){ 返回node.children.every( (child)=>child.type=='tag'&&child.name=='br' ); } 函数子节点(节点){ 返回node.children.filter( (儿童)=> child.type!=“标记”|| !(child.name=='h2

如何删除只有

标记的
h2
标记



您可以使用
alterChildren
prop删除一些DOM节点:

const html=`
你好,世界
同侧眼睑


`; 函数HASONLYBCHILDREN(节点){ 返回node.children.every( (child)=>child.type=='tag'&&child.name=='br' ); } 函数子节点(节点){ 返回node.children.filter( (儿童)=> child.type!=“标记”|| !(child.name=='h2'和&hasOnlyBrChildren(child)) ); } 导出默认函数App(){ 返回( ); }

我在这里做了一个点心(我刚刚用
div
替换了
br
,以直观地评估函数的有效性):

您可以使用
alterChildren
道具删除一些DOM节点:

const html=`
你好,世界
同侧眼睑


`; 函数HASONLYBCHILDREN(节点){ 返回node.children.every( (child)=>child.type=='tag'&&child.name=='br' ); } 函数子节点(节点){ 返回node.children.filter( (儿童)=> child.type!=“标记”|| !(child.name=='h2'和&hasOnlyBrChildren(child)) ); } 导出默认函数App(){ 返回( ); }

我在这里做了一份点心(我刚刚用
div
替换了
br
,以直观地评估功能的有效性):

我的建议解决了你的问题吗?如果是这样的话,为了社区的利益,请确认答案:-)我的提议解决了你的问题吗?如果是这样,请为社区利益确认答案:-)