0

How can i set the background-color for checkboxes library https://github.com/react-native-checkbox/react-native-checkbox?

I use iOS as a platform.

Thank you for your help!

1 Answer 1

2

use tintColor prop to set color of the box when the checkbox is Off.

use onCheckColor prop to set color of the check mark when it is On.

use onFillColor prop to set color of the inside of the box when it is On.

use onTintColor prop to The color of the line around the box when it is On.

the value of above mentioned props will be hexadecimal value of color.

For example

<CheckBox
onFillColor={"#FF5733"}
disabled={false}
value={toggleCheckBox}
onValueChange={(newValue) => setToggleCheckBox(newValue)}
/>
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for your answer. But i dont want to fill the color when the checkobx is checked. As default i want the background color "white". I can use "tintColor" but only for the border of the checkbox. But how can a change the background-color when the checkbox it not checked?
@iSaBo You can try this Wrap the checkbox in a View use a state variable lets say isChecked to control checkbox set the background color of View conditionally like this <View style={{ backgroundColor: isChecked? 'red' : 'white' }} > //Your checkbox code </View>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.