From 1888a0af16ea42736faa3d3e99f63cbbb84e2278 Mon Sep 17 00:00:00 2001 From: Naisheel Verdhan Date: Thu, 10 Nov 2016 08:13:21 -0800 Subject: [PATCH] Add a new Navigator SceneConfig swipeFromLeft Summary: Add a new `SwipeFromLeft` Navigator SceneConfig. The animation is the opposite of `HorizontalSwipeJump`, however there's no `Jump` while animating as `HorizontalSwipeJump`. Should `HorizontalSwipeJump` be renamed to `SwipeFromRight`? ![swipe-left-anim-2](https://cloud.githubusercontent.com/assets/8182981/18466947/8ca4dd24-79bb-11e6-8cae-8ffa34c0c7da.gif) Closes https://github.com/facebook/react-native/pull/9877 Differential Revision: D4160059 Pulled By: hramos fbshipit-source-id: 7426ec72adea80af2d5612aae1dd9d2e6dc090f3 --- .../CustomComponents/Navigator/Navigator.js | 1 + .../Navigator/NavigatorSceneConfigs.js | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Libraries/CustomComponents/Navigator/Navigator.js b/Libraries/CustomComponents/Navigator/Navigator.js index 7df170101..fd2f73bd6 100644 --- a/Libraries/CustomComponents/Navigator/Navigator.js +++ b/Libraries/CustomComponents/Navigator/Navigator.js @@ -314,6 +314,7 @@ var Navigator = React.createClass({ * - Navigator.SceneConfigs.FloatFromBottom * - Navigator.SceneConfigs.FloatFromBottomAndroid * - Navigator.SceneConfigs.FadeAndroid + * - Navigator.SceneConfigs.SwipeFromLeft * - Navigator.SceneConfigs.HorizontalSwipeJump * - Navigator.SceneConfigs.HorizontalSwipeJumpFromRight * - Navigator.SceneConfigs.HorizontalSwipeJumpFromLeft diff --git a/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js b/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js index 5e4decb0c..cca43a579 100644 --- a/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js +++ b/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js @@ -655,6 +655,27 @@ var NavigatorSceneConfigs = { out: buildStyleInterpolator(FadeOut), }, }, + SwipeFromLeft: { + ...BaseConfig, + gestures: { + jumpBack: { + ...directionMapping.BaseEndToStartGesture, + overswipe: BaseOverswipeConfig, + edgeHitWidth: null, + isDetachable: true, + }, + jumpForward: { + ...directionMapping.BaseStartToEndGesture, + overswipe: BaseOverswipeConfig, + edgeHitWidth: null, + isDetachable: true, + }, + }, + animationInterpolators: { + into: buildStyleInterpolator(directionMapping.FromTheStart), + out: buildStyleInterpolator(directionMapping.ToTheEnd), + }, + }, HorizontalSwipeJump: { ...BaseConfig, gestures: {