Skip to content

Commit 9f33120

Browse files
author
aksonov
committed
use built-in android back handler
1 parent 6eee3b1 commit 9f33120

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

Example/Example.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,11 @@ 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-
7365
const Example = () => (
7466
<Router
7567
createReducer={reducerCreate}
7668
getSceneStyle={getSceneStyle}
77-
uriPrefix={prefix}
78-
backAndroidHandler={onBackPress}>
69+
uriPrefix={prefix}>
7970

8071
<Overlay key="overlay">
8172
<Modal key="modal"
@@ -215,9 +206,7 @@ const Example = () => (
215206
onRight={() => { }}
216207
/>
217208
</Stack>
218-
<Stack key="tab_4">
219-
<Scene key="tab_4_1" component={TabView} title="Tab #4" hideNavBar icon={TabIcon} />
220-
</Stack>
209+
<Scene key="tab_4_1" component={TabView} title="Tab #4" hideNavBar icon={TabIcon} />
221210
<Stack key="tab_5">
222211
<Scene key="tab_5_1" component={TabView} title="Tab #5" icon={TabIcon} />
223212
</Stack>

0 commit comments

Comments
 (0)