Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added transitions 'VerticalUpSwipeJump' and 'VerticalDownSwipeJump' in… #1822

Closed
wants to merge 3 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 148 additions & 0 deletions Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe FromTheTop instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it gets better! I will change, thank you.

...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)
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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;