如何关闭此开关按钮?这是代码:
<Switch
onValueChange={(value) => this.setState({falseSwitchIsOn: true})}
onTintColor='#42dff4'
value={this.state.falseSwitchIsOn} />
答案 0 :(得分:0)
像这样改变
<Switch
onValueChange={(value) => this.setState({falseSwitchIsOn: value})}
onTintColor='#42dff4'
value={this.state.falseSwitchIsOn} />
答案 1 :(得分:0)
你应该做的
<Switch
onValueChange={(value) => this.setState({falseSwitchIsOn: !this.state.falseSwitchIsOn })}
onTintColor='#42dff4'
value={this.state.falseSwitchIsOn} />
<Switch
onValueChange={(value) => this.setState({falseSwitchTwoIsOn: !this.state.falseSwitchTwoIsOn })}
onTintColor='#42dff4'
value={this.state.falseSwitchTwoIsOn} />