Skip to content
This repository has been archived by the owner on Nov 26, 2019. It is now read-only.

Commit

Permalink
Tweak the wipe animation to be more accurate
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed May 24, 2019
1 parent 58901b2 commit 5cfceef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
7 changes: 3 additions & 4 deletions src/TransitionConfigs/TransitionPresets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import {
import { forUIKit, forNoAnimation } from './HeaderStyleInterpolators';
import {
TransitionSpecIOS,
WipeInFromBottomAndroidSpec,
WipeOutToBottomAndroidSpec,
WipeFromBottomAndroidSpec,
FadeOutToBottomAndroidSpec,
FadeInFromBottomAndroidSpec,
} from './TransitionSpecs';
Expand Down Expand Up @@ -58,8 +57,8 @@ export const WipeFromBottomAndroid: TransitionPreset = {
direction: 'vertical',
headerMode: 'screen',
transitionSpec: {
open: WipeInFromBottomAndroidSpec,
close: WipeOutToBottomAndroidSpec,
open: WipeFromBottomAndroidSpec,
close: WipeFromBottomAndroidSpec,
},
cardStyleInterpolator: forWipeFromBottomAndroid,
headerStyleInterpolator: forNoAnimation,
Expand Down
17 changes: 5 additions & 12 deletions src/TransitionConfigs/TransitionSpecs.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Easing } from 'react-native-reanimated';
import { TransitionSpec } from '../types';

export const TransitionSpecIOS: TransitionSpec = {
export const TransitionIOSSpec: TransitionSpec = {
timing: 'spring',
config: {
stiffness: 1000,
Expand Down Expand Up @@ -32,19 +32,12 @@ export const FadeOutToBottomAndroidSpec: TransitionSpec = {
};

// See http://androidxref.com/9.0.0_r3/xref/frameworks/base/core/res/res/anim/activity_open_enter.xml
export const WipeInFromBottomAndroidSpec: TransitionSpec = {
export const WipeFromBottomAndroidSpec: TransitionSpec = {
timing: 'timing',
config: {
duration: 425,
easing: Easing.bezier(0.4, 0, 0.2, 1),
},
};

// See http://androidxref.com/9.0.0_r3/xref/frameworks/base/core/res/res/anim/activity_close_exit.xml
export const WipeOutToBottomAndroidSpec: TransitionSpec = {
timing: 'timing',
config: {
duration: 425,
easing: Easing.bezier(0.4, 0, 0.2, 1),
// This is super rough approximation of the path used for the curve by android
// See http://androidxref.com/9.0.0_r3/xref/frameworks/base/core/res/res/interpolator/fast_out_extra_slow_in.xml
easing: Easing.bezier(0.35, 0.45, 0, 1),
},
};

0 comments on commit 5cfceef

Please sign in to comment.