Nativebase: Button.js theme backgroundColor: null crashing on RN 0.59.1 Android NoSuchKey Exception: backgroundColor

Created on 19 Apr 2019  ·  21Comments  ·  Source: GeekyAnts/NativeBase

I have gone through these following points

Issue Description

node, npm, react-native, react and native-base version, expo version if used, xcode version

RN . 0.59.1 Android.. native-base 2.12.1

Expected behaviour

Using custom theme via ejectTheme.js should work on iOS and Android.

Actual behaviour

Android release crashing with error: NoSuchKeyException backgroundColor when using transparent and/or disabled style for Button.. native-base-theme/components/Button.js has multiple background: null entries.... changing these to background: transparent appears to resolve isssue.

Steps to reproduce

Is the bug present in both iOS and Android or in any one of them?

only Android, only release

Any other additional info which would help us debug the issue quicker.

android bug high priority

Most helpful comment

Fixed in #2799. Will be available with the next version.

All 21 comments

Need Steps to reproduce

@dguillamot if you change any backgroundColor: null to backgroundColor: 'transparent', it fixes the issue

Any backgroundColor: null? which file?

For us it was line 177 of the native base theme file native-base/components/Button.js

Changing it to backgroundColor: 'transparent' resolves it for us.

When passing transparent property to button, it crashes.

image

The same issue I have. Trying to get why. iOS works.
It happened after i've updated to RN 0.59.1

I think its disabled property that crashes it.

i passed disabled transparent small

I am also facing this issue on Android 7.0 (Samsung Galaxy A3) real device.
App crashes when I open screen with disabled Button, because of "backgroundColor: null," at native-base-theme/components/Button.js:85 (const buttonTheme)

"native-base": "^2.12.0",
"react": "^16.8.3",
"react-native": "^0.59.8"
05-21 17:09:58.659  5983  6115 E AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
05-21 17:09:58.659  5983  6115 E AndroidRuntime: Process: com.company.appName, PID: 5983
05-21 17:09:58.659  5983  6115 E AndroidRuntime: com.facebook.react.bridge.NoSuchKeyException: backgroundColor
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at com.facebook.react.bridge.ReadableNativeMap.getValue(Unknown Source)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at com.facebook.react.bridge.ReadableNativeMap.getValue(Unknown Source)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at com.facebook.react.bridge.ReadableNativeMap.getInt(Unknown Source)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at com.facebook.react.uimanager.av.a(Unknown Source)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at com.facebook.react.uimanager.l.a(Unknown Source)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at com.facebook.react.uimanager.l.a(Unknown Source)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at com.facebook.react.uimanager.aj.a(Unknown Source)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at com.facebook.react.uimanager.aj.a(Unknown Source)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at com.facebook.react.uimanager.UIManagerModule.createView(Unknown Source)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at com.facebook.react.bridge.JavaMethodWrapper.invoke(Unknown Source)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at com.facebook.react.bridge.JavaModuleWrapper.invoke(Unknown Source)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at android.os.Handler.handleCallback(Handler.java:751)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:95)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(Unknown Source)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:154)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(Unknown Source)
05-21 17:09:58.659  5983  6115 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:762)

The fix right now is adding style with backgroundColour: 'transparent'
Its very annoying @SupriyaKalghatgi decided to not bother with this simple fix

have the same issue

Guys, changing all instances of backgroundColor:null to backgroundColor:"transparent" in the Buttons.js native-base-theme solved my issue.. in case you ejected the theme

The fix right now is adding style with backgroundColour: 'transparent'
Its very annoying @SupriyaKalghatgi decided to not bother with this simple fix

this is adding a border around button

[eng]
also crashes with such parameters in the Button component
<Button transparent dark>{this.props.children}</Button>
one by one, the props data works fine, everything falls together

[rus]
также же крушится при таких параметрах в компонент Button
<Button transparent dark>{this.props.children}</Button>
по одиночке данные props нормально работает, вместе все падает

this definitely needs an urgent fix, <Button transparent /> totally breaks at the moment.

@SupriyaKalghatgi whats happening with your organization?

Temporary workaround:

<Button transparent style={{backgroundColor: 'transparent'}}>

To remove a border around button: style={{backgroundColor: 'transparent', elevation: 0}}

I'm facing the same problem. @SupriyaKalghatgi any updates here?

cc @sankhadeeproy007

Fixed in #2799. Will be available with the next version.

Please try our latest release v.2.12.5.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Landerson352 picture Landerson352  ·  3Comments

bsiddiqui picture bsiddiqui  ·  3Comments

georgemickael-b picture georgemickael-b  ·  3Comments

kitsune7 picture kitsune7  ·  3Comments

aloifolia picture aloifolia  ·  3Comments