Nativebase: Checkbox shows black tick when not selected

Created on 23 Aug 2019  路  15Comments  路  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

react-native - v0.60.5
native-base - v2.13.5

Expected behaviour

It should show blank no tick box

Actual behaviour

It shows black tick

Steps to reproduce

<CheckBox
   style={{ borderColor: type.checked ? 'blue' : 'black' }}
  checked={false}
  color={'blue'}
  onPress={() => true}
/>               

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

Yes

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


Simulator Screen Shot - iPhone X - 2019-08-23 at 13 03 00

theme

Most helpful comment

FYI: The issue seems to have been introduced in "CheckBox Cleanup (#2777)"
It used to default the checkBoxBgColor to "transparent" but now sets it to "checkboxDefaultColor" which from what I can tell doesn't exists in the theme variables.
Workaround is to add this to your "variable.js" file:
"checkboxDefaultColor": "transparent"

All 15 comments

@SupriyaKalghatgi please check

I also experience the same problem

yep same issue, this occurs after upgrading to 2.13.x

Was just going to open an issue for this as well. Happens when there is a theme added via "StyleProvider" if you remove the theme then it works as expected. 2.13.4 and 2.13.5

FYI: The issue seems to have been introduced in "CheckBox Cleanup (#2777)"
It used to default the checkBoxBgColor to "transparent" but now sets it to "checkboxDefaultColor" which from what I can tell doesn't exists in the theme variables.
Workaround is to add this to your "variable.js" file:
"checkboxDefaultColor": "transparent"

@digitalalien i already have "checkboxDefaultColor": "transparent" in my variable.js.

@imbudhiraja Are you using that as your StyleProvider theme?

yes @digitalalien i'm using style provider after ejecting the theme

Darn... that fixed it for me. So many variables though, but seems like something would have to be overriding that then. My version of themes dis not already set the "checkboxDefaultColor", but maybe yours does?

@digitalalien yes it was overridden in variable.js>material.js. thanks. But this needs to be fixed in library itself.

As a temp solution, you can add a them variable named 'checkboxDefaultColor'.

Make sure it suits the ' containerBgColor' though.

There should really be a tool or at lest documentation for the changes in the theme variables between versions...

Same solution. I just need to do it in my platform.js file.

@digitalalien Thank you for the solution.
I solve this by adding "checkboxDefaultColor": "transparent" to variables>commonColor.js with version "native-base": "^2.13.12".

I am using "native-base": "2.13.8" with "checkboxDefaultColor": "transparent" inside variables>commonColor.js.

Checkbox still shows black tick when not selected.

Need some help

I found that re-ejecting the theme fixed it for me: https://docs.nativebase.io/Customize.html#theaming-nb-headref .

Was this page helpful?
0 / 5 - 0 ratings

Related issues

inv2004 picture inv2004  路  3Comments

muthuraman007 picture muthuraman007  路  3Comments

nschurmann picture nschurmann  路  3Comments

mcpracht picture mcpracht  路  3Comments

maphongba008 picture maphongba008  路  3Comments