mirror of
https://github.com/status-im/react-navigation.git
synced 2025-02-24 17:18:09 +00:00
Pass transition and modal props to transitionConfigurer (#2383)
* Pass transition and modal props to transitionConfigurer * Make arguments passed to transitionConfigurer required * Update docs with params passed to transitionConfigurer
This commit is contained in:
parent
5e26ced280
commit
2ee85482ba
@ -85,7 +85,10 @@ Visual options:
|
||||
- `screen` - Each screen has a header attached to it and the header fades in and out together with the screen. This is a common pattern on Android.
|
||||
- `none` - No header will be rendered.
|
||||
- `cardStyle` - Use this prop to override or extend the default style for an individual card in stack.
|
||||
- `transitionConfig` - Function to return an object that overrides default screen transitions.
|
||||
- `transitionConfig` - Function to return an object that is merged with the default screen transitions (take a look at TransitionConfig in [type definitions](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js)). Provided function will be passed the following arguments:
|
||||
- `transitionProps` - Transition props for the new screen.
|
||||
- `prevTransitionProps` - Transitions props for the old screen.
|
||||
- `isModal` - Boolean specifying if screen is modal.
|
||||
- `onTransitionStart` - Function to be invoked when the card transition animation is about to start.
|
||||
- `onTransitionEnd` - Function to be invoked once the card transition animation completes.
|
||||
|
||||
|
@ -84,7 +84,11 @@ function defaultTransitionConfig(
|
||||
}
|
||||
|
||||
function getTransitionConfig(
|
||||
transitionConfigurer?: () => TransitionConfig,
|
||||
transitionConfigurer?: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps: NavigationTransitionProps,
|
||||
isModal: boolean
|
||||
) => TransitionConfig,
|
||||
// props for the new screen
|
||||
transitionProps: NavigationTransitionProps,
|
||||
// props for the old screen
|
||||
@ -99,7 +103,7 @@ function getTransitionConfig(
|
||||
if (transitionConfigurer) {
|
||||
return {
|
||||
...defaultConfig,
|
||||
...transitionConfigurer(),
|
||||
...transitionConfigurer(transitionProps, prevTransitionProps, isModal),
|
||||
};
|
||||
}
|
||||
return defaultConfig;
|
||||
|
Loading…
x
Reference in New Issue
Block a user