Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 平面列表中的渲染问题_React Native_React Native Flatlist_React Virtualized - Fatal编程技术网

React native 平面列表中的渲染问题

React native 平面列表中的渲染问题,react-native,react-native-flatlist,react-virtualized,React Native,React Native Flatlist,React Virtualized,我使用平面列表作为无限滚动,滚动的每一项都是一个旋转木马,就像hotstar/prime视频一样。每个转盘中至少可以有8-10个图像 无限卷轴的渲染几乎没有问题 有时,当我滚动得更快时,滚动会形成空白,但有时会被填满。它看起来滚动和渲染速度很大 不同。它发生在滚动的两个方向 滚动时,触摸事件在单击时没有响应 此外,当添加新数据以滚动时,渲染速度会非常慢 我已经尝试了所有在官方文档中建议的优化,但是问题1和3对于用户来说仍然是一个错误的体验 return ( <FlatLis

我使用平面列表作为无限滚动,滚动的每一项都是一个旋转木马,就像hotstar/prime视频一样。每个转盘中至少可以有8-10个图像

无限卷轴的渲染几乎没有问题

  • 有时,当我滚动得更快时,滚动会形成空白,但有时会被填满。它看起来滚动和渲染速度很大 不同。它发生在滚动的两个方向
  • 滚动时,触摸事件在单击时没有响应
  • 此外,当添加新数据以滚动时,渲染速度会非常慢
  • 我已经尝试了所有在官方文档中建议的优化,但是问题1和3对于用户来说仍然是一个错误的体验

    return (
            <FlatList
                style={Style.container}
                data={props.data}
                keyExtractor={getKeyExtractor(props.keyExtractor)}
                renderItem={getRenderItem(props.renderItem)}
                onEndReached={getLoadMore(props.loadMore)}
                onEndReachedThreshold={0.6}
                removeClippedSubviews={true}
                maxToRenderPerBatch={1}
                updateCellsBatchingPeriod={1}
                showsVerticalScrollIndicator={false}
                onRefresh={getRefresh(isRefreshing, setIsRefreshing, props.refresh)}
                initialNumToRender={1}
                refreshing={isRefreshing}
                horizontal={props.horizontal}
                numColumns={1}
                ListHeaderComponent={props.renderHeader}
                stickyHeaderIndices={[0]}
                windowSize={8}
                ref={getRef(props.reference)}
            />
        );
    
    返回(
    );