Web图像未显示React-Native

时间:2020-07-06 18:09:06

标签: javascript reactjs react-native react-native-elements react-native-image

我正在尝试将链接粘贴到React Native的文本框中(TextInput),并且没有显示来自链接的图像。我不确定我的错误在哪里。请有人帮我,我真的很感激。预先谢谢你!!!!!!!!!

这是代码

const tryImage = "https://images.app.goo.gl/heFUyytHySGiSMeY8"
<View style={styles.info}>
    <Image source={one} style={styles.progress}/>
    <Text style={styles.title}>Add Photo</Text>
    <Image source={{uri: tryImage}} style={styles.icon}/>
</View>

icon:{
    width: 180,
    height: 180,
    marginTop: 50,
},

1 个答案:

答案 0 :(得分:0)

很抱歉延迟。 也许您的链接有问题。 因此,您需要传递正确的uri。 例如,现在您的链接没有任何扩展名,例如png或jpg。 因此,请尝试使用png。 例如:source = {{uri:tryImage +'png'}} 希望我的回答对您有所帮助。