react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[ListView] performance with more complicated renderRow

Open go1t opened this issue 11 years ago • 32 comments

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.

go1t avatar Apr 01 '15 04:04 go1t

Just something to try...set shouldRasterizeIOS={true} on your images in renderRow(). I've seen some performance improvements this way.

marcshilling avatar Nov 25 '15 18:11 marcshilling

+1

rzvavram avatar Nov 27 '15 13:11 rzvavram

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.

mkonicek avatar Apr 10 '16 16:04 mkonicek

+1

tslater avatar Jun 21 '16 21:06 tslater

+1

ammichael avatar Sep 30 '16 20:09 ammichael

I really don't think this should be closed. It's a big deal.

tslater avatar Sep 30 '16 21:09 tslater

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?!

ammichael avatar Sep 30 '16 21:09 ammichael

Try this: shouldComponentUpdate(nextProps, nextState) { return nextState.SOME_DATA !== this.state.SOME_DATA; }

TyrealGray avatar Jan 20 '17 16:01 TyrealGray

+1 I have similar problem.

anbkit avatar Feb 17 '17 11:02 anbkit

+1

jekram avatar Feb 21 '17 03:02 jekram

i am facing same issues how to solve ?

Jithinag007 avatar Jun 27 '17 07:06 Jithinag007

+1

IbraheemAlSaady avatar Aug 10 '17 15:08 IbraheemAlSaady