答案 0 :(得分:1)
这里的文档https://reactnavigation.org/docs/intro/nesting
非常清楚示例代码
import { TabNavigator } from "react-navigation";
class RecentChatsScreen extends React.Component {
render() {
return <Text>List of recent chats</Text>
}
}
class AllContactsScreen extends React.Component {
render() {
return <Text>List of all contacts</Text>
}
}
const MainScreenNavigator = TabNavigator({
Recent: { screen: RecentChatsScreen },
All: { screen: AllContactsScreen },
});
答案 1 :(得分:1)
import { Container, ScrollableTab, Tab, Tabs, Text, Button } from 'native-base';
state={ category:[]}
renderTabButton() {
this.setState({category: [...this.state.category, (<Tab heading="Add Category">
<Text>Tab 1</Text>
</Tab>)]})};
render() {
return (
<Container>
<Tabs renderTabBar={() => <ScrollableTab />}>
{this.state.category}
</Tabs>
<Button
onPress={this.renderTabButton.bind(this)}>
<Text> Add Tab</Text>
</Button>
</Container>