Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.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
从视图中获取html并获取每个子视图的样式?_Html_React Native_Jsx - Fatal编程技术网

从视图中获取html并获取每个子视图的样式?

从视图中获取html并获取每个子视图的样式?,html,react-native,jsx,Html,React Native,Jsx,在探索React类之后,我尝试将子视图转换为与样式完全相同的HTML字符串: React.createElement() 返回: detailedreactmlelement 那么有什么方法可以将HTML作为字符串获取呢?你有没有尝试过toString()是的,已经尝试过了,在循环后使用:React.Children.forEach(view.props.Children,function(child){console.log(child.toString())}打印child.toString

在探索React类之后,我尝试将子视图转换为与样式完全相同的HTML字符串:

React.createElement()

返回:

detailedreactmlelement


那么有什么方法可以将HTML作为字符串获取呢?

你有没有尝试过
toString()
是的,已经尝试过了,在循环后使用:
React.Children.forEach(view.props.Children,function(child){console.log(child.toString())}打印child.toString(),
但是我得到了“[object object object]”在添加react-dom包后,您应该使用它的抛出错误:“超级表达式必须为null或函数,而不是未定义的”错误由react-dom-server.node.development.js(2748:112)抛出。我认为它与react-NativeSorry不兼容,我忘了您使用react-native,因为react native没有DOM元素,只有native元素。您可以尝试查找其他软件包,但如果您喜欢使用just react native,则我不确定,抱歉。