0

enter image description here

These red marks areas are 3 FlatLists. The first and Second are horizontally scrolling FlatLists while the last FlatList is scrolling vertically.My problem arise when scrolling the last FlatList. It not going to the bottom it stays in the same position but scrolls (Like it has a fixed height). How to get rid of such thing. I'm trying a way to scroll the whole page. I have attached a GIF too to make sense. Thanks.

<SafeAreaView style={{flex:1}}/>
//Top FLatList
<View>
  <FlatList
     showsHorizontalScrollIndicator={false}
     horizontal
     data={articles}
     ...
  />
 </View>
//Middle FLatList
<View>
  <FlatList
     showsHorizontalScrollIndicator={false}
     horizontal
     data={options}
     ...
  />
 </View>
 //Bottom FLatList
 <View>
  <FlatList
     data={articles}
     ...
  />
 </View>
</SafeAreaView>

enter image description here

1 Answer 1

1

The problem is typically caused by the custome style to the bottom tab. You may fix it by adding the footer component prop to the last flatList.

//The total height including the bottom tab height and the space
   let bottomMargin = 110

 <SafeAreaView style={{flex:1}}/>
//Top FLatList
<View>
  <FlatList
     showsHorizontalScrollIndicator={false}
     horizontal
     data={articles}
     ...
  />
 </View>
//Middle FLatList
<View>
  <FlatList
     showsHorizontalScrollIndicator={false}
     horizontal
     data={options}
     ...
  />
 </View>
 //Bottom FLatList
 <View>
  <FlatList
     data={articles}
     ListFooterComponent={()=>(
      <FooterComponent/>
     )}
     ...
  />
 </View>
</SafeAreaView>


  const FooterComponent = () => {

    return (
        <View style={{marginBottom: bottomMargin}} />
    )
  }

To scroll the whole page

To scroll the entire page, pass the above code from the third flatlist as the Header component to the third flatlist like the following:

 <SafeAreaView style={{flex:1}}/>
//Top FLatList

 //Bottom FLatList
 <View>
  <FlatList
     data={articles}
     ListHeaderComponent={()=>(
      <HeaderComponent/>
     )}
     ...
  />
 </View>
</SafeAreaView>


  const HeaderComponent= () => {
    return (
      <View>
        <FlatList
         showsHorizontalScrollIndicator={false}
         horizontal
         data={articles}
          />

         <FlatList
         showsHorizontalScrollIndicator={false}
         horizontal
         data={options}
         />
     </View>
    )
  }
Sign up to request clarification or add additional context in comments.

1 Comment

Actually I'm trying to scroll the whole page

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.