Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rendering react navigation screens inside a scrollview

I am building a react native app where I want to add a scrollview as a wrapper to all the UI screens. I have wrapped the Stack.Navigator in a ScrollView but the content is clipped at the bottom of the screen, there is no content visible after the end of screen. Kindly look at the code below

App.tsx

export default function App() {
  const [loading, setLoading] = useState(true);
  return loading ? (
    <AppSplashScreen onLoadComplete={() => setLoading(false)} />
  ) : (
    <NavigationContainer>
      <AuthProvider>
        <Provider>
          <ScrollView
            contentContainerStyle={{ minHeight: "100%", overflow: "visible" }}
            style={styles.container}
          >
            <Content />
          </ScrollView>
        </Provider>
      </AuthProvider>
    </NavigationContainer>
  );
}

const styles = StyleSheet.create({
  container: {
    marginTop: 32,
    padding: 16,
    minHeight: "100%",
  },
});

Content.tsx

const Content = () => {
  return (
    <Stack.Navigator
      initialRouteName="LandingPage"
      screenOptions={{
        headerShown: false,
      }}
    >
      <Stack.Screen name="LandingPage" component={Signup} />
    </Stack.Navigator>
  );
};

like image 455
Abdullah Razzaki Avatar asked Aug 15 '26 04:08

Abdullah Razzaki


1 Answers

Try add this to ScrollView style or contentContainerStyle

flexGrow: 1

like image 60
i p Avatar answered Aug 17 '26 19:08

i p



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!