scroll to index for flat list in react-native
2017-07-24 15:54
597 查看
Two things that I can see,
You need not define string refs within
Do it something like
You need to bind your function to be able to refer to the correct context
Do it like
or
You need not define string refs within
{}. However React docs suggest you to make use of ref callback
Do it something like
<FlatList ref={(list) => this.myFlatList = list} data={data} keyExtractor={this._keyExtractor} renderItem={this._renderItem} />
You need to bind your function to be able to refer to the correct context
Do it like
_enableTVEventHandler = () => { this._tvEventHandler = new TVEventHandler(); this._tvEventHandler.enable(this, function(cmp, evt) { this.myFlatList.scrollToIndex({viewPosition: 0.5, index: 2}); }.bind(this)); }
or
constructor(props) { super(props) ; this._enableTVEventHandler = this._enableTVEventHandler.bind(this); }
相关文章推荐
- Overlay permissions needs to be granted in order for react native apps to run in dev mode
- Overlay permissions needs to be granted in order for react native apps to ran in dev mode
- react-native---配置reactnative报红,run-Android时候报错unable to load script from assets 'index.android.bundl
- React Native填坑之旅 -- FlatList
- Unable to load native-hadoop library for your platform... using builtin-java classes where applicabl
- React-native FlatList 组件的下拉刷新onEndReached异常
- [React Native] Use the SafeAreaView Component in React Native for iPhone X Compatibility
- HADOOP:WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
- ReactNative FlatList state更新,视图不更新的问题
- appium for python client scroll to view(not in current screen)
- react-native中FlatList不支持ListEmptyComponent
- react native FlatList使用详解以及上拉刷新下拉加载带可运行demo
- 一起学react native(5) mobx配合FlatList实现高性能im聊天界面
- ReactNative 之FlatList使用及踩坑封装总结
- ReactNative之FlatList组件使用方法总结
- React Native FlatList的使用
- React-Native新列表组件FlatList和SectionList学习 | | 联动列表实现
- Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
- react-native Element type is invalid: expected a string (for built-in components) or a class/functio
- How to delete a large number of data in SharePoint for List when refreshing data?