Home > Software design >  Embedded ScrollView not working with position absolute in React Native
Embedded ScrollView not working with position absolute in React Native

Time:07-16

Reference Code: https://snack.expo.dev/@spk265/courageous-popcorn.

As it can be seen, I am unable to scroll the ScrollView element since it has a position: absolute. If I remove it, I only see the ImageBackground and not the ScrollView. How can I make sure the ScrollView is scrollable with the ImageBackground element as well?

CodePudding user response:

Just use absolute for your background and remove absolute from the ScrollView:

    <ImageBackground source={IMG} 
          style={{
            width: "100%",
            height: "100%",
            position: "absolute"
          }}
       />
        <ScrollView style={{
          width: screenWidth,
          minHeight: screenHeight,
          paddingBottom: 100
        }} contentContainerStyle={{
          width: "100%",
          minHeight: "100%",
          justifyContent: "flex-start",
        }}>
  • Related