From 2ed2d20dfe22e5fa53bad8f0b02af95f336febd1 Mon Sep 17 00:00:00 2001 From: Logan Bernard Date: Tue, 12 May 2015 18:09:08 -0700 Subject: [PATCH] FloatFromLeft animation Summary: float from left animation for Navigator.SceneConfigs #1100 @ericvicenti @ide Closes https://github.com/facebook/react-native/pull/1249 Github Author: Logan Bernard @public Test Plan: Video: https://drive.google.com/file/d/0B9HtmABaCcR0Zi1yNkl5UDhWbzg/view --- .../Navigator/NavigatorSceneConfigs.js | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js b/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js index 3b4666b93..ed295346d 100644 --- a/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js +++ b/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js @@ -101,6 +101,18 @@ var FadeToTheLeft = { }, }; +var FadeToTheRight = { + ...FadeToTheLeft, + transformTranslate: { + from: {x: 0, y: 0, z: 0}, + to: {x: Math.round(SCREEN_WIDTH * 0.3), y: 0, z: 0}, + }, + translateX: { + from: 0, + to: Math.round(SCREEN_WIDTH * 0.3), + } +}; + var FadeIn = { opacity: { from: 0, @@ -187,6 +199,27 @@ var FromTheRight = { }, }; +var FromTheLeft = { + ...FromTheRight, + transformTranslate: { + from: {x: -SCREEN_WIDTH, y: 0, z: 0}, + to: {x: 0, y: 0, z: 0}, + min: 0, + max: 1, + type: 'linear', + extrapolate: true, + round: PixelRatio.get(), + }, + translateX: { + from: -SCREEN_WIDTH, + 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 @@ -374,6 +407,13 @@ var NavigatorSceneConfigs = { ...BaseConfig, // We will want to customize this soon }, + FloatFromLeft: { + ...BaseConfig, + animationInterpolators: { + into: buildStyleInterpolator(FromTheLeft), + out: buildStyleInterpolator(FadeToTheRight), + }, + }, FloatFromBottom: { ...BaseConfig, gestures: {