npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-drawer-menu

v0.2.5

Published

A drawer component for React Native Application (ios / android)

Downloads

1,503

Readme

react-native-drawer-menu Build Status Coverage Status

A drawer component for React Native Application (ios / android)

Similar to drawer menu component of QQ mobile.

Examples

iOS Platform

Android Platform

Usage

SUGGESTION In iOS, the drawer menu component should only be used in the top level route, because the action that swipes from left side of the screen to right is designed to pop route from navigate stack. You are supposed to avoid the conflict of the UI interactions. At least, don't use the Left drawer menu to wrap sub routes, use Right drawer menu if it's needed.

install from npm

npm install --save react-native-drawer-menu

import in project

import Drawer from 'react-native-drawer-menu';
import {Easing} from 'react-native'; // Customize easing function (Optional)
// in render function
render() {
  // prepare your drawer content
  var drawerContent = (<View style={styles.drawerContent}>
    <View style={styles.leftTop}/>
    <View style={styles.leftBottom}>
      <View><Text>Drawer Content</Text></View>
    </View>
  </View>);
  // customize drawer's style (Optional)
  var customStyles = {
    drawer: {
      shadowColor: '#000',
      shadowOpacity: 0.4,
      shadowRadius: 10
    },
    mask: {}, // style of mask if it is enabled
    main: {} // style of main board
  };
  return (
    <Drawer
      style={styles.container}
      drawerWidth={300}
      drawerContent={drawerContent}
      type={Drawer.types.Overlay}
      customStyles={{drawer: styles.drawer}}
      drawerPosition={Drawer.positions.Right}
      onDrawerOpen={() => {console.log('Drawer is opened');}}
      onDrawerClose={() => {console.log('Drawer is closed')}}
      easingFunc={Easing.ease}
    >
      <View style={styles.content}>
        <Text>{Object.values(Drawer.positions).join(' ')}</Text>
        <Text>{Object.values(Drawer.types).join(' ')}</Text>
      </View>
    </Drawer>
  );
}

Notice: The reference of the drawer is passed to drawer content element, you could use this.props.drawer to invoke Drawer's instance methods like this.props.drawer.closeDrawer()

Properties

| Property | Type | Default | Description | | --- | --- | --- | --- | | disabled | Bool | false | Disable the component or not. | | leftDisabled | Bool | false | Disable left drawer or not. | | rightDisabled | Bool | false | Disable right drawer or not. | | type | String | ‘default' | Type of the drawer. default / overlay You can also use static value Drawer.types.Default / Drawer.types.Overlay. | | drawerPosition | String | ‘left' | Determine where does the drawer come out. left / right / both You can also use static value Drawer.positions.Left / Drawer.positions.Right / Drawer.positions.Both. | | drawerWidth | Number | 200 | The width of drawer, it’s disabled when use replace type. | | drawerContent | React Component | null | The content of the drawer menu, default is left content. | | leftDrawerContent | React Component | null | The content of the left drawer menu. | | rightDrawerContent | React Component | null | The content of the right drawer menu. | | duration | Number | 160 | The duration of animation to open or close drawer. | | maskAlpha | Number | 0.4 | Maximum value is 0.5, the opactiy value of the mask over the main board when drawer is open. Mask can be disabled with showMask property. | | showMask | Bool | true | Whether show the mask when drawer is open. | | customStyles | Object | {} | Customize drawer styles. You can customize main / mask / drawer / leftDrawer / rightDrawer. | | onDrawerOpen | function | null | Triggers when drawer is totally opened. | | onLeftDrawerOpen | function | null | Triggers when the left drawer is totally opened. | | onRightDrawerOpen | function | null | Triggers when the right drawer is totally opened. | | onDrawerClose | function | null | Triggers when drawer is totally closed. | | onLeftDrawerClose | function | null | Triggers when the left drawer is totally closed. | | onRightDrawerClose | function | null | Triggers when the right drawer is totally closed. | | startCapture | Bool | false | Whether to capture touch events while clicking on screen. | | moveCapture | Bool | false | Whether to capture touch events while swiping over the screen. | | easingFunc | function | null | Easing function of drawer animation, default is Easing.linear. You can pass function like Easing.ease/Easing.bezier(x1, y1, x2, y2)/Easing.sin/Easing.elastic(times)/Easing.bounce etc. | | responderNegotiate | function | null | Customize conditions to set pan responder, evt & gestureState will be passed as arguments. Default condition is left 20% area on screen in left Drawer, or right 20% area on screen in right Drawer. |

Instance methods

Use ref to invoke instance methods.

| Method | Description | | --- | --- | | openDrawer | Open drawer manually | | openLeftDrawer | Open left drawer manually | | openRightDrawer | Open right drawer manually | | closeDrawer | Close drawer manually. The drawerContent has a ref of drawer instance, you can also trigger with it. | | closeLeftDrawer | Close left drawer manually | | closeRightDrawer | Close right drawer manually |