【发布时间】:2020-06-09 20:47:51
【问题描述】:
您好,我是 JS 和 React Native 的新手。我似乎无法将任何图像加载到 Image 组件中。我使用所有安全 uri 并首先在浏览器中测试它们。它们在浏览器中加载,但不在我的 ios 模拟器中。似乎也没有错误。希望有人以前看过这个
这是一段代码摘录:
<Image
source = { {uri:"https://images.freeimages.com/images/large-previews/f37/cloudy-scotland-1392088.jpg" }}
resizeMode = {"contain"}
onLoadStart = { () => alert("start")}
onLoadEnd = { () => alert("loaded") }
onError = {(e)=> alert(e.nativeEvent.error)}
/>
info.plist 提取:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
【问题讨论】:
-
这个Image组件是第三方库还是从react-native导入的?
标签: ios image react-native ios-simulator