简体   繁体   English

如何在 React-Native 复选框中更改背景颜色透明?

[英]How to change background colour transparent in React-Native checkBox?

In my scenario, I am trying to implement react native check box for android and iOS using Reactnative Elements.在我的场景中,我正在尝试使用 Reactnative Elements 为androidiOS实现反应原生复选框。 Here, I need to change checkbox with label background colour.在这里,我需要用 label 背景颜色更改复选框。 It is showing full white but how to change it is transparent?它显示全白但如何将其更改为透明?

https://react-native-elements.github.io/react-native-elements/docs/checkbox.html https://react-native-elements.github.io/react-native-elements/docs/checkbox.html

<CheckBox
  checkedIcon={<Image source={require('../checked.png')} />}
  uncheckedIcon={<Image source={require('../unchecked.png')} />}
  checked={this.state.checked}
  onPress={() => this.setState({checked: !this.state.checked})}
/>

Just use the containerStyle prop ( https://react-native-elements.github.io/react-native-elements/docs/checkbox.html#containerstyle ) The easiest (but also ugliest) way would be to say只需使用 containerStyle 道具( https://react-native-elements.github.io/react-native-elements/docs/checkbox.html#containerstyle )最简单(但也是最丑陋)的方法就是说

<CheckBox
  containerStyle ={{backgroundColor: 'transparent'}}
  checkedIcon={<Image source={require('../checked.png')} />}
  uncheckedIcon={<Image source={require('../unchecked.png')} />}
  checked={this.state.checked}
  onPress={() => this.setState({checked: !this.state.checked})}
/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM