如何解决使用自定义顶部栏组件反应Native Navigation v6
react: 16.11.0 react-native: 0.62.2 react-native-navigation: ^6.4.0
嗨!我在v6.0中将自定义组件设置为RNN顶部栏时遇到麻烦。以下是我的代码段:
Navigation.registerComponent('com.someApp.PostingDetailsNavbar',() => require('../components/PostingDetailsNavbar'));
componentDidMount()
{
Navigation.mergeOptions(this.props.componentId,{
topBar: {
background: {
color: '#ffff00',component: {
name: 'com.someApp.PostingDetailsNavbar',passProps: {
onAuthorClick: this.viewAuthor,authorImage: this.props.post.authorImage,authorName: this.props.post.authorName
}
}
}
}
});
}
运行此命令时,在调试窗口中出现以下错误:
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of `WrappedComponent`.
我很难找到根本原因,还是我只是在使用mergeOptions
错误(?)
谢谢!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。