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

feat: allow specifying separate style interpolators in navigationOptions #155

Merged
merged 3 commits into from
Jul 6, 2019
Merged

feat: allow specifying separate style interpolators in navigationOptions #155

merged 3 commits into from
Jul 6, 2019

Conversation

tchayen
Copy link
Contributor

@tchayen tchayen commented Jul 5, 2019

As @satya164 suggested in #154, instead of passing navigationOptions to interpolators, they can be allowed to specify their own interpolators.

Custom interpolator, if defined, takes precedence over the one from NavigationConfig. The rest of the logic stays the same.

@tchayen tchayen changed the title @tchayen/allow per screen interpolators feat: allow specifying separate style interpolators in navigationOptions Jul 5, 2019
src/views/Stack/StackItem.tsx Outdated Show resolved Hide resolved
src/types.tsx Outdated Show resolved Hide resolved
Copy link
Member

@satya164 satya164 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Instead of adding this in navigationOptions, I'd move this prop entirely to NavigationStackOptions and remove it from NavigationConfig.

This means we also need to move the direction and transitionSpec options so it's possible to use a TransitionPreset in navigationOptions.

Edit: We should probably also rename direction option to transitionDirection to avoid ambiguity.

Edit: Or direction is fine. It's not just for transition, but both gesture and transition.

@tchayen
Copy link
Contributor Author

tchayen commented Jul 5, 2019

@satya164 I tried removing TransitionPreset from NavigationConfig, but I am stuck on one thing: Stack.tsx calls renderHeader and passes the 'global' headerStyleInterpolator to it. How would you replace it?

@tchayen
Copy link
Contributor Author

tchayen commented Jul 5, 2019

@satya164 I implemented removal of TransitionPreset from NavigationConfig . It involves changing all the related props in the chain of StackView, Stack and StackItem components.

Default transitionPreset is computed in StackView and then, in Stack, any defined screen specific options override the default ones.

Unfortunately the problem with missing headerStyleInterpolator remains 😢.

@satya164
Copy link
Member

satya164 commented Jul 5, 2019

@tchayen I'll take care of it tomorrow.

@satya164
Copy link
Member

satya164 commented Jul 5, 2019

Thank you for updating the PR :D

@satya164
Copy link
Member

satya164 commented Jul 5, 2019

@tchayen I have pushed the commit here: bdfaaf9

Please test if it works when you have time and update your PR with the commit.

@tchayen
Copy link
Contributor Author

tchayen commented Jul 5, 2019

@satya164 it works. Pushing the commit.

@satya164 satya164 merged commit 16823e3 into react-navigation:@satya164/reanimated-stacks Jul 6, 2019
@tchayen tchayen deleted the @tchayen/allow-per-screen-interpolators branch July 8, 2019 10:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants