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本机html呈现:图像问题_React Native - Fatal编程技术网

React native React本机html呈现:图像问题

React native React本机html呈现:图像问题,react-native,React Native,我尝试从JSON端点加载HTML,并在应用程序中显示它。 这在使用某些库时效果很好,但HTML内容的底部也包含图像 这些图像堆叠在彼此的顶部,而不是很好地彼此居中 我怎样才能做到这一点? 哪一个模块最适合用于此目的 下面是一个片段。 不确定如何正确设置此样式:( 您可以使用react native render html并为每个html标记或类指定使用tagsStyles和classesStyles道具的样式。以下代码是使用此道具的示例: 您还可以使用renderersprops来呈现特定标

我尝试从JSON端点加载HTML,并在应用程序中显示它。 这在使用某些库时效果很好,但HTML内容的底部也包含图像

这些图像堆叠在彼此的顶部,而不是很好地彼此居中

我怎样才能做到这一点? 哪一个模块最适合用于此目的

下面是一个片段。 不确定如何正确设置此样式:(


您可以使用
react native render html
并为每个html标记或类指定使用tagsStyles和classesStyles道具的样式。以下代码是使用此道具的示例:


您还可以使用
renderers
props来呈现特定标记的自定义内容。有关
react native render html
的详细信息,请单击以下链接:

感谢您来到这个标题

if you have such content;<p><img></p>

      <HTML containerStyle={{ flex: 1,flexDirection:'column'}}
      html={props here} imagesMaxWidth={ maxWidth }
      ignoredStyles= {['width','height']} 
      tagsStyles={{ p: {padding: 10},img:{flex:1,alignSelf:'center',margin:0}
      }} />
如果您有此类内容;


这看起来确实很有希望,尽管我无法让它工作起来,并将html中的图像彼此对齐:(其余的样式我理解,但可能您有一些关于操纵图像对齐的提示?例如,您在问题的html内容中有一个带有class gallery-columns-4的div,并希望在其中设置图像样式,使图像保持在一行上。对于这种情况,您必须使用以下代码:
您可以将宽度与perce一起使用。)nt值而不是flex:1,并添加flexWrap:“wrap”对于gallery-columns-4类,很抱歉反应太晚。最后一个解决方案是:D我可以使用此模块从网站上抓取广告吗?意思是:有一个广告商页面,上面有所有的广告商。这可以通过API解析,但当然包含很多html。它包含css样式、标题、说明和图像。我可以映射这个和吗用这个模块把它放在一个对象里?
if you have such content;<p><img></p>

      <HTML containerStyle={{ flex: 1,flexDirection:'column'}}
      html={props here} imagesMaxWidth={ maxWidth }
      ignoredStyles= {['width','height']} 
      tagsStyles={{ p: {padding: 10},img:{flex:1,alignSelf:'center',margin:0}
      }} />