React-native: Error while updating property 'nativeBackgroundAndroid' of a view managed by: RCTView

Created on 13 Sep 2016  路  14Comments  路  Source: facebook/react-native

The following error comes in certain android version like Android 4.3 and Android 4.4.

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(React ```ViewManager.java:104)

Locked

Most helpful comment

For anyone that is facing this, I was able to fix it by checking the android version where I'm using TouchableNativeFeedback.Ripple.

  if (Platform['Version'] >= 21) {
    background = TouchableNativeFeedback.Ripple(props.backgroundColor);
  } else {
    background = TouchableNativeFeedback.SelectableBackground();
  }

All 14 comments

can you paste your code? I guess you set a invalid color value to backgroundColor

@nihgwu , the error coming from React Native code only in some android versions like 4.2, 4.3, 4.4. No error in 5.0, 5.1 etc. So, I don't there is an issue in my code. Plus, the stack trace doesn't have any of my files.

I'm getting the same on a device running 5.1 since upgrading from RN0.32 to RN 0.32:

E/unknown:React: Exception in native call from JS
 com.facebook.react.bridge.JSApplicationIllegalArgumentException: Error while updating property 'transform' 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:798)
     at android.view.Choreographer.doCallbacks(Choreographer.java:603)
     at android.view.Choreographer.doFrame(Choreographer.java:571)
     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786)
     at android.os.Handler.handleCallback(Handler.java:815)
     at android.os.Handler.dispatchMessage(Handler.java:104)
     at android.os.Looper.loop(Looper.java:194)
     at android.app.ActivityThread.main(ActivityThread.java:5631)
     at java.lang.reflect.Method.invoke(Native Method)
     at java.lang.reflect.Method.invoke(Method.java:372)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
  Caused by: java.lang.reflect.InvocationTargetException
     at java.lang.reflect.Method.invoke(Native Method)
     at java.lang.reflect.Method.invoke(Method.java:372)
     at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:77)
     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:798)聽
     at android.view.Choreographer.doCallbacks(Choreographer.java:603)聽
     at android.view.Choreographer.doFrame(Choreographer.java:571)聽
     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786)聽
     at android.os.Handler.handleCallback(Handler.java:815)聽
     at android.os.Handler.dispatchMessage(Handler.java:104)聽
     at android.os.Looper.loop(Looper.java:194)聽
     at android.app.ActivityThread.main(ActivityThread.java:5631)聽
     at java.lang.reflect.Method.invoke(Native Method)聽
     at java.lang.reflect.Method.invoke(Method.java:372)聽
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)聽
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)聽
  Caused by: com.facebook.react.bridge.UnexpectedNativeTypeException: TypeError: expected dynamic type `double', but had type `object'
     at com.facebook.react.bridge.ReadableNativeArray.getDouble(Native Method)
     at com.facebook.react.uimanager.BaseViewManager.setTransformMatrix(BaseViewManager.java:159)
     at com.facebook.react.uimanager.BaseViewManager.setTransform(BaseViewManager.java:58)
     at java.lang.reflect.Method.invoke(Native Method)聽
     at java.lang.reflect.Method.invoke(Method.java:372)聽
     at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:77)聽
     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:798)聽
     at android.view.Choreographer.doCallbacks(Choreographer.java:603)聽
     at android.view.Choreographer.doFrame(Choreographer.java:571)聽
     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786)聽
     at android.os.Handler.handleCallback(Handler.java:815)聽
     at android.os.Handler.dispatchMessage(Handler.java:104)聽
     at android.os.Looper.loop(Looper.java:194)聽
     at android.app.ActivityThread.main(ActivityThread.java:5631)聽
     at java.lang.reflect.Method.invoke(Native Method)聽
     at java.lang.reflect.Method.invoke(Method.java:372)聽
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)聽
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)聽

Worryingly I fixed it by wiping my gradle caches and running a clean / build in android studio:

rm -rf ~/.gradle/caches/*

I'm concerned that arbitrary versions of jar files are getting used by gradle now.

@npomfret Did you manage to fix this permanently? I have the same a very similar issue on RN 0.35 and wiping my gradle cache doesn't seem to help

Yes, it never came back for me.

@soutar perhaps you're using react-native-scrollable-tab-view? Maybe this will help:
See https://github.com/skv-headless/react-native-scrollable-tab-view/issues/397

For anyone that is facing this, I was able to fix it by checking the android version where I'm using TouchableNativeFeedback.Ripple.

  if (Platform['Version'] >= 21) {
    background = TouchableNativeFeedback.Ripple(props.backgroundColor);
  } else {
    background = TouchableNativeFeedback.SelectableBackground();
  }

Thanks @tegon, that fix works for me 馃槃 The version requirement is documented here: https://facebook.github.io/react-native/docs/touchablenativefeedback.html#ripple

Closing this issue because it has been inactive for a while. If you think it should still be opened let us know why.

i have this error but not using TouchableNativeFeedback, it happen when i try to change tab

Error while updating property 'nativeBackgroundAndroid' of a view managed by: RCTView
null
Ripple drawable is not available on android API <21    

updateViewProp ....

my code work on android 7 but i tryed to test the application on android 4.1 and i get this error.

my android/app/build.gradle

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
    applicationId "com.iosreacttestplantnet2"
    minSdkVersion 16
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
    ndk {
        abiFilters "armeabi-v7a", "x86"
    }
    vectorDrawables.useSupportLibrary = true
}
        ... }

any advice please ?

@tegon how to use your code please ?

@alainib are you using a npm library for the tabs?

I use StackNavigator and TabNavigator from react-navigation

depot is her : https://github.com/react-community/react-navigation.git

It might be an issue with the library, they may have to change their code to work with earlier Android versions. I suggest you open an issue in their repository asking about this.

Was this page helpful?
0 / 5 - 0 ratings