我在标题中看不到标题:
const withHeader = (
screen: Function,
routeName: string,
Header
): StackNavigator =>
createStackNavigator({
[routeName]: {
screen,
navigationOptions: ({ navigation, routeName }) => ({
header: props => <Header {...props} />,
title: routeName,
headerMode: "screen",
layoutPreset: "right"
})
}
});
this.props
不包含标题道具。
如何将标题传递给标题?
答案 0 :(得分:1)
您可以在班级/屏幕中使用static navigationOptions
:
class TargetScreen extends React.Component {
static navigationOptions = {
title: 'Your Title',
};
/* render function, etc */
}