我是反应原生的新手.在我的应用程序中,我正在使用开关并更改色调颜色以区分ON和OFF,但我的实际要求是在开关内显示"YES"或"NO"文本,如下所示.
这是我的代码:
<Switch
onValueChange={this.change.bind(this)}
style={{marginBottom:10,width:90,marginRight:6,marginLeft:6}}
value={true}
thumbTintColor="#0000ff"
tintColor="#ff0000"
/>
Run Code Online (Sandbox Code Playgroud)
请给我建议解决这个问题,任何帮助非常感谢.
最后我得到了开关内开关.......
安装
npm install --save react-native-switch
import { Switch } from 'react-native-switch';
<Switch
value={true}
onValueChange={(val) => console.log(val)}
disabled={false}
activeText={'On'}
inActiveText={'Off'}
backgroundActive={'green'}
backgroundInactive={'gray'}
circleActiveColor={'#30a566'}
circleInActiveColor={'#000000'}/>
Run Code Online (Sandbox Code Playgroud)
请参阅此链接... https://github.com/shahen94/react-native-switch
| 归档时间: |
|
| 查看次数: |
9815 次 |
| 最近记录: |