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

Is it related to rowHasChanged?

wangii avatar Apr 01 '15 20:04 wangii

my rowHasChanged was the same as the documentation:

rowHasChanged: (r1, r2) => r1 !== r2

go1t avatar Apr 02 '15 12:04 go1t

assume each of your item has unique id: rowHasChanged:(r1, r2)=> r1.item.id !== r2.item.id

wangii avatar Apr 02 '15 16:04 wangii

I doubt it would make anything faster, since r1 !== r2 does the reference checking, which should be more optimal than r1.item.id !== r2.item.id where you have to reference the object for the id, and compare them.

go1t avatar Apr 02 '15 17:04 go1t

Any updates on this? Having similar performance issues.

karanbhangui avatar Apr 24 '15 09:04 karanbhangui

+1

chirag04 avatar Jun 29 '15 19:06 chirag04

+1 for me as well, ListViews are becoming a bit of an issue in our app. Our renderRows contain the same if not more nodes than the example above.

josebalius avatar Jun 30 '15 18:06 josebalius

+1 seeing this issue as well.

cyprusglobe avatar Jul 01 '15 05:07 cyprusglobe

+1

thisbejim avatar Jul 29 '15 21:07 thisbejim

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

ghost avatar Aug 04 '15 18:08 ghost

This is a big issue for myself as well -- seems to be especially bad on older devices, newer devices don't seem to exhibit much issue with very complex rows.

robertjpayne avatar Sep 01 '15 10:09 robertjpayne

+1 here. Tried SGListView instead of a standard one. A bit better, but it still feels like a hybrid app...

pukhalski avatar Sep 12 '15 11:09 pukhalski

I tried with a very simple row on android, just (item) => (<Viev><Text>{item.name}</Text></View>) and even then it's slow to unusable.

Pajn avatar Sep 23 '15 14:09 Pajn

Any updates on this one so far? Thanks.

pukhalski avatar Sep 24 '15 13:09 pukhalski

:+1:

thunderousNinja avatar Oct 15 '15 04:10 thunderousNinja

+1

tmp251 avatar Oct 20 '15 17:10 tmp251

+1

braunsquared avatar Oct 30 '15 15:10 braunsquared

Does removal (just asking) of the image make a difference?

jaygarcia avatar Oct 30 '15 17:10 jaygarcia

The ListView performance is not very good in general. I have also an image in each row and the scrolling and re-rendering is not very smooth. Without the image the performance is much better.

Pajk avatar Nov 11 '15 06:11 Pajk

The issue isn't list view then. It's probably the images rendering. They seem to cause the JS event loop to stutter :(

jaygarcia avatar Nov 11 '15 12:11 jaygarcia