Created
October 24, 2016 18:24
-
-
Save Takeno/4bcf17b17f7121bb6cd0614fc15cf18c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react'; | |
import {StyleSheet} from 'react-native'; | |
import Drawer from 'react-native-drawer'; | |
import {DefaultRenderer} from 'react-native-router-flux'; | |
import SideMenu from '../Layouts/Sidebar'; // My menu component | |
export default class extends Component { | |
render() { | |
const children = this.props.navigationState.children; | |
const DrawerProps = { | |
ref: 'navigation', | |
type: 'overlay', | |
content: <SideMenu />, | |
tapToClose: true, | |
openDrawerOffset: 0.2, | |
panCloseMask: 0.2, | |
negotiatePan: true, | |
styles: styles, | |
tweenHandler: (ratio) => ({ | |
mainOverlayProps: { | |
opacity: ratio / 2 | |
} | |
}) | |
}; | |
return ( | |
<Drawer {...DrawerProps}> | |
<DefaultRenderer navigationState={children[0]} onNavigate={this.props.onNavigate} /> | |
</Drawer> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
mainOverlay: { | |
backgroundColor: '#000', | |
opacity: 0 | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
<Router sceneStyle={styles.scene}> | |
<Scene key="root" component={Drawer}> | |
<Scene key="main"> | |
<Scene key="home" type="reset" title="Benvenuto" component={Home} /> | |
</Scene> | |
</Scene> | |
</Router> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment