Skip to content
This repository was archived by the owner on Apr 15, 2020. It is now read-only.

Commit b9dbc89

Browse files
committed
upgrade to new react-nav packages
1 parent ff63ea8 commit b9dbc89

12 files changed

Lines changed: 152 additions & 374 deletions

File tree

example/App.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ import React from 'react';
22
import Expo from 'expo';
33

44
import { View, Button } from 'react-native';
5-
import {
6-
createSwitchNavigator,
7-
createNavigationContainer,
8-
} from 'react-navigation';
5+
import { createSwitchNavigator } from '@react-navigation/core';
6+
import { createAppContainer } from '@react-navigation/native';
97
import Fade from './src/examples/Fade';
108
import Modal from './src/examples/Modal';
119
import Gesture from './src/examples/Gesture';
@@ -41,13 +39,13 @@ const AppNavigator = createSwitchNavigator({
4139
...EXAMPLES,
4240
});
4341

44-
const StatefulAppNavigator = createNavigationContainer(AppNavigator);
42+
const StatefulAppNavigator = createAppContainer(AppNavigator);
4543

46-
// const StatefulAppNavigator = createNavigationContainer(Fade);
47-
// const StatefulAppNavigator = createNavigationContainer(Modal);
48-
// const StatefulAppNavigator = createNavigationContainer(Gesture);
49-
// const StatefulAppNavigator = createNavigationContainer(CardStack);
50-
// const StatefulAppNavigator = createNavigationContainer(SharedEl);
44+
// const StatefulAppNavigator = createAppContainer(Fade);
45+
// const StatefulAppNavigator = createAppContainer(Modal);
46+
// const StatefulAppNavigator = createAppContainer(Gesture);
47+
// const StatefulAppNavigator = createAppContainer(CardStack);
48+
// const StatefulAppNavigator = createAppContainer(SharedEl);
5149

5250
const App = () => (
5351
<LayoutProvider style={{ flex: 1 }}>

example/package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@
1010
},
1111
"dependencies": {
1212
"expo": "~30.0.0",
13-
"hoist-non-react-statics": "^2.5.0",
14-
"prop-types": "^15.6.0",
15-
"react": "16.3.1",
1613
"react-native": "~0.55.4",
17-
"react-native-paper": "2.0.0-alpha.4",
18-
"react-native-screens": "^1.0.0-alpha.9",
19-
"react-navigation": "^2.11.1"
14+
"@react-navigation/core": "^3.0.0-alpha.7",
15+
"@react-navigation/native": "^3.0.0-alpha.5",
16+
"react": "16.3.1"
2017
},
2118
"devDependencies": {
2219
"babel-plugin-module-resolver": "^3.0.0",

example/src/FadeTransition.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import Animated, { Easing } from 'react-native-reanimated';
3-
const { Value, timing, interpolate } = Animated;
3+
const { Value, timing } = Animated;
44

55
export default class FadeTransition extends React.Component {
66
static navigationOptions = {
@@ -12,7 +12,6 @@ export default class FadeTransition extends React.Component {
1212
const isVisible = !!toState.routes.find(
1313
r => r.key === transition.transitionRouteKey
1414
);
15-
console.log('running fade transition! ', isVisible);
1615
await new Promise(resolve => {
1716
timing(transition.opacity, {
1817
toValue: isVisible ? 1 : 0,
@@ -23,19 +22,10 @@ export default class FadeTransition extends React.Component {
2322
},
2423
};
2524
render() {
26-
const { transition, navigation } = this.props;
27-
const myKey = navigation.state.key;
25+
const { transition } = this.props;
2826
let opacity = 1;
2927
if (transition) {
3028
opacity = transition.opacity;
31-
32-
// const { fromState, toState, progress } = transition;
33-
// const fromOpacity = fromState.routes.find(r => r.key === myKey) ? 1 : 0;
34-
// const toOpacity = toState.routes.find(r => r.key === myKey) ? 1 : 0;
35-
// opacity = interpolate(progress, {
36-
// inputRange: [0, 1],
37-
// outputRange: [fromOpacity, toOpacity],
38-
// });
3929
}
4030
return (
4131
<Animated.View style={{ flex: 1, opacity }}>

example/src/examples/CardStack.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
Text as UnstyledText,
55
View as UnstyledView,
66
} from 'react-native';
7-
import { createNavigator, StackRouter } from 'react-navigation';
7+
import { createNavigator, StackRouter } from '@react-navigation/core';
88
import { Transitioner } from 'react-navigation-transitioner';
99
import CardTransition from '../CardTransition';
1010

@@ -71,7 +71,8 @@ const App = createNavigator(
7171
StackRouter({
7272
HomeScreen,
7373
ProfileScreen,
74-
})
74+
}),
75+
{}
7576
);
7677

7778
export default App;

example/src/examples/Fade.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
Text as UnstyledText,
55
View as UnstyledView,
66
} from 'react-native';
7-
import { createNavigator, StackRouter } from 'react-navigation';
7+
import { createNavigator, StackRouter } from '@react-navigation/core';
88
import { Transitioner } from 'react-navigation-transitioner';
99
import FadeTransition from '../FadeTransition';
1010

@@ -63,7 +63,8 @@ const App = createNavigator(
6363
StackRouter({
6464
HomeScreen,
6565
ProfileScreen,
66-
})
66+
}),
67+
{}
6768
);
6869

6970
export default App;

example/src/examples/Gesture.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
StyleSheet,
77
TouchableWithoutFeedback,
88
} from 'react-native';
9-
import { createNavigator, StackRouter } from 'react-navigation';
9+
import { createNavigator, StackRouter } from '@react-navigation/core';
1010
import { Transitioner } from 'react-navigation-transitioner';
1111
import Animated from 'react-native-reanimated';
1212
import { PanGestureHandler, State } from 'react-native-gesture-handler';
@@ -288,7 +288,8 @@ const App = createNavigator(
288288
StackRouter({
289289
HomeScreen,
290290
ProfileScreen,
291-
})
291+
}),
292+
{}
292293
);
293294

294295
export default App;

example/src/examples/Modal.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
StyleSheet,
77
TouchableWithoutFeedback,
88
} from 'react-native';
9-
import { createNavigator, StackRouter } from 'react-navigation';
9+
import { createNavigator, StackRouter } from '@react-navigation/core';
1010
import { Transitioner } from 'react-navigation-transitioner';
1111
import Animated, { Easing } from 'react-native-reanimated';
1212
const { Value, timing, interpolate } = Animated;
@@ -146,7 +146,8 @@ const App = createNavigator(
146146
StackRouter({
147147
HomeScreen,
148148
ProfileScreen,
149-
})
149+
}),
150+
{}
150151
);
151152

152153
export default App;

0 commit comments

Comments
 (0)