Wednesday, June 29, 2016

Beware of Navigator

One of the first things you probably set up in your RN app is Navigator. Unlike NavigatorIOS, this works in both iOS and Android. However, the animation for Navigator is done in the JS thread which creates two serious problems.

First problem: Animation is very slow in the app.


Facebook acknowledges this problem, but the solution they offer isn't good (follow the link and take a read). Apart from the fact that having a renderPlaceholderOnly variable in state is messy, it only works when you push to the Navigator, not when you pop.

Second problem: Animation is even slower when you run in 'Debug in Chrome'.

In fact, it runs so slowly that I thought I'd frozen the app. If you're patient enough you can see the animation starting, but I've never waited for it to complete. When I'm developing with this option, I just replace any push onto the Navigator with replace. It breaks some functionality (you can't go back by popping) but at least you can run your code and debug it.




No comments:

Post a Comment