setNativeProps Change Value for Text Component React Native Direct Manipulation

Instead of attempting to change the content of <Text> component. I just replaced with <TextInput editable={false} defaultValue={this.state.initValue} /> and kept the rest of the code the same. If anyone know how you can change the value of <Text> using setNativeProps OR other method of direct manipulations. Post the answer and ill review and accept.


The text tag doesn't have a text prop, so

this._text.setNativeProps({ text: 'XXXX' })

doesn't work.

But the text tag has a style prop, so

this._text.setNativeProps({ style: { color: 'red' } })  

works.

Tags:

React Native