From 1fc659db29b6dcc9fb1af845591e75fbc4b998fe Mon Sep 17 00:00:00 2001 From: "satyajit.happy" Date: Tue, 1 Oct 2019 00:33:58 +0200 Subject: [PATCH] fix: fix types for navigationConfig closes #211, #222 --- src/types.tsx | 6 ++++-- src/views/StackView/StackView.tsx | 2 +- src/views/StackView/StackViewLayout.tsx | 21 ++++++--------------- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/types.tsx b/src/types.tsx index bc686dd8b..c8088bdb3 100644 --- a/src/types.tsx +++ b/src/types.tsx @@ -66,7 +66,7 @@ export type HeaderLayoutPreset = 'left' | 'center'; export type HeaderTransitionPreset = 'fade-in-place' | 'uikit'; -export type HeaderBackgroundTransitionPreset = 'translate' | 'fade'; +export type HeaderBackgroundTransitionPreset = 'translate' | 'fade' | 'toggle'; export type HeaderProps = { mode: HeaderMode; @@ -142,15 +142,17 @@ export type NavigationStackConfig = { headerBackgroundTransitionPreset?: HeaderBackgroundTransitionPreset; headerBackTitleVisible?: boolean; disableKeyboardHandling?: boolean; + transparentCard?: boolean; cardShadowEnabled?: boolean; cardOverlayEnabled?: boolean; + cardStyle?: StyleProp; onTransitionStart?: () => void; onTransitionEnd?: () => void; transitionConfig?: ( transitionProps: TransitionProps, prevTransitionProps?: TransitionProps, isModal?: boolean - ) => HeaderTransitionConfig; + ) => TransitionConfig; }; export type NavigationStackScreenProps< diff --git a/src/views/StackView/StackView.tsx b/src/views/StackView/StackView.tsx index 24889936e..66389078a 100644 --- a/src/views/StackView/StackView.tsx +++ b/src/views/StackView/StackView.tsx @@ -103,7 +103,7 @@ class StackView extends React.Component { return ( ; transitionProps: TransitionProps; lastTransitionProps?: TransitionProps; transitionConfig?: ( transitionProps: TransitionProps, prevTransitionProps?: TransitionProps, isModal?: boolean - ) => HeaderTransitionConfig; + ) => TransitionConfig; onGestureBegin?: () => void; onGestureEnd?: () => void; onGestureCanceled?: () => void; @@ -137,6 +127,7 @@ const getDefaultHeaderHeight = (isLandscape: boolean) => { class StackViewLayout extends React.Component { static contextType = ThemeContext; + context!: React.ContextType; private panGestureRef: React.RefObject; @@ -945,7 +936,7 @@ class StackViewLayout extends React.Component { private renderCard = (scene: Scene) => { const { transitionProps, - shadowEnabled, + cardShadowEnabled, cardOverlayEnabled, transparentCard, cardStyle, @@ -956,7 +947,7 @@ class StackViewLayout extends React.Component { screenInterpolator && screenInterpolator({ ...transitionProps, - shadowEnabled, + shadowEnabled: cardShadowEnabled, cardOverlayEnabled, position: this.position, scene,