Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loop doesn't work on some android devices #417

Open
5 tasks done
kathychauhk01 opened this issue Oct 26, 2018 · 27 comments
Open
5 tasks done

Loop doesn't work on some android devices #417

kathychauhk01 opened this issue Oct 26, 2018 · 27 comments

Comments

@kathychauhk01
Copy link

kathychauhk01 commented Oct 26, 2018

Is this a bug report, a feature request, or a question?

Bug

Have you followed the required steps before opening a bug report?

(Check the step you've followed - replace the space character between the square brackets ([]) by an x.)

Have you made sure that it wasn't a React Native bug?

Unsure.

Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?

Android only.

Is the bug reproductible in a production environment (not a debug one)?

Yes. On both environment.

Environment

Environment:
React: 16.2.0
React native: 0.53.3
react-native-snap-carousel: 3.3.4

Target Platform:
Android (8.0)
iOS (11.4)

Expected Behavior

Like the result on iOS. When set loop={true}, the carousel can have infinite loop effect:

ios

Actual Behavior

On android, the carousel can't loop infinitely but just repeat few loop and stop:

android

(Write what happened. Add screencasts/screenshots!)

Reproducible Demo

https://snack.expo.io/H11RLUlnm

(Paste the link to a Snack example in which the issue can be reproduced. Please follow the guidelines for providing a Minimal, Complete, and Verifiable example.)

Steps to Reproduce

Just try to keep scroll on android platform.

@syq7970
Copy link

syq7970 commented Nov 15, 2018

same issue here.

@syq7970
Copy link

syq7970 commented Nov 15, 2018

I found a workaround.
set loopClonesPerSide > 3

@poison8
Copy link

poison8 commented Nov 19, 2018

我找到了解决方法。
设置loopClonesPerSide> 3
where is setting loopClonesPerSide?

@HanAsteroid
Copy link

set loopClonesPerSide > 3

it does not work

@zabojad
Copy link

zabojad commented Dec 15, 2018

I'm having the same issue.

My environment:

"react": "16.5.0",
"react-native": "0.57.1",
"react-native-snap-carousel": "^3.7.5",

Any news on this issue ?

@zabojad
Copy link

zabojad commented Dec 15, 2018

In my case, I'm having a simple carousel displaying 3 items at a time and with data list of 8 items, each item being just a simple image.

I've tested to increase the loopClonesPerSlide to 5. It did not solve the problem but it made me realize that the items got cloned only when trying to swipe to the "first missing clone".

So the issue is rather the lack of parameter to define when we want the cloning to happen. In my case, with 3 items displayed at a time, I would like cloning to happen as soon as I'm getting as close as 2 items from the first or last item of the list.

Would that be possible to add that behavior?

It could look like a RemainingItemCountBeforeCloning parameter that would take values such as 0 (current behavior), 1 (clone when reaching the last/first item of the list), 2 (clone when reaching the one-before-last/second item of the list), etc...

What do you think?

@bd-arc bd-arc changed the title Loop is not work for some android devices Loop doesn't work on some android devices Dec 27, 2018
@zabojad
Copy link

zabojad commented Jan 8, 2019

Hi there! Any news on that?

@zabojad
Copy link

zabojad commented Jan 8, 2019

Hey @bd-arc! Are you the maintainer of this lib? What do you think about my suggestion above?

@SergeyYuhimovich
Copy link

SergeyYuhimovich commented Jan 10, 2019

Hi! Just faced the same issue yesterday. Loop didn't work on Android simulator as well as on Google Pixel 2, while works great on iPhone. I've also noticed that if I swipe left quickly with short gestures, sometimes slides get cloned as they should (I guess). But I failed to reproduce this behavior on swiping right. Hope this info will be helpful to find what caused this issue.

@bd-arc
Copy link
Contributor

bd-arc commented Jan 10, 2019

@zabojad While this idea is sound, it would prove incredibly difficult to code and might not even solve the issue.

@zabojad @SergeyYuhimovich The root issue is that randomly in the FlatList and ScrollView components the events are not called in the right order (e.g. scrollEnd before the scroll events have finished running), which messes with the internal logic. This occurs on Android only as far as I can tell.

I've been willing to ditch the ScrollView/FlatList combo in favor of another scroll component for months since it is just plain buggy and because the React Native team isn't fixing critical bugs like this one. But I have yet to find one that isn't based on the ScrollView component and that does the job properly...

@bd-arc
Copy link
Contributor

bd-arc commented Jan 10, 2019

PR #443 was submitted to me a few days ago. Does it solve this issue for you?

@SergeyYuhimovich
Copy link

@bd-arc this PR didn't solve this issue in my case. Trying to trace what caused it. As far as I see now, on Android _getActiveItem for some reason returning indexes of clones, not the original slides, when the lap is over.

@summerkiflain
Copy link

Facing same issue on any array of 10, changed data array length to odd number in my case 15, and it started working fine.

@sarishti
Copy link

Any update on above issue? Facing same on s8 with 5 element in array.

@bryceliu
Copy link

Try callbackOffsetMargin={0}. The internal method _snapToItem probably does not work if last _snapToItem animation is not finished.

@fruedaCode
Copy link

Same issue with callbackOffsetMargin={0}.
If the number of items is odd number it works.

Any update on this?

@rafaelvinicius
Copy link

Same problem.
No one got a solution to this problem?

@fuchien
Copy link

fuchien commented Oct 29, 2019

Same problem...
Have someone got a solution?

@Egizas
Copy link

Egizas commented Dec 4, 2019

Same here, It only renders new items, if I go on to 2nd clone out of 3 clones :/

@InvictusNightmares
Copy link

I use the version 3.8.4 and face the same issue. @bd-arc

@qiaoyixuan
Copy link

Same problem

@jahicDario
Copy link

Loop is not working in Android in for examples 3 and 4, as well. It gets stuck if you scroll only in one direction.

@semiherdogan
Copy link

same here, any solution on this?

@Juan-Castelli
Copy link

Same issue, changing clones does not solve the problem.

@Saad9624
Copy link

any update on this ? for android

@Saad9624
Copy link

comment out this line under Crousel.js
return this._carouselRef && this._carouselRef.getNode && this._carouselRef.getNode();

Thanks me later!

@dohooo

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests