Css 通过样式化组件更改复选框的颜色
当选中复选框时,我需要更改其颜色。我使用它的方式如下:Css 通过样式化组件更改复选框的颜色,css,react-native,styled-components,Css,React Native,Styled Components,当选中复选框时,我需要更改其颜色。我使用它的方式如下: index.js import CheckBox from '@react-native-community/checkbox'; ... <CheckBoxes> <Label>Usuário</Label> <CheckBox disabled={false} value={myValue} onValueChange={setMyValue
index.js
import CheckBox from '@react-native-community/checkbox';
...
<CheckBoxes>
<Label>Usuário</Label>
<CheckBox
disabled={false}
value={myValue}
onValueChange={setMyValue}
/>
</CheckBoxes>
export const CheckBoxes = styled.View`
flex: 0.25;
flex-direction: row;
justify-content: flex-start;
text-decoration-line: none;
> input:checked {
color: #999;
}
`;
我该怎么做?您是否尝试过使用
onFillColor
、onTintColor
或onCheckColor
import CheckBox from '@react-native-community/checkbox';
...
<CheckBoxes>
<Label>Usuário</Label>
<CheckBox
disabled={false}
value={myValue}
onValueChange={setMyValue}
onFillColor={yourcolor}
/>
从“@react native community/CheckBox”导入复选框;
...
乌苏瓦里奥
我在复选框中设置了tintColors
属性,解决了这个问题
<CheckBox
disabled={false}
value={isDoctor}
onValueChange={setIsDoctor}
tintColors={{ true: '#FC8F00' }}
/>
您是否尝试管理@react native community/checkbox的属性
checkedColor
和uncheckedColor
?我不确定使用样式化组件是否可行。或者尝试类似于export const CheckBox=styled.CheckBox
”的方法_(ツ)_/¯