我想在兩個(gè)或其中一個(gè)輸入為空時(shí)禁用按鈕。順便說一句,它是 Native Base 框架。 <View style={styles.personal} key={data}> <Item floatingLabel> <Label>Your name:</Label> <Input /> </Item> <Item floatingLabel style={{marginVertical: 20}}> <Label>Your age:</Label> <Input keyboardType="numeric"/> </Item> <Button style={{alignSelf: 'center'}} rounded disabled={false} onPress={() => this.refs.swiper.scrollBy(1)}> <Text style={{width: '70%', textAlign: 'center'}}>Next</Text> </Button> </View>我嘗試過的:state = { inputName: "", inputAge: "",}<Input value={this.setState({inputName: value})}/> <Input value={this.setState({inputAge: value})} keyboardType="numeric"/><Button style={{alignSelf: 'center'}} rounded disabled={this.state.inputName==="" & this.state.inputAge==="" ? true:false } onPress={() => this.refs.swiper.scrollBy(1)}> <Text style={{width: '70%', textAlign: 'center'}}>Next</Text> </Button>變量值錯(cuò)誤
基于輸入的切換按鈕(Native Base)
墨色風(fēng)雨
2023-08-18 14:35:04