Introduction: The Image component allows you to display images from various sources, such as local files and network URLs.
Using the Image Component:
style
prop.
Example Code:
import React from 'react';
import { View, Image, StyleSheet } from 'react-native';
const App = () => {
return (
<View style={styles.container}>
<Image
source={{ uri: 'https://example.com/image.png' }}
style={styles.image}
/>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
image: {
width: 200,
height: 200,
},
});
export default App;
Conclusion: The Image component is essential for adding visual content to your app. Knowing how to properly use and style images will enhance the visual appeal of your application.