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

[Docs] Add setNativeProps documentation (Original title: clear() function on TextInput) #1390

Closed
d-vine opened this issue May 24, 2015 · 11 comments
Assignees
Labels
Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Resolution: Locked This issue was locked by the bot.

Comments

@d-vine
Copy link

d-vine commented May 24, 2015

The problem: I need to clear a TextInput after some user interaction.

The request: expose some kind of clear() or even setText() functionality.

I understand that this is exactly the mutative approach to UI programming, that React is trying to get rid of. But as the docs state them selfs, a controlled approach to the TextInput component using the value property doesn't perform.
My current solution is to set the value property to null once on the next render after the user interaction. But this feels rather clunky. Since the declarative approach seems to break down with the TextInput implementation I would argue for exposing the mutative API.

@brentvatne
Copy link
Collaborator

@dvine-multimedia - are you using setNativeProps to set the value to null?

setNativeProps example
controlled setState example

@d-vine
Copy link
Author

d-vine commented May 26, 2015

@brentvatne I didn't realize that setNativeProps actually is the mutation API I was looking for. Thanks a lot. Maybe there could be some more documentation on that? But I don't know if react really want's to encourrage the usage of setNativePropsexcept for a few special cases.

@brentvatne
Copy link
Collaborator

@dvine-multimedia - good point, documentation for setNativeProps would be useful! Related - it might also be useful to add documentation for the issues faced in this discussion - also pertaining to communicating directly from js->native

@brentvatne brentvatne added the Good first issue Interested in collaborating? Take a stab at fixing one of these issues. label May 26, 2015
@brentvatne brentvatne self-assigned this May 26, 2015
@brentvatne brentvatne changed the title clear() function on TextInput setNativeProps documentation (Original title: clear() function on TextInput) May 28, 2015
@brentvatne brentvatne changed the title setNativeProps documentation (Original title: clear() function on TextInput) [Docs] Add setNativeProps documentation (Original title: clear() function on TextInput) May 28, 2015
@grabbou
Copy link
Contributor

grabbou commented Jun 8, 2015

Haven't seen any notes about blur and other methods available on a given component, is this something we would be interested in describing as well?

@ide
Copy link
Contributor

ide commented Jun 8, 2015

@grabbou yes, would be good to document public methods like blur().

@brentvatne
Copy link
Collaborator

@grabbou - any interest in adding some documentation for blur() and focus()?

@grabbou
Copy link
Contributor

grabbou commented Jun 17, 2015

Yeah, can add in some descriptions, any hints what's the appropriate place for them speaking docs structure wise?

@brentvatne
Copy link
Collaborator

@grabbou - TextInput seems like the best spot

@brentvatne
Copy link
Collaborator

@grabbou - I'm going to close this issue, can you open a PR for that when it's ready? Thanks 😄

@brentvatne
Copy link
Collaborator

Docs that cover setNativeProps for TextInput clearing are here: https://facebook.github.io/react-native/docs/direct-manipulation.html#setnativeprops-to-clear-textinput-value

@grabbou
Copy link
Contributor

grabbou commented Jun 18, 2015

Ah, nice! Will send over later today.

@facebook facebook locked as resolved and limited conversation to collaborators Jun 18, 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
Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants