Repository navigation
Form submit functionality not working #2777
|
I have a form with different form elements like input, dropdowns, radio buttons, etc., and I want to submit it when the user presses the enter key. However, let's say after the user types something in the input field and presses the enter key on the keyboard to submit the form, it defocuses the input field; on the second click, it hits the submit button. I'm not sure why it's submitting the form on the second enter click. The same occurs if the user is on any other form elements. Actual Result: Expected Result: Here is the code: PS: This is how I'm detecting the Enter key, but still it is not working because focus remains on the last form element the user has clicked: |
To submit when the user presses Enter in a field, use the
onSubmitEditingprop ofTextInput(see #1034). If you see a bug in React Native for Web, please open an issue with a minimal repro. Closing.