标签导航在组件内部不起作用

时间:2018-07-03 11:45:53

标签: android react-native react-navigation

我只希望在HomeScreen组件内部(在其标题下)具有选项卡导航,所以我这样创建导航:

Appjs:

const Drawer=createDrawerNavigator({

  Home: {
     screen:HomeScreen, //<<--i Want to show tab navigator inside this component
  },
  Details: {
    screen: SettingsScreen,
  }},{
    drawerPosition: 'right',

});

然后我创建了一个带有标题的home组件,并在其中调用了Tabs组件:

HomeScreen.js:

const MyTab=  createMaterialTopTabNavigator({Home:Most,
  Det:Hotest});


export default class HomeScreen extends React.Component {
  render() {
    return (
      <Container>
        <StatusBar
          backgroundColor="red"
          barStyle="light-content"
        />
        <Header style={styles.grad} searchBar rounded Statusba>
          <Left>
            <Button
              transparent
              onPress={() => this.props.navigation.openDrawer()}
            >
              <Icon name="menu" />

            </Button>
          </Left>
          <Body>
            <Item>
              <Icon name="ios-search" />
              <Input placeholder="Search" />
            </Item>
          </Body>
        </Header>
        <Content>

           <MyTab/> {/* <MyTab/>   Look here.......<<<<<<<<<<<<<<<<< */}
        </Content>
      </Container>
    );
  }

}

,我可以在标题下显示选项卡,但它不起作用。当我点击选项卡时,没有任何反应!

0 个答案:

没有答案