Showing posts with label react native paper menu example. Show all posts
Showing posts with label react native paper menu example. Show all posts

React Native Paper Menu Tutorial

React Native Paper Menu Tutorial

Hi Guys,

Today, I'm able to study you a way to engender paper menu in react native. you can facilely engender paper menu in react native. First i will import stylesheet namespace from react-local-paper, after i can make paper menu utilizing in react native.

Here, I can give you full instance for simply exhibit paper menu using react native as bellow.

Step 1 - Create project

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

expo init PaperMenu
Step 2 - Install Package

In the step,I will install npm i react-native-paper package.

npm i react-native-paper
Step 3 - App.js

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

import React, { Component } from "react";
import { Text, View,StyleSheet} from 'react-native';
import { Provider ,Appbar,Card,menu} from 'react-native-paper';

const ItWebtutsComponent = () => {

   const [searchQuery, setSearchQuery] = React.useState('');

  const onChangeSearch = query => setSearchQuery(query);

  const _goBack = () => console.log('Went back');

  const _handleSearch = () => console.log('Searching');

  const _handleMore = () => console.log('Shown more');

  return (
    <Provider>
    <Appbar.Header style={styles.header}>
      <Appbar.BackAction onPress={_goBack} />
      <Appbar.Content title="User" subtitle="Subtitle" />
      <Appbar.Action icon="magnify" onPress={_handleSearch} />
      <Appbar.Action icon="dots-vertical" onPress={_handleMore} />
    </Appbar.Header>
      <View style={styles.mainbox}>
       <Card>
        <menu
            placeholder="Search"
            onChangeText={onChangeSearch}
            value={searchQuery}
          />
       </Card>
      </View>
    </Provider>
  );
};


const styles = StyleSheet.create({
  title:{
    margin: 10,
    fontSize: 15,
    fontSize: 35
  },
  mainbox:{
    textAlign:'center',
    margin: 15,
    flex: 1,
    justifyContent: 'space-between',
  },
  databeBox:{
    margin: 10,
    textAlign: 'center',
  },
  databeHeader:{
    margin: 10,
    textAlign: 'left', 
  }
});
export default ItWebtutsComponent;
Step 4 - Run project

In the last step run your project using bellow command.

expo start

It will help you...