Skip to content

TextInput won't clear onKeyPress #9960

Description

@bsiddiqui

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.31.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions