nhaarman / acorn

Mastering Android navigation :chipmunk:
https://nhaarman.github.io/acorn
Apache License 2.0
181 stars 7 forks source link

No way to know if Transitions to same Scene class is backwards #151

Open gumil opened 4 years ago

gumil commented 4 years ago

Is your feature request related to a problem? Please describe. For example: Scene1 pushes to Scene1 They are the same scenes but can have different data. So during transition there's no way to identify if the scene is going back one screen since it is still the same scene class.

An example of a transition that affects this is sliding from left to right. When going back it should be from right to left.

Describe the solution you'd like Have a way in transition factory to know if the transition happening is going back or forward.

Describe alternatives you've considered Is it also possible for a more granular transition mechanism where it can be specified on specific navigators?

This is an edge case it seems as I am trying this out in a sample application with unrealistic backstack and screens.

nhaarman commented 4 years ago

There is TransitionData which contains an isBackwards property, and is passed to the SceneTransitionFactory.

For the StackNavigator this data is properly set when pushing and popping and is used for the default transitions accordingly.

Is this what you're looking for?

gumil commented 4 years ago

Yes this is it. Thanks for the help. This feature is kinda hard to find. It was not in the documentation and I assumed acorn creates it using only the DSL

nhaarman commented 4 years ago

Cool! I'll make sure it gets added to the docs :+1: