React Native Image Align Center Example

Aug 12, 2022 . Admin



In this tutorial, you will learn react native center image vertically. I explained simply step by step react native image style center. We will use how to align image in react native. This article will give you simple example of how to center image react native. you will do the following things for center image react native loading screen.

In this example, we will image align center add css to alignItems and justifyContent in react native. then we will display image center in your mobile. so let's see below example.

Step 1: Download Project

In the first step run the following command to create a project.

expo init ExampleApp
Step 2: App.js

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

import React from 'react';
import { StyleSheet, Text, View, Image } from 'react-native';

export default function App() {

    return (
      <View style={styles.container}>
        <Image
        style={styles.img}
        source={require('./assets/images.jpeg')}
      	/>
      </View>
    );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
  
  img: {
    height: 200,
    width: 200,
  }
});
Step 3: Run Project

In the last step run your project using the below command.

expo start

You can QR code scan in Expo Go Application on mobile.

Output:

It will help you...

#React Native