atlanteh / react-native-slot-machine

Text slot machine for react-native
MIT License
156 stars 39 forks source link

Performance Issue #5

Closed jlorencelim closed 6 years ago

jlorencelim commented 6 years ago

I tried having around 3-4 slot machine components and its very laggy. Is there a way that this can be fixed?

atlanteh commented 6 years ago

Android was always slower on animations than iOS. Maybe there's a way if we change to native driver instead. If you can test it, it would be great :)

jlorencelim commented 6 years ago

I tried it using the iOS through my device. Same result :(

weswes commented 6 years ago

Maybe we could have the "useNativeDriver" as a prop on SlotMachine ? This way we'll be able to enable or disable it.

atlanteh commented 6 years ago

Sure we can, I'm a little busy over the next few days, so if someone can create a PR that will be great (just don't forget to update the docs). It's a small pr but needs to be tested both in android and iOS.

weswes commented 6 years ago

I've made some tests and unfortunatly it's not so easy. Native Animation only support non layout props. This module uses 'top' property to animate so we can't use Native Driver as is. It could be possible by using translateY instead of top property.

atlanteh commented 6 years ago

Did you try to check with translateY?

weswes commented 6 years ago

It's done, I'll push a PR after testing on iOS. Tests are ok on android and it's way better !

atlanteh commented 6 years ago

Awesome. Thx!

atlanteh commented 6 years ago

Published 0.3.2