diff --git a/src/views/CardStackStyleInterpolator.js b/src/views/CardStackStyleInterpolator.js index 8d46c43..27d4119 100644 --- a/src/views/CardStackStyleInterpolator.js +++ b/src/views/CardStackStyleInterpolator.js @@ -53,18 +53,24 @@ function forHorizontal(props: NavigationSceneRendererProps): Object { } const index = scene.index; - const inputRange = [index - 1, index, index + 0.99, index + 1]; + const inputRange = [index - 1, index, index + 1]; - // Add ~30px to the interpolated width screens width for horizontal movement. This allows - // the screen's shadow to go screen fully offscreen without abruptly dissapearing - const width = layout.initWidth + 30; + const width = layout.initWidth; const outputRange = I18nManager.isRTL - ? ([-width, 0, 10, 10]: Array) - : ([width, 0, -10, -10]: Array); + ? ([-width, 0, 10]: Array) + : ([width, 0, -10]: Array); + // Add [index - 1, index - 0.99] to the interpolated opacity for screen transition. + // This makes the screen's shadow to disappear smoothly. const opacity = position.interpolate({ - inputRange, - outputRange: ([1, 1, 0.3, 0]: Array), + inputRange: ([ + index - 1, + index - 0.99, + index, + index + 0.99, + index + 1, + ]: Array), + outputRange: ([0, 1, 1, 0.3, 0]: Array), }); const translateY = 0; @@ -94,18 +100,23 @@ function forVertical(props: NavigationSceneRendererProps): Object { } const index = scene.index; - const inputRange = [index - 1, index, index + 0.99, index + 1]; const height = layout.initHeight; const opacity = position.interpolate({ - inputRange, - outputRange: ([1, 1, 0.3, 0]: Array), + inputRange: ([ + index - 1, + index - 0.99, + index, + index + 0.99, + index + 1, + ]: Array), + outputRange: ([0, 1, 1, 0.3, 0]: Array), }); const translateX = 0; const translateY = position.interpolate({ - inputRange, - outputRange: ([height, 0, 0, 0]: Array), + inputRange: ([index - 1, index, index + 1]: Array), + outputRange: ([height, 0, 0]: Array), }); return {