react native TextInput发送清空内容

就是设置value的值

value = {this.state.inputText}

constructor(props) {
        super(props);
        this.state = {
           
            inputText:'',
        };       
    }


{this.refs.scroll.scrollTo({y:0,x:0,animated:true})}}
                                    onChangeText={(text) => {this.setState({inputText:text})}}
                                    value = {this.state.inputText}
                                    clearButtonMode="while-editing"

                                />

在要清空的方法里面放入清空即可

this.setState({inputText:''});

你可能感兴趣的:(react native TextInput发送清空内容)