【发布时间】:2020-03-29 08:24:41
【问题描述】:
使用 React Native 和 React Navigation,我可以使用 navigationOptions 更改我的标题:
const ForumScreen = ({ navigation }) => {
const forum = navigation.getParam('forum')
...
}
IndexScreen.navigationOptions = () => {
return {
title: 'My Forum',
}
}
export default ForumScreen
但我想使用ForumScreen 组件的forum 变量。
我试过了,但我得到了一个错误,因为变量不可访问:
...
IndexScreen.navigationOptions = () => {
return {
title: forum.name,
}
}
...
【问题讨论】:
-
FourmScreen的返回值是多少?
标签: javascript react-native ecmascript-6