1

When I'm using FlatList inside ScrollView I'm getting an error as VirtualizedLists should never be nested inside plain ScrollViews with the same orientation - use another VirtualizedList-backed container instead.

I have tried to add the Components as mentioned below:

<SafeAreaView>
  <ScrollView>
    <View>
      <FlatList />
    </View>
  </ScrollView>
</SafeAreaView>                    
3
  • 1
    May I know why you are implementing the FlatList Component inside the ScrollView Component? Commented Feb 22, 2021 at 5:07
  • I have one more list to be displayed below the first FlatList component. So I want total page to be inside a parent ScrollView component. Commented Feb 22, 2021 at 10:08
  • We can use the ListFooterComponent to show the children at the end of the flat list Commented Feb 22, 2021 at 10:10

1 Answer 1

2

Use this way instead of using Flatlist inside Scrollview like

<SafeAreaView style={{flex: 1}}>
    <FlatList
      data={data}
      ListHeaderComponent={ContentThatGoesAboveTheFlatList}
      ListFooterComponent={ContentThatGoesBelowTheFlatList} />
</SafeAreaView>
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you. Added ListFooterComponent and this works.
this gives clarity. javascript.plainenglish.io/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.