我正在使用React本机导航v5 我在分离的文件上创建一个头,该文件在 堆栈头
为打开抽屉式导航按钮创建一个按钮
头文件
OpenMenu=(navigation)=>{
navigation.openDrawer();
}
export default function Header({navigation,title}) {
return (
<View style={styles.container}>
<MaterialIcons name="menu" size={28} onPress={()=> this.OpenMenu(navigation)} style={styles.icon}/>
<View style={styles.header}>
<View style={{alignItems:'center'}}>
<Text style={styles.headerText}> {title} </Text>
</View>
</View>
</View> );}
使用此标题
<Stack.Screen name="Dashboard" component={Dashboard}
options={{
headerTitle:(navigation)=> <Header navigation={navigation} title={"Dashboard"}/>,
headerStyle: { backgroundColor: '#88aa31', }, headerLeft: null, }} />
能告诉我如何解决此问题