st0ffern / react-native-optimized-flatlist

Optimization for complex and slow React Native FlatLists
MIT License
259 stars 47 forks source link

Example using ScrollToEnd #40

Open edoofx opened 4 years ago

edoofx commented 4 years ago
```
<OptimizedFlatList
      ref={ref => (this._listRef = ref)}
      onContentSizeChange={() => {
        this._listRef.scrollToEnd();
      }}
      style={styles.list}
      data={this.state.chat}
      keyExtractor={(item, index) => index.toString()}

      renderItem={message => {
        const item = message.item;
        let inMessage = item.type === 'in';
        let itemStyle = inMessage ? styles.itemIn : styles.itemOut;

        return (
          <View key={item} style={[styles.item, itemStyle]}>
            {!inMessage && this.renderDate(item.datetime)}
            <View style={[styles.balloon]}>
              <Text>{item.message}</Text>
            </View>
            {inMessage && this.renderDate(item.datetime)}
          </View>
        );
      }}
    />


before im using Optimizedflatlist , im using flatlist react native and method scroll like that .. but not working with optimizedflatlist , 

scrolltoend is not a function..

help