Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement slider menu in react Native

I'm new to react. I need to develop slider menu in React-native. I follow below link but that is not I want http://www.reactnative.com/a-slide-menu-inspired-from-android-for-react-native/

Actually I need image which I attached here.

enter image description here

Please help me..

like image 463
SahanS Avatar asked Feb 16 '16 07:02

SahanS


People also ask

How do you add a menu in react native?

To create a menu we will use material design library i.e. react-native-paper. Menu contains a list of options that appear temporarily. In our project, we will create a button and on click of that button, menu will appear.

How do I create a drawer menu in react native?

Create two separate classes "DashboardScreen" and "WelcomeScreen" in the react native app to display on screen. Add these screens to createStackNavigator and add "md-menu" icon of 'react-native-vector-icons/Ionicons' package. On pressing the menu icon, call navigation. openDrawer() method to open drawer.


2 Answers

From what I understand, you want to toogle the slider menu with the hamburger button.

Although react-native-navigation-drawer

That can be achieved with the toogleSlideMenu function of the SliderMenu.

A simple example might be:

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

import SlideMenu from 'react-native-navigation-drawer';


var BasicExample = React.createClass({
  render() {
    return (
      <View style={styles.container}>
        <View>
          <Text onPress={() => this._slideMenu.toogleSlideMenu()}> Your status bar </Text>
        </View>
        <SlideMenu
          ref={(c) => this._slideMenu = c}
          menu={<Menu />} 
          >
          <View>
            <Text>Your content</Text>
          </View>
        </SlideMenu>
      </View>
    );
  }
});

var Menu = React.createClass({
  render() {
    return (
      <View style={styles.container}>
        <ScrollView
          contentContainerStyle={styles.contentContainer}
          style={styles.scrollView}>
          <Text>Gallery</Text>
          <Text>Latest</Text>
          <Text>Events</Text>
          <Text>Update</Text>
        </ScrollView>
      </View>
    );
  }
});
like image 163
Julius Breckel Avatar answered Oct 20 '22 07:10

Julius Breckel


I've added an example that implements react-native-router-flux component to react-native-drawer. In this way it presents an easy scaffolding as cross-platform.

enter image description here

like image 41
efkan Avatar answered Oct 20 '22 06:10

efkan