question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`renderItem` will be called when user scroll the slide

See original GitHub issue

When scrolling the slide, the renderItem method will be called many times. It’s a performance issue.

Related code: https://github.com/xiaolin/react-image-gallery/blob/master/src/ImageGallery.jsx#L1037

It’s because of we will call the method every time when the slide rerender. When the user scrolls the slide, we need to change the style, it will cause re-render.

I guess we don’t need to call the renderItem every time when the style change.

And also, I suggest adding a note in README to suggest return a pure component. Could we change this one to return a PureComponent: https://github.com/xiaolin/react-image-gallery/blob/master/src/ImageGallery.jsx#L885

If you are okey with this, I can help to send a PR.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

0reactions
sachitram-cvcommented, Jul 29, 2021

@xiaolin Is this fixed?

Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React native Flatlist doesn't scroll - Stack Overflow
First of your dataToRender16 must have some unique id ,and you must add keyExtractor to your FlatList. checkout the following example:
Read more >
Vertical and Horizontal Scrolling in a SectionList/FlatList
In the mobile app the home screen allows you to scroll both vertically (across different groups) and horizontally (within a group). Here's how...
Read more >
ScrollView - React Native
Called when the user stops dragging the scroll view and it either stops or begins to glide. Type. function. onScrollToTop. iOS. ​. Fires...
Read more >
React Native Scroll Item animation effect - FlatList ... - YouTube
In this video tutorial we will create an amazing scrolling animation/effect that you can apply to the items from a FlatList, ScrollView, ...
Read more >
How to Create React Native FlatList Load More On Scroll
Check out on udemy: https://bit.ly/3vbA1LX#ReactNative #FlatListLoadMore #expoThis is the video about how we can add load more funcanality ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found