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 clear function is not working #11948

Closed
Woodswu opened this issue Jan 17, 2017 · 1 comment
Closed

TextInput clear function is not working #11948

Woodswu opened this issue Jan 17, 2017 · 1 comment
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@Woodswu
Copy link

Woodswu commented Jan 17, 2017

I have a multiline TextInput that I want to clear when the return key is pressed.

I have been able to clear the input with this.refs.input.clear() and this.refs.input.setNativeProps({ text: '' }) but these don't work when using them onKeyPress

This does not work

onKeyPress={event => if (event.nativeEvent.key === 'Enter') this.refs.input.clear()
I would expect that it would clear the input

Using RN 0.37.0

@Woodswu
Copy link
Author

Woodswu commented Jan 17, 2017

I have thought about the solution

first set blurOnSubmit={true}

second:
onSubmitEditing={()=>{this.refs.input.clear()}}

so i closed this issued

@Woodswu Woodswu closed this as completed Jan 17, 2017
@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 19, 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