React Native element header Example

React Native

Nicesnippets

6288

19-12-2020


React Native element header Example

Hi Guys,

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

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

Step 1 - Create project


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

expo init Elementheader

Step 2 - Installation of Dependency

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

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

To install this open the terminal and jump into your project

cd ElementHeader

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 { Header } from 'react-native-elements';

export default function App() {

return (

<Header

backgroundColor="#5f9ea0"

placement="left"

leftComponent={{ icon: 'menu', color: '#fff' }}

centerComponent={{ text: 'Home', style: { color: '#fff' } }}

/>

);

}

Step 4 - Run project

In the last step run your project using bellow command.

npm start

Output

It will help you...


Recommended Posts