简体   繁体   中英

Expo react native material-top-tab-navigator inside scrollView not showing screen

When loading a tab screen using material-top-tab-navigator the screens are not displayed


version

"@react-navigation/material-top-tabs": "^6.2.1"

"expo": "^45.0.0",


page where the navigator is loaded

return (
 <View>
      <ScrollView >
       <View>
         <TitleH2 color={colors.white} style={{marginHorizontal:20, marginBottom:20}}>Ervaringen in gebied</TitleH2>
        </View>
         <View >
            <DestinationTabs/>
         </View>
   </ScrollView>
</View> 
)

Where the navigator is created

  return (
        <Tab.Navigator 
          screenOptions={{
              tabBarIndicatorStyle:{ backgroundColor:colors.green_500, },
              tabBarActiveTintColor: colors.green_500,
              tabBarScrollEnabled: true,
              lazy: true,
            
          }}
          sceneContainerStyle={{
              backgroundColor: colors.green_500,
             
                }}
        > 
          <Tab.Screen name="Tab1" component={TabSceen1}  />
          <Tab.Screen name="Tab2" component={TabSceen1} />
          <Tab.Screen name="Tab3" component={TabSceen1} />
          <Tab.Screen name="Tab4" component={TabSceen2} />
        </Tab.Navigator>
  );

I was only able to display the screen when giving the navigator a fixed height. But then it's not scrollable and the content is not properly displayed.

Is there a way to make the screen display in a scrollview where the height is displayed based on the content size in side a screen, and where it's also able to be scrolled?

  • update question *

How do you make the tab screens appear in a scrollView

use this contentContainerStyle={{flex: 1}} in side scroll view

<ScrollView contentContainerStyle={{flex: 1}}/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM