Kureev / react-native-side-menu

Side menu component for React Native
MIT License
2.21k stars 433 forks source link

Any examples with LayoutAnimation? #157

Closed onchainguy-btc closed 8 years ago

onchainguy-btc commented 8 years ago

I was wondering if anyone tried to use this module in combination with LayoutAnimation? When switching between views in my side menu it's sometimes a bit laggy due to the parallel rendering of the new view. I was hoping that maybe LayoutAnimation might help here.

Kureev commented 8 years ago

Unfortunately, no. We used to use layout animation back in a days, but the real issue is about the way react-native handles an animation. You probably need to use an InteractionManager for this stuff. But first of all I'd recommend you to see a talk from @brentvatne

onchainguy-btc commented 8 years ago

The talk from @brentvatne is great, helped me a lot. My view transitions run smooth now with his "tricks". But when I read the notes on https://facebook.github.io/react-native/docs/performance.html#content it says that LayoutAnimation uses Core Animation and does not get affected by frame drops from Javascript. Isn't that still interesting for this library or is it not possible to use LayoutAnimation with something like the PanResponder?

Kureev commented 8 years ago

The funny thing is it used a LayoutAnimation back in a days, but trust me, it has exactly the same performance issues as the Animation library. But the reason why we migrated to it from LayoutAnimation was about custom animations of opening (see props animationFunction and animationStyle). You can try to fork it and implement LayoutAnimation instead, but don't think that would really help you to solve your problem.

P.S. You can also take a look on this implementation of side menu. It use a LayoutAnimation as you want.

onchainguy-btc commented 8 years ago

@Kureev okay strange. Then I really wonder why it had the same performance issues. Seems that LayoutAnimation also gets affected by JS and main thread frame drops. Anyway thanks for your information, I will give the library from @khanghoang a try and post my experience here afterwards.

For now I am very satisfied with this library when using InteractionManager.runAfterInteractions