1

I have the ViewPagerAndroid component in my application which has two View components.

For Example:

<ViewPagerAndroid>
   <View>// ... index 0 </View>
   <View>// ... index 1 </View>
</ViewPagerAndroid>

The initial view to load is the 0 index View component that contains the FlatList of words fetched from SQLite database. Now when I load my application the FlatList of words in the 0 index View component is loaded very fast when the component is mounted and I cannot feel the FlatList loading impression of the words list which is good.

When I select a specific word from the list, it moves me to the 1 index View component where I am also using the FlatList component which contains the very small list (maximum 8 to 12 items) of sentences fetched from SQLite database, that have the similar word that I selected in 0 index View component.

Now the problem is that when the word is selected from 0 index View component and when the <ViewPagerAndroid> moves me to 1 index View component the FlatList on the 1 index View component does not load immediately and loads after 1 or 2 seconds which is very bad impression. I can't use the componentDidMount or componentWillMount methods to load the FlatList on the 1 index View component before the component is loaded because both are in the same component inside the <ViewPagerAndroid>. Please can anyone tell what to do to load the FlatList on the 1 index View component immediately (same as the speed FlatList on the 0 index View component) without feeling the impression of loading the FlatList after 1 or 2 seconds?

I have optimized the FlatList on both 0 index View component and 1 index View component by following the guides of both first and second answer here. So, please don't say optimize your list and optimize your list and vice versa because I found that this is not the issue regarding optimization. Please, it is my humble request can any genius tell how to solve this issue because it is very very very important for me to solve? A little example will be more appreciated. Thanks !!!

Stack Overflow
  • 1
  • 5
  • 23
  • 51
  • Love you, trust me i was struggling with the same issue last month and failed to solve it because there is no such resource on the internet regarding this issue, so, i removed the `ViewPagerAndroid` component and put both the `View` components into separate components but this is what i don't want. I will still track this question to check may be someone solve this issue – Stack Overflow Dec 08 '18 at 20:49

0 Answers0