我正在使用 UI 的本机基础创建本机反应应用程序(http://nativebase.io/docs/v2.0.0/components#footerTab)。我正在使用 footerTabs 组件,我的代码如下
render() {
return (
<Container>
<Header backgroundColor="#ECEFF1">
<Button transparent>
<Icon name='ios-menu' style={{color: 'black'}}/>
</Button>
<Title style={{color:'black'}}>Header</Title>
</Header>
<Content>
<Profile/>
</Content>
<Footer backgroundColor="#212121">
<FooterTab>
<Button backgroundColor="#000" >
<Icon name="ios-person" size={30} color="#900"/>
<Text>Profile</Text>
</Button>
<Button>
<Icon name="ios-search"/>
<Text>Search</Text>
</Button>
<Button>
<Icon name="ios-camera"/>
<Text>Camera</Text>
</Button>
<Button>
<Icon name="ios-apps"/>
<Text>Apps</Text>
</Button>
<Button>
<Icon active name="ios-navigate"/>
<Text>Navigate</Text>
</Button>
</FooterTab>
</Footer>
</Container>
);
}
我为配置文件、搜索、应用程序等不同功能创建了不同的 JS 文件,并按如下方式导入它们。
import Profile from './Profile';
如何在页脚按钮上实现 onPress 功能,以根据选择的内容更改内容标签中的组件?
<Content>
<Profile/>
</Content>
例如:如果我按下搜索按钮,我希望将配置文件标签替换为其他按钮,并且类似地相同。