Skip to content

Commit 2843534

Browse files
vibhavagarwal5aksonov
authored andcommitted
drawer fixed and faulty closeDrawer removed (#2745)
1 parent af8d461 commit 2843534

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

Example/Example.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,21 @@ const getSceneStyle = () => ({
6262
// on Android, the URI prefix typically contains a host in addition to scheme
6363
const prefix = Platform.OS === 'android' ? 'mychat://mychat/' : 'mychat://';
6464

65+
const onBackPress = () => {
66+
if (Actions.state.index !== 0) {
67+
return false
68+
}
69+
Actions.pop()
70+
return true
71+
}
72+
6573
const Example = () => (
6674
<Router
6775
createReducer={reducerCreate}
6876
getSceneStyle={getSceneStyle}
6977
uriPrefix={prefix}
70-
>
78+
backAndroidHandler={onBackPress}>
79+
7180
<Overlay key="overlay">
7281
<Modal key="modal"
7382
hideNavBar
@@ -130,6 +139,9 @@ const Example = () => (
130139
contentComponent={DrawerContent}
131140
drawerImage={MenuIcon}
132141
drawerWidth={300}
142+
drawerOpenRoute = 'DrawerOpen'
143+
drawerCloseRoute = 'DrawerClose'
144+
drawerToggleRoute = 'DrawerToggle'
133145
>
134146
{/*
135147
Wrapper Scene needed to fix a bug where the tabs would

Example/components/drawer/DrawerContent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class DrawerContent extends React.Component {
2929
render() {
3030
return (
3131
<View style={styles.container}>
32-
<Text>Drawer Content</Text>
33-
<Button onPress={Actions.closeDrawer}>Back</Button>
32+
{/* <Text>Drawer Content</Text>
33+
<Button onPress={Actions.closeDrawer}>Back</Button> */}
3434
<Text>Title: {this.props.title}</Text>
3535
{this.props.name === 'tab1_1' &&
3636
<Button onPress={Actions.tab_1_2}>next screen for tab1_1</Button>

0 commit comments

Comments
 (0)