I try to display a remote image which is a HTTPS url.
I tried:
import React, {useContext} from 'react';
import {View, Image, StyleSheet} from 'react-native';
const MyScreen = ({navigation}) => {
const {data} = ... // This is backend responsed data
// I verified the imageSource is https://www.example.com/bar/myimg.svg
const imageSource = data.image.url;
const source = {uri: imageSource};
return (
<View style={styles.main}>
<Image style={{width: 500, height: 500}} source={source} />
</View>
);
};
const styles = StyleSheet.create({
main: {
flex: 1,
},
export default MyScreen;
(I enter the image url to my Chrome browser, the browser shows the image.)
I run my react-native project on both iOS and Android simulators, however both shows blank screen. I thought at least on iOS I should make sure the HTTPS content should be allowed, so I also checked the info.plist, it has:
But both iOS and Android don't show the image makes me confused where am I wrong?