Skip to content
This repository has been archived by the owner on Feb 25, 2020. It is now read-only.

Commit

Permalink
refactor: export a modal transition preset
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Jul 8, 2019
1 parent 522f741 commit c306b28
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/TransitionConfigs/TransitionPresets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,8 @@ export const DefaultTransition = Platform.select({
? FadeFromBottomAndroid
: WipeFromBottomAndroid,
});

export const ModalTransition = Platform.select({
ios: ModalSlideFromBottomIOS,
default: DefaultTransition,
});
6 changes: 2 additions & 4 deletions src/views/Stack/Stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Props as HeaderContainerProps } from '../Header/HeaderContainer';
import StackItem from './StackItem';
import {
DefaultTransition,
ModalSlideFromBottomIOS,
ModalTransition,
} from '../../TransitionConfigs/TransitionPresets';
import { forNoAnimation } from '../../TransitionConfigs/HeaderStyleInterpolators';
import {
Expand Down Expand Up @@ -301,9 +301,7 @@ export default class Stack extends React.Component<Props, State> {
const focusedOptions = descriptors[focusedRoute.key].options;

let defaultTransitionPreset =
mode === 'modal' && Platform.OS === 'ios'
? ModalSlideFromBottomIOS
: DefaultTransition;
mode === 'modal' ? ModalTransition : DefaultTransition;

if (headerMode === 'screen') {
defaultTransitionPreset = {
Expand Down

0 comments on commit c306b28

Please sign in to comment.