这可能是一个不明确的问题,但尽管我阅读了文件和其他资料来源,但我还是没有像照片一样,在StackNavigator的头盔中执行两个或两个以上可点击的漫画。 如果 st夫想要显示后方,他就被允许 over笑。
This is how the (root) home-screen could look like. Once the user starts clicking on the content, the menu-item should be replaced with the back-button from the stackNavigator (ideally on any platform).
www.un.org/Depts/DGACM/index_spanish.htm 我迄今为止所做的工作:。 我从一个品牌新模板开始,选择了<代码>-tabs>在expo。 我在文件MainTabNavigator.js上做了一些小改动。
import React from react ;
import { Platform } from react-native ;
import { createStackNavigator, createBottomTabNavigator } from react-navigation ;
import CustomHeader from ../components/CustomHeader ;
import HomeScreen from ../screens/HomeScreen ;
const HomeStack = createStackNavigator( { Home: HomeScreen }, {
// default config for screens in the stack, so `Home` will use this title
navigationOptions: {
title: Protype Prompter: Browse ,
header: props => <CustomHeader {...props} />,
}}
);
// All other code stays like provided by expo init.
export default createBottomTabNavigator({
HomeStack,
});
其次,我确信在HomeScreen.js内。 负责人不是手写的:
export default class HomeScreen extends React.Component {
/* static navigationOptions = {
header: null,
}; */
请与我接洽Custom Header.js。 迄今为止,我的所有努力都没有导致家庭屏幕上的任何明显变化。
import React from "react";
import { Header } from "react-navigation";
import { View, Platform, Image, StyleSheet } from "react-native";
import { SimpleLineIcons } from @expo/vector-icons ;
const CustomHeader = props => {
return (
<View>
<SimpleLineIcons name="menu" size={24} color={tintColor} />
<Header headerLeft={<SimpleLineIcons name="menu" size={24} color= #6a1b9a />} {...props} />
</View>
);
};
export default CustomHeader;
除其他来源外,我还咨询了以下网站:
- The documentation on headers and header buttons
- A github discussion on a react-navitation issue
- A howto on modifying headers and another one on customer headers with react-navigation. The latter seemed to be a good starting point.