[ListView] performance with more complicated renderRow
I was trying to implement a real time filtering using textInput. However, the re-rendering of the ListView is incredibly slow (about 1 seconds after finish typing).
This is what the renderRow function returns: (I simplified it a lot from my real renderRow, still slow)
<View>
<TouchableOpacity onPress={this.props.onSelect}>
<View style={cellstyle}>
<Image
source={require('image!logo')}
style={[
styles.cellImage,
{resizeMode: Image.resizeMode.contain}
]}
/>
<View style={styles.textContainer}>
<Text numberOfLines={2} lineHeight={1}>
{this.props.item.name.trim()}
</Text>
<Text>
{digits(this.props.item.price)}
</Text>
</View>
</View>
</TouchableOpacity>
<View style={styles.cellBorder} />
</View>
I have tried to replace TouchableOpacity with View, but that still doesn't help improve the performance much.
Just something to try...set shouldRasterizeIOS={true} on your images in renderRow(). I've seen some performance improvements this way.
+1
Hi there! This issue is being closed because it has been inactive for a while.
But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/listview-performance-with-more-complicated-renderrow
ProductPains helps the community prioritize the most important issues thanks to its voting feature. It is easy to use - just login with GitHub.
Also, if this issue is a bug, please consider sending a PR with a fix. We're a small team and rely on the community for bug fixes of issues that don't affect fb apps.
+1
+1
I really don't think this should be closed. It's a big deal.
Here a gif showing the problem: https://www.dropbox.com/s/60z3hrs76ijs96c/SlowPepperoni.gif?dl=0
Edit: The performance gets a LOT better without images. So how to implement a performant scroll list with images?!
Try this: shouldComponentUpdate(nextProps, nextState) { return nextState.SOME_DATA !== this.state.SOME_DATA; }
+1 I have similar problem.
+1
i am facing same issues how to solve ?
+1