-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Rendering items multiple times #349
Comments
Hi @sridhard, I'm afraid this has to do with the inner logic of the Can you try swapping your |
@sridhard Any news regarding the issue? Have you been able to reproduce the matter with a regular |
Closing as no further feedback has been provided. |
@bd-arc Flatlist dont have this issue... |
I think this is similar to #329 ..please check |
@sridhard Glad you're finally gracing us with some "feedback"... What would really help understanding and therefore fixing the issue would be:
If you can do all of the above, we'll be on our way to finding the root of the issue. |
I had the same issue and at-least in my case it turned out to be the case the issue was the content in the carousel component - the items were re-rendering continuously... which slowed down the carousel and made it look very glitchy. So I'd suggest taking a second look at the content you put in the carousel. Also debug around setting widths or using absolute positioning in there. (You'd know if that's the case right away if you try removing the contents from the items you're attaching and it starts working fine). |
I had the same issue as well and disabling |
Even with a static array, the carousel renders the first 6 items ~ 3 times, then renders them all 1-2 times before the app crashes without an error message. Upgrading from "react": "^16.3.1",
"react-native": "^0.55.4", to "react": "16.6.1",
"react-native": "0.58.0-rc.0" seems to have introduced the issue. const FAKE_PERSON_OBJECT = {
name: 'Komodo Brown',
position: 'Chief Scientist',
joinedDate: 'Joined today',
imageSource: 'https://picsum.photos/200/210?image=974',
formattedLocation: 'Tau Alpha C, M-cluster'
};
const testData = [...new Array(10)].map(e => FAKE_PERSON_OBJECT)
<Carousel
ref={(c) => { this._carousel = c; }}
data={testData}
loop={false}
renderItem={this.renderItem}
itemWidth={202}
itemHeight={327}
sliderWidth={300}
inactiveSlideOpacity={1}
inactiveSlideScale={1}
activeSlideAlignment={'start'}
slideStyle={{marginLeft: 14}}
/> |
@kdrich I'm surprised because we've updated some of our apps to RN 0.58 without any issue with the carousel. Can you please provide a Snack example in which the issue can be reproduced? |
Is this a bug report or a feature request?
Bug
Have you read the guidelines regarding bug report?
Yes
Have you read the documentation in its entirety?
Yes
Have you made sure that your issue hasn't already been reported/solved?
Yes
Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?
I tested in android only
Is the bug reproductible in a production environment (not a debug one)?
Yes
Have you made sure that it wasn't a React Native bug?
Yes
Have you been able to reproduce the bug in [the provided example]
Yes
Environment
Environment:
React: 16.4.1
React native: 0.56.0
react-native-snap-carousel: 3.7.2
Target Platform:
Android (6.0)
Steps to Reproduce
I have 2 items supplied to React-native-snap-carousel. When we run the app in android each item render() method is called twice
Register for orientation change as in https://github.com/archriss/react-native-snap-carousel/blob/master/doc/TIPS_AND_TRICKS.md#handling-device-rotation
When orientation change, 2 items are rendered and the render() method of each item called once.
Again after that the render() method of these 2 items are called 2 times. Means during orientation change each items render is called 3 times.
Expected Behavior
Actual Behavior
Render method is called mutiple times
Reproducible Demo
Try demo in https://github.com/archriss/react-native-snap-carousel/blob/master/doc/TIPS_AND_TRICKS.md#handling-device-rotation
The text was updated successfully, but these errors were encountered: