React Native – Image
Image
is used for displaying images. It supports different sources, such as network URLs, local images, and static resources.
Use Cases:
- Displaying images from the web or local files.
- Displaying icons or other graphical elements.
Example:
import React from 'react';
import { View, Image, StyleSheet } from 'react-native';
const App = () => {
return (
<View style={styles.container}>
<Image
style={styles.image}
source={{ uri: 'https://reactnative.dev/img/tiny_logo.png' }}
/>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
image: {
width: 100,
height: 100,
},
});
export default App;