【问题标题】:How to change background colour transparent in React-Native checkBox?如何在 React-Native 复选框中更改背景颜色透明?
【发布时间】:2020-04-12 16:45:13
【问题描述】:

在我的场景中,我正在尝试使用 Reactnative Elements 为 androidiOS 实现 react native 复选框。在这里,我需要用标签背景颜色更改复选框。是全白的,怎么改成透明的?

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})}
/>

【问题讨论】:

    标签: javascript android ios react-native


    【解决方案1】:

    只需使用 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})}
    />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-19
      • 1970-01-01
      • 2015-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-05
      相关资源
      最近更新 更多