Skip to content

Commit b48d083

Browse files
authored
[Fix #3194 #3176] Adjust reset to work with nested routes (#3237)
Solves #3194 and #3176.
1 parent bb2e5bb commit b48d083

File tree

17 files changed

+698
-494
lines changed

17 files changed

+698
-494
lines changed

.babelrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
"extends": "./babel.config.js"
3+
};

Example/Example.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const Example = () => (
6363
<Lightbox key="lightbox">
6464
<Stack hideNavBar key="root" titleStyle={{ alignSelf: 'center' }}>
6565
<Scene key="echo" back clone component={EchoView} getTitle={({ navigation }) => navigation.state.key} />
66-
<Scene key="launch" component={Launch} title="Launch" initial />
66+
<Scene key="launch" component={Launch} title="Launch" initial type={ActionConst.RESET} />
6767

6868
<Stack key="customNavBar" hideTabBar titleStyle={{ alignSelf: 'center' }}>
6969
<Scene key="customNavBar1" title="CustomNavBar 1" navBar={CustomNavBar} component={CustomNavBarView} back />
@@ -86,6 +86,7 @@ const Example = () => (
8686
<Scene hideNavBar panHandlers={null}>
8787
<Tabs
8888
key="tabbar"
89+
routeName="tabbar"
8990
backToInitial
9091
swipeEnabled
9192
showLabel={false}
@@ -114,7 +115,7 @@ const Example = () => (
114115
</Stack>
115116

116117
<Stack key="tab_3" icon={TabIcon} title="Tab #3">
117-
<Scene key="tab_3_1" component={TabView} rightTitle="Right3" onRight={() => {}} />
118+
<Scene key="tab_3_1" component={TabView} rightTitle="Reset to 'tabbar'" onRight={() => Actions.reset('tabbar')} />
118119
</Stack>
119120
<Scene key="tab_4_1" component={TabView} title="Tab #4" hideNavBar icon={TabIcon} />
120121
<Stack key="tab_5" icon={TabIcon} title="Tab #5">

Example/components/drawer/DrawerContent.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class DrawerContent extends React.Component {
4747
Switch to tab5 with data
4848
</Button>
4949
<Button onPress={Actions.echo}>Push Clone Scene (EchoView)</Button>
50+
<Button onPress={Actions.launch}>Reset back to launch</Button>
5051
</View>
5152
);
5253
}

Example/package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,27 @@
1111
"*/@babel/cli": "7.0.0-beta.47",
1212
"*/@babel/core": "7.0.0-beta.47",
1313
"*/@babel/code-frame": "7.0.0-beta.47",
14-
"*/@babel/highlight": "7.0.0-beta.47",
15-
"*/babel-core": "7.0.0-bridge.0"
14+
"*/@babel/generator": "7.0.0-beta.47",
15+
"*/@babel/highlight": "7.0.0-beta.47"
1616
},
1717
"dependencies": {
1818
"prop-types": "^15.6.2",
19-
"react": "^16.4.1",
20-
"react-native": "^0.56.0",
19+
"react": "16.4.1",
20+
"react-native": "0.56.0",
2121
"react-native-button": "^2.3.0",
2222
"react-native-message-bar": "^2.0.10",
2323
"react-native-router-flux": "file:..",
24-
"react-navigation": "^2.12.1"
24+
"react-navigation": "2.12.x"
2525
},
2626
"devDependencies": {
27+
"@babel/code-frame": "7.0.0-beta.47",
2728
"@babel/core": "7.0.0-beta.47",
2829
"@babel/plugin-proposal-decorators": "7.0.0-beta.47",
2930
"autobind-decorator": "^2.1.0",
3031
"babel-core": "^7.0.0-0",
31-
"babel-jest": "^23.4.2",
32-
"babel-preset-react-native": "^5.0.2",
33-
"jest": "^23.5.0",
32+
"babel-jest": "^23.4.0",
33+
"babel-preset-react-native": "5.0.2",
34+
"jest": "^23.4.1",
3435
"react-test-renderer": "^16.4.2"
3536
},
3637
"jest": {

0 commit comments

Comments
 (0)