Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/411.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
Javascript 反应本机平面列表水平滚动_Javascript_React Native_React Native Flatlist - Fatal编程技术网

Javascript 反应本机平面列表水平滚动

Javascript 反应本机平面列表水平滚动,javascript,react-native,react-native-flatlist,Javascript,React Native,React Native Flatlist,是否可以将React Native Flatlist水平滚动至右端。我有一个清单,里面有一天的不同时间。如果时间已经过去了,我希望视图被滚动到右端 <FlatList data={this.getData()} renderItem={({ item, index }) => this.renderContent(item, index)} keyExtractor={(item) => item.time}

是否可以将React Native Flatlist水平滚动至右端。我有一个清单,里面有一天的不同时间。如果时间已经过去了,我希望视图被滚动到右端

       <FlatList
        data={this.getData()}
        renderItem={({ item, index }) => this.renderContent(item, index)}
        keyExtractor={(item) => item.time}
        horizontal={true}
        scrollEnabled
        showsHorizontalScrollIndicator={false}
      />
this.renderContent(项,索引)}
keyExtractor={(项)=>item.time}
水平={true}
滚动启用
showshorizontalscrolindicator={false}
/>

您可以通过指示特定索引来设置平面列表的初始滚动索引

<FlatList
        data={this.getData()}
        renderItem={({ item, index }) => this.renderContent(item, index)}
        keyExtractor={(item) => item.time}
        horizontal={true}
        scrollEnabled
        showsHorizontalScrollIndicator={false}
        initialScrollIndex={this.getData().length - 1} // specify last index
      />
this.renderContent(项,索引)}
keyExtractor={(项)=>item.time}
水平={true}
滚动启用
showshorizontalscrolindicator={false}
initialScrollIndex={this.getData().length-1}//指定最后一个索引
/>
看看这是否有帮助