简体   繁体   English

React native:Native模块不能为null

[英]React native: Native module cannot be null

When I build my project in iOS I get the following errors in that specific order: 当我在iOS中构建项目时,按照该特定顺序出现以下错误:

No component found for view with name "RCTRawText"

No component found for view with name "RCTText"

Unhandled JS Exception: Requiring module "Linking", which threw an exception: Invariant Violation: Native module cannot be null.

ExceptionsManager.js:73 Unhandled JS Exception: TypeError: Cannot read property 'addEventListener' of undefined

This error is located at:
    in NavigationContainer (at index.js:13)
    in Provider (at index.js:12)
    in ReactHome (at renderApplication.js:35)
    in RCTView (at View.js:113)
    in View (at AppContainer.js:102)
    in RCTView (at View.js:113)
    in View (at AppContainer.js:122)
    in AppContainer (at renderApplication.js:34)

I found that this post could help but the errors persist. 我发现这篇文章可以提供帮助,但错误仍然存​​在。

Thanks in advance 提前致谢

您必须从NavigationContainer中的react-native导入Linking模块

Adding RCTText in ios/Podfile file solved this error for me: 在ios / Podfile文件中添加RCTText为我解决了此错误:

target 'YourProject' do

  pod 'React', :path => '../node_modules/react-native/', subspecs: [

    ...,

    'RCTText'
  ]

  ...
end

This error is probably with react-native versions older than 0.60.0, bacause in later versions it is automatically added when you upgrade. 此错误可能是由于反应本机版本早于0.60.0,因为在更高版本中,它会在升级时自动添加。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM