嵌套FlatList不滚动/ FlatList上的ScrollToIndex不起作用

时间:2017-10-03 06:22:36

标签: react-native

我问了一个与本周早些时候类似的不同问题,我取得了更多进展,所以只关闭前一个并开始这个,因为我无法找到解决方案。

this._scrollRef.scrollTo is not a function at VirtualizedList.scrollToIndex

这是代码。

<AnimatedFlatList
    ref={ (node) => { this._listRef = node; } }
                style={[styles.picker, styles.scroll, pickerStyle]}
                data={data}
                renderItem={this.renderItems}
                getItemLayout={(_, index) => (
                  { length: 24, offset: 24 * index, index }
                )}
                initialNumToRender={5}
                // scrollEnabled={visibleItemCount < itemCount}
                contentContainerStyle={styles.scrollContainer}
                scrollEventThrottle={2000}
                keyExtractor={(item) => item.value}
                automaticallyAdjustContentInsets={false}
                removeClippedSubviews={false}
                indicatorStyle="white"
              />

此时我还不确定为什么调用this._listRef.getNode().scrollToIndex(...params)无效。

0 个答案:

没有答案