com.facebook.react.uimanager.IllegalViewOperationException:试图添加未知的视图标签 [英] com.facebook.react.uimanager.IllegalViewOperationException: Trying to add unknown view tag
问题描述
com.facebook.react.uimanager.IllegalViewOperationException:试图添加未知的视图标签:1122
如何解决这个bug,如何找到导致崩溃的原因?
我设法在 react-native
中准确找出导致该问题的原因.
那么幕后发生的事情是,react-native
试图操纵 shadowNode list 同时其他线程正在操作它.
特别是 UIImplementation 使用以下方法操作该列表
- 创建视图
- setChildren
- 管理孩子
- removeRootShadowNode
因此,如果其中任何一个同时被调用,则应用程序崩溃的可能性非常高.
在我们的应用中,我们通过提供如下所示的自定义 UIImplementation
解决了该问题:
https://gist.github.com/SudoPlz/23ea2dee9772cb39e1e74>p>b 如您所见,我们不再允许那些 我们可以不断地重现这个问题,但现在已经完全解决了.我们通过这个方法传递了新的 UIImplementation 这里. 如果你不知道如何传递一个新的 并添加以下函数: 现在看起来像这样: 这是原始反应本机问题> com.facebook.react.uimanager.IllegalViewOperationException: Trying to add unknown view tag: 1122 How to resole this bug,How to find where cause this crash? I managed to spot exactly what's causing that problem in So what happens behind the scenes is, Specifically UIImplementation manipulates that list with the following methods so if any of those get invoked at the same time, there's a really high chance that the app will crash. In our app we fixed that issue by providing a custom https://gist.github.com/SudoPlz/23ea2dee9772cb39e1e742034cdf8b98 as you can see we don't allow those We could constantly reproduce the issue on our end, but now that's totally fixed.
We pass the new UIImplementation provided through this method here. If you don't know how to pass a new and add the following function: so that it now looks like this: Here's the original react-native issue 这篇关于com.facebook.react.uimanager.IllegalViewOperationException:试图添加未知的视图标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!UIImplementation
方法以非同步方式运行.UIImplementationProvider
你必须去你的MainApplication.java
文件,找到ReactNativeHost
的创建代码>:private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {@覆盖公共布尔 getUseDeveloperSupport() {返回 BuildConfig.DEBUG;}……呜呜呜
protected UIImplementationProvider getUIImplementationProvider() {返回新的 YourCustomUIImplementationProvider();}
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {@覆盖公共布尔 getUseDeveloperSupport() {返回 BuildConfig.DEBUG;}受保护的 UIImplementationProvider getUIImplementationProvider() {返回新的 YourCustomUIImplementationProvider();}……呜呜呜
react-native
.react-native
is trying to manipulate the shadowNode list at the same time some other thread is manipulating it.
UIImplementation
that looks like this:UIImplementation
methods to run unsynchronised anymore.UIImplementationProvider
you have to go to your MainApplication.java
file, find the creation of ReactNativeHost
:private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
...bla bla blah
protected UIImplementationProvider getUIImplementationProvider() {
return new YourCustomUIImplementationProvider();
}
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
protected UIImplementationProvider getUIImplementationProvider() {
return new YourCustomUIImplementationProvider();
}
...bla bla blah