React-native-snap-carousel: [Android] Blank and crash when momentum is false in 3.3.0

Created on 3 Oct 2017  路  4Comments  路  Source: meliorence/react-native-snap-carousel

The carousel is blank and the app crash after a few seconds.

screenshot_2017-10-03-15-48-59-919_com exctingproject gehoko

I don't use inactiveSlideOpacity neither inactiveSlideScale (i set to 1) so if I comment the function _hackActiveSlideAnimation the carousel render ok without crash but, It's possible that Android work like iOS? The performance in Android is very bad because is too slow to launch onSnapToItem, and it allows scroll too much (because Android not use decelerationRate) and after the scroll go back to the next element or not beacuse sometime back to the start element, in iOS only scroll to the next element or to the previous element and the onSnapToItem is execute instantly never fails.

If in Android set true momentum the scroll is more natural but like without momentum the perfomance is very bad, the carousel is freeze a few seconds and it takes a long time to set the element's index.

Device: Xiaomi redmi note 3
Android: 6.0.1
React-Native: 0.48.4

All 4 comments

Regarding the issue, I'm currently trying to recreate it in order to fix it. Are you rendering the Carousel component with an empty data prop initially?

Regarding Android performance, make sure to read this note from the doc. All the problems that you describe are linked to Android's debug mode which is a mess: timeouts regularly desynchronize and scroll events are fired in a pretty random order, which completely alters carousel's logic. Make sure to test the plugin with a production build.

Note that we rely on React Native's ScrollView implementation, which means we unfortunately cannot tweak things as much as we'd like to... Still, carousel's performance and behavior are pretty good on both OS with version 3.3.0. Just make sure to test Android without dev mode enabled or in a production app ;-)

The issue should be solved if you use the following commit:

"react-native-snap-carousel": "https://github.com/archriss/react-native-snap-carousel#1f91a32"

Can you confirm?

@bd-arc Experienced the same issue when rendering with empty data prop initially. Your commit seems to fix the issue!

Thx for the great package btw. :)

@robertmerten Thanks for the feedback! The fix has been published in version 3.3.1.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

siderakis picture siderakis  路  3Comments

ajonno picture ajonno  路  4Comments

wkwyatt picture wkwyatt  路  4Comments

naffiq picture naffiq  路  5Comments

niloufarMakhzani picture niloufarMakhzani  路  4Comments