此文件导入
class Footer extends Component {
_notifications = () => {
const { navigate } = this.props.navigation;
navigate('Ntf', {});
}
render() {
return (<TouchableHighlight onPress={() => this._notifications()} ></TouchableHighlight>);
}
}
此文件主目录(React-Navigation-NavigationDrawerStructure)。
import { Footer } from './Footer';
export default class HomePage extends Component {
render() {
return (<View><Footer/></View>);
}
错误后单击_notifications按钮:undefined是一个对象c.props.navigation.navigate请帮助我
仅在路线中定义的组件有权访问导航道具,而不能访问这些组件的子项!。
解决方案:-