React-native-snap-carousel: [Android] App crash randomly (scrollToOffset)

Created on 21 Sep 2017  路  10Comments  路  Source: meliorence/react-native-snap-carousel

Sometimes, randomly, the app crash in Android.

The error:

imagen

Carousel props:

imagen

React-native versions I tried: 0.47.1 and 0.48.3
react-native-snap-carousel: 3.2.3
Android Studio Simulator (API 22)

bug

Most helpful comment

I think I know where the problem is. I will push a fix as soon as possible and will ask you guys to try it before releasing it.

All 10 comments

+1 for me this usually happens when I rotate device with the js debugging mode turned on

I think I know where the problem is. I will push a fix as soon as possible and will ask you guys to try it before releasing it.

Thanks you! Which is the stable version for Android?

If my guess is correct, you shouldn't have any issue with version 3.1.0.

@KarlosQ @wildvalcom This commit should solve the issue. Can you confirm?

To test it:

"react-native-snap-carousel": "https://github.com/archriss/react-native-snap-carousel#8b65fb7"

If you want a deeper understanding of the issue at stake, see this React Native thread. Basically, you should apparently avoid using stateless components when rendered inside scroll components. They should be migrated to regular components that extend Component or PureComponent. See this comment or this one.

@bd-arc well, with this fix everything works as expected. Are you planing to merge this fix into master?

@wildvalcom It has already been merged, just not published on NPM yet ;-)

I'll publish a new release when I'm done fixing a few other issues.

@bd-arc No more crash, thank you!

Thanks @bd-arc!
Just wanted to appreciate the effort and support this package has, it is great

You're welcome @aschenkel. Always good to hear though ;-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AndrePech picture AndrePech  路  4Comments

codejet picture codejet  路  5Comments

niloufarMakhzani picture niloufarMakhzani  路  4Comments

KarlosQ picture KarlosQ  路  4Comments

siderakis picture siderakis  路  3Comments