onEndReached in Flatlist issue

sub*_*bha 8 react-native react-native-flatlist

如果我将平面列表放在一个视图中,那么我的onEndReached将无限触发,如果我删除封闭的视图onEndReached根本不会被触发.

 render() {
    return (
        <Root>
            <Container>
                <Content>
                    <View>
                        {this.state.listView && (
                            <FlatList
                                data={this.state.variants}
                                keyExtractor={this._keyExtractor}
                                onEndReachedThreshold={0.5}
                                onEndReached={({ distanceFromEnd }) => {
                                    console.log(
                                        "on end reached ",
                                        distanceFromEnd
                                    );
                                    this.loadMore();
                                }}
                                numColumns={1}
                                renderItem={({ item, index }) => (
                                    <CatalogRow
                                        item={item}
                                        in_wishlist={this.state.in_wishlist}
                                        toggleWishlist={() =>
                                            this.toggleWishlist(item.title)
                                        }
                                        listView={this.state.listView}
                                    />
                                )}
                            />
                        )}
                    </View>
                </Content>
            </Container>
        </Root>
    );
}
Run Code Online (Sandbox Code Playgroud)

distanceFromEnd当它被摧毁时,我的值为0,960,1200.它表明了什么?我正在使用react-native 0.47.2

per*_*n-m 13

我对react-native 0.50.3也有同样的问题

<Flatlist><ScrollView>如果你想使用,不得在a 中使用,onEndReached因为Flatlist无法找到高度.

<View>改用


sub*_*bha 11

这是因为封闭的<Content>标签.有时将react-native标记与native-base标记嵌入会导致此类问题.我用标签替换了内容和容器View标签,现在它工作正常.