react-navigation-controller icon indicating copy to clipboard operation
react-navigation-controller copied to clipboard

Real UINavigation animation

Open alexkvazos opened this issue 10 years ago • 4 comments

Is there a way to animate it so that the when a new view is pushed into the controller, the active view doesn't slide to the left to let the new one come in?

And when a view is popped, it will slide to the right and the previous one will be behind it instead of sliding from the left.

Right now the animation looks like a carousel while UINavigationController doesn't really look like a carousel.

Regards, Alex

alexkvazos avatar Jun 23 '16 22:06 alexkvazos

I believe what you are looking for are the REVEAL_ and COVER_ transition styles: https://github.com/aputinski/react-navigation-controller#pushviewview-options

aputinski avatar Jun 27 '16 19:06 aputinski

Is there a demo of those two working side by side?

alexkvazos avatar Jun 27 '16 19:06 alexkvazos

If you're looking to mimic the exact transition of UINavigationController, you can pass a function as the transition option and do whatever you'd like:

navigationController.pushView(<MyView />, {
  transition(prevElement, nextElement, done) {
    // Do some sort of animation on the views
    prevElement.style.transform = 'translate(100%, 0)';
    nextElement.style.transform = 'translate(0, 0)';
    // Tell the navigationController when the animation is complete
    setTimeout(done, 500);
  }
});

aputinski avatar Jun 27 '16 19:06 aputinski

Ah sweet, just what I was looking for. Thank you!

alexkvazos avatar Jun 27 '16 19:06 alexkvazos