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