简体   繁体   English

图像未显示在 web 小吃视图中。expo.io?

[英]Image not displaying in web view of snack.expo.io?

I'm using snack.expo.io for React Native development.我正在使用snack.expo.io 进行React Native 开发。 In my render() method, I'm including an Image reference like this:在我的 render() 方法中,我包含了一个像这样的 Image 引用:

return (
  <View>
      <Image source={require('./assets/my-image.png')} />
  </View>
);

The image displays as expected in the "Android" and "iOS" preview tabs but nothing is displayed in the "Web" preview tab.该图像在“Android”和“iOS”预览选项卡中按预期显示,但“Web”预览选项卡中没有显示任何内容。 Any idea what the issue might be here?知道问题可能在这里吗?

I created expo snack example with image: https://snack.expo.io/@djalik/image-demo我用图像创建了 expo 小吃示例: https://snack.expo.io/@djalik/image-demo

You have to define style for Image in the web version.您必须在 web 版本中为 Image 定义样式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM