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

Carousel renderItem is getting called multiple times #787

Open
MohitGoel9456 opened this issue Dec 14, 2020 · 9 comments
Open

Carousel renderItem is getting called multiple times #787

MohitGoel9456 opened this issue Dec 14, 2020 · 9 comments

Comments

@MohitGoel9456
Copy link

carousel component render item method gets called multiple times even though the data passed to carousel has only 3 items in the array list.
ScreenShot of the logs -->

Screen Shot 2020-12-14 at 12 31 22 PM

Here is the sample code

renderProductItem = (item) => {
    console.log("item --",item)
    return (
        <Product product={item.item} />
    )
}

render () {
    return (
        <Carousel
          ref={(c) => { this._carousel = c; }}
          data={data}
          renderItem={(item) => this.renderProductItem(item)}
          keyExtractor={item => item.name}
          sliderWidth={Dimensions.get('window').width}
          itemWidth={Dimensions.get('window').width/2}
        />
    );
}
@sebastianv20
Copy link

I had the same problem, but it only happened from card 1 to 5
Testing many options, I tried
useScrollView = {True}
and problem solved in my case.

@jeffreybenabou
Copy link

I had the same problem, but it only happened from card 1 to 5
Testing many options, I tried
useScrollView = {True}
and problem solved in my case.

I think this will make performance problem.. but it fix the problem

@MohitGoel9456
Copy link
Author

It is still the same. it is causing performance issue as render methods called multiple times.

@nericode
Copy link

Same problem +1

@Gustavo-Kuze
Copy link

Gustavo-Kuze commented Jan 26, 2021

@bd-arc Is version 3 still being supported? We're experiencing this issue after upgrading React Native to latest version (currently 0.63.4)

@bd-arc
Copy link
Contributor

bd-arc commented Jan 27, 2021

@Gustavo-Kuze Unfortunately, I no longer have time to maintain the plugin and am progressively moving away from development. In fact, I've been looking for maintainers for more than a year now.

However, I worked on version 4 last year and it's a huge improvement in many aspects. I recommend that you check the beta version and post any feedback there: #678

@EnzoH8321
Copy link

Same issue as @MohitGoel9456. Rendering each item in my array list 2 - 3 times.

@luismasg
Copy link

Same issue as @MohitGoel9456. Rendering each item in my array list 2 - 3 times.

doesn't react call render twice in strict mode?
maybe this is the reason.

@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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants