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

Commit b3c7250

Browse files
committed
refactor: export a modal transition preset
1 parent 3f5b903 commit b3c7250

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/TransitionConfigs/TransitionPresets.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,8 @@ export const DefaultTransition = Platform.select({
7979
? FadeFromBottomAndroid
8080
: WipeFromBottomAndroid,
8181
});
82+
83+
export const ModalTransition = Platform.select({
84+
ios: ModalSlideFromBottomIOS,
85+
default: DefaultTransition,
86+
});

src/views/Stack/Stack.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Props as HeaderContainerProps } from '../Header/HeaderContainer';
1414
import StackItem from './StackItem';
1515
import {
1616
DefaultTransition,
17-
ModalSlideFromBottomIOS,
17+
ModalTransition,
1818
} from '../../TransitionConfigs/TransitionPresets';
1919
import { forNoAnimation } from '../../TransitionConfigs/HeaderStyleInterpolators';
2020
import {
@@ -301,9 +301,7 @@ export default class Stack extends React.Component<Props, State> {
301301
const focusedOptions = descriptors[focusedRoute.key].options;
302302

303303
let defaultTransitionPreset =
304-
mode === 'modal' && Platform.OS === 'ios'
305-
? ModalSlideFromBottomIOS
306-
: DefaultTransition;
304+
mode === 'modal' ? ModalTransition : DefaultTransition;
307305

308306
if (headerMode === 'screen') {
309307
defaultTransitionPreset = {

0 commit comments

Comments
 (0)