Javascript 标题中的左右图标
我想在左侧显示一个汉堡包图标(它应该显示在所有使用抽屉导航的标题上),并在右侧显示post属性按钮。我试着使用headerlight和headerLeft,但它没有显示任何图标或按钮或任何东西 这就是我所做的Javascript 标题中的左右图标,javascript,reactjs,react-native,react-navigation,Javascript,Reactjs,React Native,React Navigation,我想在左侧显示一个汉堡包图标(它应该显示在所有使用抽屉导航的标题上),并在右侧显示post属性按钮。我试着使用headerlight和headerLeft,但它没有显示任何图标或按钮或任何东西 这就是我所做的 const SimpleStack = StackNavigator({ Home: { screen: MyHomeScreen }, PostProperty: { screen: PostProperty } }); class DrawerView
const SimpleStack = StackNavigator({
Home: {
screen: MyHomeScreen
},
PostProperty: {
screen: PostProperty
}
});
class DrawerView extends React.Component {
render() {
const { navigation } = this.props;
return (
<View>
<View style={{ backgroundColor: "red", padding: 100 }} />
<View style={{ padding: 20 }}>
<TouchableOpacity onPress={() => navigation.navigate("Rent")}>
<Text>Rent</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => navigation.navigate("Buy")}>
<Text>Buy</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => navigation.navigate("PostProperty")}>
<Text>Post Property</Text>
</TouchableOpacity>
</View>
</View>
);
}
}
const DrawerStack = DrawerNavigator(
{
Main: {
screen: SimpleStack
},
Rent: {
screen: Rent
},
Buy: {
screen: Buy
}
},
{
contentComponent: DrawerView,
drawerWidth: 280
}
);
export default DrawerStack;
const MyHomeScreen = ({ navigation }) => (
<View style={styles.container}>
<Text>Home</Text>
</View>
);
MyHomeScreen.navigationOptions = {
title: "RoomFinder",
drawer: {
icon: () => {
<Image source={require("../../assets/menu@2x.png")} />;
},
headerRight: <Button title="Post Property" />
}
};
const Rent = ({ navigation }) => (
<View>
<ScrollView horizontal={true} showsHorizontalScrollIndicator={true}>
<View>
<Text>
Rent Screen
</Text>
</View>
</ScrollView>
</View>
);
Rent.navigationOptions = {
title: "Rent"
};
const SimpleStack=StackNavigator({
主页:{
屏幕:我的主屏幕
},
后财产:{
屏幕:后属性
}
});
类DroperView扩展了React.Component{
render(){
const{navigation}=this.props;
返回(
导航。导航(“租金”)}>
租
导航。导航(“购买”)}>
购买
导航。导航(“后属性”)}>
邮政财产
);
}
}
const DROURSTACK=抽屉驱动程序(
{
主要内容:{
屏幕:SimpleStack
},
租金:{
屏幕:租金
},
购买:{
屏幕:购买
}
},
{
contentComponent:DroperView,
抽屉宽度:280
}
);
导出默认抽屉钉;
常量MyHomeScreen=({navigation})=>(
家
);
MyHomeScreen.navigationOptions={
标题:“寻屋者”,
出票人:{
图标:()=>{
;
},
头灯:
}
};
常量租金=({navigation})=>(
租金筛选
);
Rent.navigationOptions={
标题:“租金”
};