Skip to content

Commit

Permalink
[ReactNative] Androidized Navigator animations
Browse files Browse the repository at this point in the history
Summary:
Added configurations for android-like animations, with gestures disabled.

@public

Test Plan: Tested on AdsManager Android
  • Loading branch information
Eric Vicenti committed Apr 28, 2015
1 parent 4829775 commit 9209c44
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,30 @@ var FadeToTheLeft = {
},
};

var FadeIn = {
opacity: {
from: 0,
to: 1,
min: 0.5,
max: 1,
type: 'linear',
extrapolate: false,
round: 100,
},
};

var FadeOut = {
opacity: {
from: 1,
to: 0,
min: 0,
max: 0.5,
type: 'linear',
extrapolate: false,
round: 100,
},
};

var ToTheLeft = {
transformTranslate: {
from: {x: 0, y: 0, z: 0},
Expand Down Expand Up @@ -236,6 +260,43 @@ var FromTheFront = {
},
};

var ToTheBackAndroid = {
opacity: {
value: 1,
type: 'constant',
},
};

var FromTheFrontAndroid = {
opacity: {
from: 0,
to: 1,
min: 0,
max: 1,
type: 'linear',
extrapolate: false,
round: 100,
},
transformTranslate: {
from: {x: 0, y: 50, z: 0},
to: {x: 0, y: 0, z: 0},
min: 0,
max: 1,
type: 'linear',
extrapolate: true,
round: PixelRatio.get(),
},
translateY: {
from: 50,
to: 0,
min: 0,
max: 1,
type: 'linear',
extrapolate: true,
round: PixelRatio.get(),
},
};

var BaseOverswipeConfig = {
frictionConstant: 1,
frictionByDistance: 1.5,
Expand Down Expand Up @@ -319,6 +380,22 @@ var NavigatorSceneConfigs = {
out: buildStyleInterpolator(ToTheBack),
},
},
FloatFromBottomAndroid: {
...BaseConfig,
gestures: null,
animationInterpolators: {
into: buildStyleInterpolator(FromTheFrontAndroid),
out: buildStyleInterpolator(ToTheBackAndroid),
},
},
FadeAndroid: {
...BaseConfig,
gestures: null,
animationInterpolators: {
into: buildStyleInterpolator(FadeIn),
out: buildStyleInterpolator(FadeOut),
},
},
HorizontalSwipeJump: {
...BaseConfig,
gestures: {
Expand Down

0 comments on commit 9209c44

Please sign in to comment.