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

[TextInput] Not clear what Warning Message for TextInput means. #1689

Closed
alinz opened this issue Jun 19, 2015 · 14 comments
Closed

[TextInput] Not clear what Warning Message for TextInput means. #1689

alinz opened this issue Jun 19, 2015 · 14 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@alinz
Copy link

alinz commented Jun 19, 2015

After upgrading React Native to 0.6.0 I'm starting to get this warning.

Warning: Don't set .props.style of the React component <TextInput />. Instead, specify the correct value when initially creating the element or use React.cloneElement to make a new element with updated props.

I did everything as it describes above. but nothing works so far. Any idea why this warning start to show up. I would like to see some example if that possible,

@brentvatne
Copy link
Collaborator

Can you show us some code that produces this warning?

@brentvatne brentvatne changed the title Not clear what Warning Message for TextInput means. [TextInput] Not clear what Warning Message for TextInput means. Jun 20, 2015
@alinz
Copy link
Author

alinz commented Jun 22, 2015

Well, I'm using my fork version of react-native which can be found here.
I have only changes 2 things

  • added es6.modules to white list here
  • force the version to be 0.5.0 to by pass some npm errors.

now the regular TextInput component keeps sending me that warning. I'm not doing any fancy thing. It used to work but changes to latest code causes this warning.

I needed the new version react-native because it has new methods for fixing this issue #1402

@brentvatne
Copy link
Collaborator

We can't really support forks, but if you can reproduce this on a standard build of React Native then please do link to the repo and I'll be happy to take a look! Closing until then

@jawadrehman
Copy link

@brentvatne I use the version 0.6-rc and I can see the same warning message.

@brentvatne brentvatne reopened this Jun 24, 2015
@admmasters
Copy link
Contributor

This is occurring on the 0.6.0 release version. Can be reproduced by creating a brand new project and adding at least one TextInput field to the render method.

@admmasters
Copy link
Contributor

This is related to line 422 of TextInput.js:

props.style = [styles.input, this.props.style]

You are mutating props within the render method - which obviously is not good practice.

@ide
Copy link
Contributor

ide commented Jun 26, 2015

@admmasters do you want to submit a PR? Cloning the props should fix it ex:

var props = {
   ...this.props,
  style: [styles.input, this.props.style],
};

@admmasters
Copy link
Contributor

Sure - I was just looking at it now :)

@alinz
Copy link
Author

alinz commented Jun 26, 2015

👍

@chirag04
Copy link
Contributor

saw this warning today.

@chirag04
Copy link
Contributor

@ide Is this merged in master? I just updated to 0.7.1 and i still see this warning

@ide
Copy link
Contributor

ide commented Jul 10, 2015

It has not been merged.

sahrens pushed a commit to sahrens/react-native that referenced this issue Jul 15, 2015
Summary:
This should close issue 1689. Using Object.assign to pass Flow checks.
Closes facebook#1956
Github Author: Matt Revell <[email protected]>
ide pushed a commit that referenced this issue Jul 15, 2015
Summary:
This should close issue 1689. Using Object.assign to pass Flow checks.
Closes #1956
Github Author: Matt Revell <[email protected]>
@browniefed
Copy link
Contributor

@brentvatne looks like the solution got merged 5 days ago.

@brentvatne
Copy link
Collaborator

@browniefed - indeed, this is in master now! Thanks for pointing it out 😄

@facebook facebook locked as resolved and limited conversation to collaborators Jul 22, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 22, 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

8 participants