Why does ScrollView throw me a warning message?

Viewed 123

I have a problem with React Native ScrollView, it throws me a danger message It’s supposed to be the same as the design but I cannot visualize it

message: WARNING- VirtualizedLists should never be nested inside plain ScrollView with the same orientation Use- anorther VirtualizedLists- Backed conintainer instead

Design: enter image description here

code:

  <View>
                    <SearchBar
                        term={term}
                        onTermChange={setTerm}
                        onTermSubmit={() => searchApi(term)}
                    />
                    {errorMessage ? <Text>{errorMessage}</Text> : null}

                    <ScrollView>
                        <ResultList
                            title=''
                            results={results}
                        />
                    </ScrollView>
                </View>

1 Answers

The issue is in here:

<ScrollView>
  <ResultList title="" results={results} />
</ScrollView>

If you don't have any scrollable-content inside your ScrollView ... then you could just remove that ScrollView wrapping your <ResultList /> and you'll be good to go...

But If you do have other scollable-content -> then try to include them as ListHeaderComponent or ListFooterComponent of your FlatList ...

Related