更新由 RCTView 管理的视图的 'nativeBackgroundAndroid' 属性时出错。

5

React Native 应用程序崩溃并显示以下错误。我不太理解这个错误。你有什么想法吗?我的 React Native 版本是0.31,在 Android 4.4 的设备 Galaxy Core2 上出现了此错误。

    com.facebook.react.bridge.JSApplicationIllegalArgumentException: Error while updating property 'nativeBackgroundAndroid' of a view managed by: RCTView
    at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:88)
    at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty(ViewManagerPropertyUpdater.java:123)
    at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:42)
    at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:34)
    at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:220)
    at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:148)
    at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:890)
    at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:863)
    at com.facebook.react.uimanager.GuardedChoreographerFrameCallback.doFrame(GuardedChoreographerFrameCallback.java:32)
    at com.facebook.react.uimanager.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:131)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:811)
    at android.view.Choreographer.doCallbacks(Choreographer.java:613)
    at android.view.Choreographer.doFrame(Choreographer.java:582)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:799)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:146)
    at android.app.ActivityThread.main(ActivityThread.java:5511)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:77)
    ... 22 more
Caused by: com.facebook.react.bridge.JSApplicationIllegalArgumentException: Attribute selectableItemBackgroundBorderless couldn't be found in the resource list
    at com.facebook.react.views.view.ReactDrawableHelper.createDrawableFromJSDescription(ReactDrawableHelper.java:43)
    at com.facebook.react.views.view.ReactViewManager.setNativeBackground(ReactViewManager.java:104)
    ... 25 more

你是否在使用 react-native-scrollable-tab-view?如果是的话,必须更新到 v0.5.5 或更高版本。因为存在这个错误 https://github.com/skv-headless/react-native-scrollable-tab-view/issues/397 - lwinkyawmyat
是的,我正在使用react-native-scrollable-tab-view。让我检查一下更新是否修复了问题。 - user43286
2个回答

1

这是因为nativeBackgroundAndroid不是视图中的有效属性。

我能够通过以下方式重现它:

<View style={styles.someStylesheet} nativeBackgroundAndroid={styles.someStylesheet}>
    //some view stuff
</View>   

2
好的,我看到 react-native 有这段代码,不是我的代码。不确定如何修复它。 - user43286

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接