React Native Element Image Example

React Native

Nicesnippets

2316

05-02-2021


Hi Guys,

In this blog, I will explain you how to use element image in react native. You can easily use element image in react native. First i will create import namespace PricingCard from react-native-elements, after I will using element image using for element image tagadd in react native example.

Here, I will give you full example for simply display element image using react native as bellow.

Step 1 - Create project


In the first step Run the following command for create project.

expo init ElementImage

Step 2 - Installation of Dependency

In the step, Run the following command for installation of dependency.

To use element image you need to npm install react-native-elements --save.

To install this open the terminal and jump into your project

cd ElementImage

Run the following command

npm install react-native-elements --save

Step 3 - App.js

In this step, You will open App.js file and put the code.

import React from 'react';

import { StyleSheet, View, ActivityIndicator } from 'react-native';

import { Image } from 'react-native-elements';

export default function App() {

return (

<View style={styles.container}>

<Image

source={require('./assets/profile1.jpg')}

style={{ width: 200, height: 200, marginBottom:50 }}

/>

<Image

source={require('./assets/profile2.jpg')}

style={{ width: 200, height: 200, marginBottom:50 }}

transitionDuration={1000}

/>

</View>

);

}

const styles = StyleSheet.create({

container: {

flex: 1,

alignItems: 'center',

justifyContent: 'center',

},

});

Step 4 - Run project

In the last step run your project using bellow command.

npm start

Output