|
1 | 1 | import React, { PureComponent } from 'react'
|
2 |
| -import { BackHandler } from 'react-native' |
| 2 | +import { BackHandler, Animated, Easing } from 'react-native' |
3 | 3 | import {
|
4 | 4 | StackNavigator,
|
5 | 5 | TabNavigator,
|
@@ -49,6 +49,30 @@ const AppNavigator = StackNavigator(
|
49 | 49 | navigationOptions: {
|
50 | 50 | gesturesEnabled: false,
|
51 | 51 | },
|
| 52 | + transitionConfig: () => ({ |
| 53 | + transitionSpec: { |
| 54 | + duration: 300, |
| 55 | + easing: Easing.out(Easing.poly(4)), |
| 56 | + timing: Animated.timing, |
| 57 | + }, |
| 58 | + screenInterpolator: sceneProps => { |
| 59 | + const { layout, position, scene } = sceneProps |
| 60 | + const { index } = scene |
| 61 | + |
| 62 | + const height = layout.initHeight |
| 63 | + const translateY = position.interpolate({ |
| 64 | + inputRange: [index - 1, index, index + 1], |
| 65 | + outputRange: [height, 0, 0], |
| 66 | + }) |
| 67 | + |
| 68 | + const opacity = position.interpolate({ |
| 69 | + inputRange: [index - 1, index - 0.99, index], |
| 70 | + outputRange: [0, 1, 1], |
| 71 | + }) |
| 72 | + |
| 73 | + return { opacity, transform: [{ translateY }] } |
| 74 | + }, |
| 75 | + }), |
52 | 76 | }
|
53 | 77 | )
|
54 | 78 |
|
|
0 commit comments