PedroBern / react-native-collapsible-tab-view

A cross-platform Collapsible Tab View component for React Native
MIT License
875 stars 172 forks source link

How do I get the correct ref for a FlatList? #24

Closed midoushitongtong closed 3 years ago

midoushitongtong commented 3 years ago

hi I want to use some api on <FlatList />, like scrollToIndex, but I can't get the ref correctly.

<Animated.FlatList
  ref={this.flatListRef}
  {...scenePropsAndRef}
/>

componentDidMount() {
  setTimeout(() => {
    console.log(this.flatListRef.current); // null
  }, 3000);
}

What might I have missed?

PedroBern commented 3 years ago

Hi @midoushitongtong it's a duplicate of #2