Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direct manipulation TextInput defaultValue #13106

Closed
gezichenshan opened this issue Mar 23, 2017 · 1 comment
Closed

Direct manipulation TextInput defaultValue #13106

gezichenshan opened this issue Mar 23, 2017 · 1 comment
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@gezichenshan
Copy link

gezichenshan commented Mar 23, 2017

I was looking for help on the stackOverflow but just get this one which didn't solve my problem:
here

I also want to directly update the value of a component due to performance reasons.
Here is my code,

<TextInput ref="currentAlphabetRefer" editable={false} style={{width:60,fontSize:30,color:'#fff'}} defaultValue='test'/>
this.refs.currentAlphabetRefer.setNativeProps({ defaultValue : 'A'})

However, the defaultValue doesn't get change.

But when I set the style by setNativeProps,

this.refs.currentAlphabetRefer.setNativeProps({ style :{color:'#f00'}})

I could see the fontColor turn red.

Is 'defaultValue' not a prop of TextInput ?

@gezichenshan gezichenshan changed the title Direct manipulation TextInput defaultValeu Direct manipulation TextInput defaultValue Mar 23, 2017
@gezichenshan
Copy link
Author

OK,I've seen this question: issue1390,
and resort to this page,which solved my puzzle.

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

2 participants