1.0.0 • Published 6 years ago

react-native-circle-drawer v1.0.0

Weekly downloads
7
License
MIT
Repository
github
Last release
6 years ago

Description

This is a Drawer for React-Native inspired by Karan Shah Navigation Drawer Concept

Karan Shah Dribbble account

Karan Shah Navigation Drawer Concept

drawer gif

Installation

npm install --save react-native-circle-drawer

Use

import Drawer from 'react-native-circle-drawer'

render(){
    return(
        <Drawer sideMenu={this.renderSideMenu}>
            <App/>
        </Drawer>
    )
}

Props

nametypedefaultdescription
primaryColorstring#731ED2
secondaryColorstring#9646EC
cancelColorstring#731ED2
sideMenuReact.Component
topRightViewReact.Component
marginLeftnumber0left margin starting from the middle of the circle
marginTopnumber0top margin starting from the middle of the circle
openStartfunctioncallback when the open animation begin
openEndfunctioncallback when the open animation end
closeStartfunctioncallback when the close animation begin
closeEndfunctioncallback when the close animation end

Functions

namedescription
openopen the drawer
closeclose the drawer

Example

    openDrawer(){
        this.refs.DRAWER.open
    }
    
    renderSideMenu(){
        return(
            <View style={{flex:1}}>
                <Text>Item 1 </Text>
                <Text>Item 2 </Text>
            </View>
        )
    }
    
    renderTopRightView(){
        return(
            <View>
                <Text>Hello</Text>
            </View>
        )
    }
    
    render(){
        <Drawer
            ref="DRAWER"
            sideMenu={this.renderSideMenu()}
            topRightView={this.renderTopRightView()}
        >
          <Button title="open drawer" onPress={()=>this.openDrawer()} />
          <Text>Main application here!!</Text>
        </Drawer>
    
    }
    

Licence

MIT

Credit

Karan Shah