Changing the Checkbox color via Styled-Components

Asked

Viewed 516 times

0

I need to change the color of one CheckBox when it is selected. I am using it as follows:

index.js

import CheckBox from '@react-native-community/checkbox';
...
<CheckBoxes>
   <Label>Usuário</Label>
   <CheckBox
       disabled={false}
       value={myValue}
       onValueChange={setMyValue}
   />
</CheckBoxes>

styles.js

export const CheckBoxes = styled.View`
  flex: 0.25;
  flex-direction: row;
  justify-content: flex-start;
  text-decoration-line: none;

  > input:checked {
      color: #999;
  }
`;

How can I do ?

1 answer

0

I managed to solve as follows: setting the property tintColors of own CheckBox.

<CheckBox
   disabled={false}
   value={isDoctor}
   onValueChange={setIsDoctor}
   tintColors={{ true: '#FC8F00' }}
/>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.