React native React Native Elements头组件中的动态标题
我正在使用 此外,我使用的是react原生选项卡React native React Native Elements头组件中的动态标题,react-native,header,react-native-elements,React Native,Header,React Native Elements,我正在使用 此外,我使用的是react原生选项卡 this.\u drawer=ref} type=“覆盖” content={} tapToClose={true} open={false} OpenDrawerofset={0.5} CaptureSpirates={true} 样式={drawerStyles} //tweenHandler={Drawer.tweenPresets.parallax} tweenHandler={(比率)=>{ 返回{ mainOverlay:{不透明度:
this.\u drawer=ref}
type=“覆盖”
content={ }
tapToClose={true}
open={false}
OpenDrawerofset={0.5}
CaptureSpirates={true}
样式={drawerStyles}
//tweenHandler={Drawer.tweenPresets.parallax}
tweenHandler={(比率)=>{
返回{
mainOverlay:{不透明度:比率/1.5,背景颜色:'黑色'}
}
}}
panOpenMask={0.1}>
}
centerComponent={{text:“DYNAMIC_TITLE_HERE”,style:{color:'#000',fontweaght:“bold”,fontSize:18,marginTop:3}}}
rightComponent={}
/>
({
tabBarIcon:({聚焦,颜色,大小})=>{
让iconName=“ion md帮助”;
如果(route.name==='Home'){
iconName=聚焦
?ios信息圈
:“ios信息圈大纲”;
}else if(route.name==='Settings'){
iconName=focused?“ios列表框”:“ios列表”;
}
//您可以在这里返回您喜欢的任何组件!
返回;
},
})}
禁忌选项={{
activeTintColor:“#2B95DA”,
颜色:“灰色”,
}}>
}}
/>
,
}} />
我在->centerComponent中找不到任何动态替换动态标题的可能性。有什么想法吗
<Drawer
ref={(ref) => this._drawer = ref}
type="overlay"
content={< MyDrawer />}
tapToClose={true}
open={false}
openDrawerOffset={0.5}
captureGestures={true}
styles={drawerStyles}
// tweenHandler={Drawer.tweenPresets.parallax}
tweenHandler={(ratio) => {
return {
mainOverlay: { opacity: ratio / 1.5, backgroundColor: 'black' }
}
}}
panOpenMask={0.1} >
<SafeAreaProvider>
<Header
leftComponent={
<View>
<TouchableOpacity onPress={() => this.calendarClick()}>
<Ionicons name="calendar-outline" size={24} />
</TouchableOpacity>
</View>
}
centerComponent={{ text: "DYNAMIC_TITLE_HERE", style: { color: '#000', fontWeight: "bold", fontSize: 18, marginTop: 3 } }}
rightComponent={<Ionicons name="cloud-upload-outline" size={24} />}
/>
<NavigationContainer>
<Tab.Navigator
screenOptions={({ route }) => ({
tabBarIcon: ({ focused, color, size }) => {
let iconName = "ion-md-help";
if (route.name === 'Home') {
iconName = focused
? 'ios-information-circle'
: 'ios-information-circle-outline';
} else if (route.name === 'Settings') {
iconName = focused ? 'ios-list-box' : 'ios-list';
}
// You can return any component that you like here!
return <Ionicons name={iconName} size={size} color={color} />;
},
})}
tabBarOptions={{
activeTintColor: '#2B95DA',
inactiveTintColor: 'gray',
}}>
<Tab.Screen
name="Targets"
component={TargetsScreen}
options={{
tabBarIcon: ({ color }) => <Ionicons name="rocket" color={color} size={24} />
}}
/>
<Tab.Screen
name="Settings"
component={SettingsScreen}
options={{
tabBarIcon: ({ color }) => <Ionicons name="settings" color={color} size={24} />,
}} />
</Tab.Navigator>
</NavigationContainer>
<StatusBar barStyle="dark-content" />
</SafeAreaProvider>
</Drawer >