acorn icon indicating copy to clipboard operation
acorn copied to clipboard

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

Open gumil opened this issue 4 years ago • 3 comments

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.

gumil avatar Sep 18 '19 21:09 gumil

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?

nhaarman avatar Sep 19 '19 18:09 nhaarman

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

gumil avatar Sep 19 '19 19:09 gumil

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

nhaarman avatar Sep 20 '19 06:09 nhaarman