简体   繁体   English

反应本机,添加根视图时出错

[英]React native, error adding a root view

I've been trying to use 'react-native-popup' in my project and rendering the popup gave me the below error in a red screen. 我一直在尝试在项目中使用“ react-native-popup”,并且渲染弹出窗口时红屏显示以下错误。 If I reload, the message is treated like a warning and the app functions fine, but the error message shows up once in a while. 如果我重新加载,该消息将被视为警告,并且该应用程序功能正常,但偶尔会显示错误消息。 I am wondering what the issue is? 我想知道问题是什么?

Trying to add a root view with an explicit id already set. 尝试添加已设置显式ID的根视图。 React Native uses the id field to track react tags and will overwrite this field. React Native使用id字段来跟踪react标签,并将覆盖该字段。 If that is fine, explicitly overwrite the id field to View.NO_ID before calling addMeasuredRootView. 如果可以,请在调用addMeasuredRootView之前,将id字段显式覆盖到View.NO_ID。

This is how I used it in the render function: 这就是我在render函数中使用它的方式:

<Popup ref={popup => this.popup = popup }/>

If you are getting something like the screenshot below , Please try reloading the app by tapping the reload button. 如果您收到类似以下屏幕截图的信息,请尝试通过点击重新加载按钮来重新加载该应用程序。 I was getting this error if I made some changes in code that already had some exception/error. 如果我对已经具有某些异常/错误的代码进行了一些更改,则会收到此错误。 I hope this helps as it has worked for me almost every time. 我希望这会有所帮助,因为它几乎每次都对我有用。

在此处输入图片说明

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

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