codex
codex

Reputation: 87

change inputText via ref

I'm going to change the textinput via ref, but nothing happens

My code in the render is as follows

<TextInput
       onChangeText={(value) => this.setState({replyTicketText: value})} />
       ref={"replyInput"+this.state.ticketID}
       />

When I call the function:

let replyInput;
          replyInput = "replyInput"+this.state.ticketID;
          this.refs[replyInput].setNativeProps({ text: ' ' });

platfrom: ios

Upvotes: 0

Views: 68

Answers (1)

fmortens
fmortens

Reputation: 73

I'm probably misunderstanding, but would it not be easier to hook the input to state, the field will update when state is changed?

value={this.state.replyTicketText}

Upvotes: 1

Related Questions