Curriculum
Course: Basic Components in React Native
Login

Curriculum

Basic Components in React Native

Text lesson

Lesson 3: Image Component

Introduction: The Image component allows you to display images from various sources, such as local files and network URLs.

 

Using the Image Component:

  • The Image component supports multiple image formats.
  • You can set image dimensions using the 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.

Layer 1
Login Categories
This website uses cookies and asks your personal data to enhance your browsing experience.