From ee63353e4be02f5483a0973aaf303be896e2bcfd Mon Sep 17 00:00:00 2001 From: Matheus Santos Date: Tue, 30 Jun 2015 21:23:44 -0300 Subject: [PATCH 1/2] Added trasitions 'VerticalUpSwipeJump' and 'VerticalDownSwipeJump' in NavigatorSceneConfigs --- .../Navigator/NavigatorSceneConfigs.js | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) diff --git a/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js b/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js index 439534ddda30e5..12bdedd427584a 100644 --- a/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js +++ b/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js @@ -163,6 +163,56 @@ var ToTheLeft = { }, }; +var ToTheUp = { + transformTranslate: { + from: {x: 0, y: 0, z: 0}, + to: {x: 0, y: -Dimensions.get('window').height, z: 0}, + min: 0, + max: 1, + type: 'linear', + extrapolate: true, + round: PixelRatio.get(), + }, + opacity: { + value: 1.0, + type: 'constant', + }, + translateY: { + from: 0, + to: -Dimensions.get('window').height, + min: 0, + max: 1, + type: 'linear', + extrapolate: true, + round: PixelRatio.get(), + }, +}; + +var ToTheDown = { + transformTranslate: { + from: {x: 0, y: 0, z: 0}, + to: {x: 0, y: Dimensions.get('window').height, z: 0}, + min: 0, + max: 1, + type: 'linear', + extrapolate: true, + round: PixelRatio.get(), + }, + opacity: { + value: 1.0, + type: 'constant', + }, + translateY: { + from: 0, + to: Dimensions.get('window').height, + min: 0, + max: 1, + type: 'linear', + extrapolate: true, + round: PixelRatio.get(), + }, +}; + var FromTheRight = { opacity: { value: 1.0, @@ -221,6 +271,50 @@ var FromTheLeft = { }, }; +var FromTheDown = { + ...FromTheRight, + transformTranslate: { + from: {y: SCREEN_HEIGHT, x: 0, z: 0}, + to: {x: 0, y: 0, z: 0}, + min: 0, + max: 1, + type: 'linear', + extrapolate: true, + round: PixelRatio.get(), + }, + translateY: { + from: SCREEN_HEIGHT, + to: 0, + min: 0, + max: 1, + type: 'linear', + extrapolate: true, + round: PixelRatio.get(), + }, +}; + +var FromTheUp = { + ...FromTheRight, + transformTranslate: { + from: {y: -SCREEN_HEIGHT, x: 0, z: 0}, + to: {x: 0, y: 0, z: 0}, + min: 0, + max: 1, + type: 'linear', + extrapolate: true, + round: PixelRatio.get(), + }, + translateY: { + from: -SCREEN_HEIGHT, + to: 0, + min: 0, + max: 1, + type: 'linear', + extrapolate: true, + round: PixelRatio.get(), + }, +}; + var ToTheBack = { // Rotate *requires* you to break out each individual component of // rotation (x, y, z, w) @@ -378,6 +472,18 @@ var BaseRightToLeftGesture = { direction: 'right-to-left', }; +var BaseDownUpGesture = { + ...BaseLeftToRightGesture, + fullDistance: SCREEN_HEIGHT, + direction: 'down-to-up', +}; + +var BaseUpDownGesture = { + ...BaseLeftToRightGesture, + fullDistance: SCREEN_HEIGHT, + direction: 'up-to-down', +}; + var BaseConfig = { // A list of all gestures that are enabled on this scene gestures: { @@ -468,6 +574,48 @@ var NavigatorSceneConfigs = { out: buildStyleInterpolator(ToTheLeft), }, }, + VerticalUpSwipeJump: { + ...BaseConfig, + gestures: { + jumpBack: { + ...BaseDownUpGesture, + overswipe: BaseOverswipeConfig, + edgeHitWidth: null, + isDetachable: true, + }, + jumpForward: { + ...BaseDownUpGesture, + overswipe: BaseOverswipeConfig, + edgeHitWidth: null, + isDetachable: true, + }, + }, + animationInterpolators: { + into: buildStyleInterpolator(FromTheDown), + out: buildStyleInterpolator(ToTheUp), + }, + }, + VerticalDownSwipeJump: { + ...BaseConfig, + gestures: { + jumpBack: { + ...BaseUpDownGesture, + overswipe: BaseOverswipeConfig, + edgeHitWidth: null, + isDetachable: true, + }, + jumpForward: { + ...BaseUpDownGesture, + overswipe: BaseOverswipeConfig, + edgeHitWidth: null, + isDetachable: true, + }, + }, + animationInterpolators: { + into: buildStyleInterpolator(FromTheUp), + out: buildStyleInterpolator(ToTheDown), + }, + }, }; module.exports = NavigatorSceneConfigs; From e1ff5e836749e7fbbcbe7dc79331829fe8cf76ff Mon Sep 17 00:00:00 2001 From: Matheus Santos Date: Fri, 17 Jul 2015 15:51:45 -0300 Subject: [PATCH 2/2] Change the new style interpolator name: 'FromTheUp' -> 'FromTheTop' --- Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js b/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js index 12bdedd427584a..37715e67896dab 100644 --- a/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js +++ b/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js @@ -293,7 +293,7 @@ var FromTheDown = { }, }; -var FromTheUp = { +var FromTheTop = { ...FromTheRight, transformTranslate: { from: {y: -SCREEN_HEIGHT, x: 0, z: 0}, @@ -612,7 +612,7 @@ var NavigatorSceneConfigs = { }, }, animationInterpolators: { - into: buildStyleInterpolator(FromTheUp), + into: buildStyleInterpolator(FromTheTop), out: buildStyleInterpolator(ToTheDown), }, },