I am using React Native 0.57.8 and React 16.7.0. I am creating an on-screen keyboard for Android TV which will be used as a library. I have a TextInput to whom I have assigned a reference. How can I use this reference to change the value of the TextInput?
constructor(props) {
super(props);
this.emailRef = React.createRef();
}
<TextInput
ref={this.emailRef}
placeHolder="Email Address"
blurOnSubmit={false}
/>
<Keyboard textInput={this.emailRef} />
Inside the library:
<Button
text="change value"
onPress={() => {
this.props.emailRef.current.props.value =
this.props.emailRef.current.props.value + "q";
}}
/>
value={this.state.value}in your TextInputonPressof each of the buttons inside the library. The state of the screen can't be updated from there.