- Create Components folder under src folder
- Add DisplayOnlineImage.js file and add below Code
import React from "react";
import { Image, Text,View } from "react-native";
const DisplayOnlineImage = () => {
let Image_Http_URL = {
uri:
"http://allinoneweb.net/Including/Images/home/logo.png"
};
return (
<View>
<Text>Display image in react native from online URL example</Text>
<Image
style={{ height: 200, width: 350, resizeMode: "stretch" }}
source={Image_Http_URL}
/>
</View>
);
};
export default DisplayOnlineImage;
- Open App.js file and update code as below
import React from 'react';
import { Text,View,StyleSheet } from 'react-native';
import DisplayOnlineImage from './src/Component/DisplayOnlineImage'
const App=()=> {
return (
<View style={styles.container}>
<DisplayOnlineImage/>
</View>
);
}
export default App;
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
paddingTop:80
},
});
No comments:
Post a Comment