Nativebase: Tabs are not functional

Created on 1 May 2020  路  2Comments  路  Source: GeekyAnts/NativeBase

I was trying to create tabs with the code given below, but when rendered I was not able to click on tabs nor the component in tab was visible.

 <View>
        <Appbar.Header>
          <Appbar.Action icon="home" />
          <Appbar.Content title="Home" />
        </Appbar.Header>

       <Container>
          <Tabs initialPage={0}>
            <Tab heading={<TabHeading style={styles.tabs}><Text>Current Location</Text></TabHeading>} >
              <CurrentLoc />
            </Tab>
            <Tab heading={<TabHeading style={styles.tabs}><Text>India</Text></TabHeading>} >
              <IndiaStat />
            </Tab>
          </Tabs>
       </Container>
      </View> 

Most helpful comment

@harshit741, had the same issue. try setting your view to flex: 1. or wrap your entire component into the container, instead of a view

All 2 comments

@harshit741, had the same issue. try setting your view to flex: 1. or wrap your entire component into the container, instead of a view

Yeah, that worked. Thanks much.

Was this page helpful?
0 / 5 - 0 ratings