question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Text input submit button not working on first click

See original GitHub issue

Environment

react: 16.8.3 => 16.8.3 react-native: 0.59.8 => 0.59.8

Platforms

Both in Android and iOS

Versions

  • Android: 9
  • iOS: 13.3
  • react-native-modal: 11.4.0
  • react-native: 0.59.8
  • react: 16.8.3

Description

Have a text input and submit and close button in the modal. The keyboard is autofocus and with the keyboard is opened and try to close or submit the inputs, the buttons are not working on the first click. On first click the keyboard is closed and need to click on the button second time to submit. Simulator Screen Shot - iPhone 11 Pro Max - 2020-03-24 at 13 01 59

Reproducible Demo

Step to reproduce:

  1. A text input, close and submit button in modal.
  2. The keyboard is auto-focused when the modal appears.
  3. Try to close the modal, by clicking the close button with the keyboard opened.
  4. On the first click the keyboard closed and need to tap again the close button to close the modal.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:18
  • Comments:26 (1 by maintainers)

github_iconTop GitHub Comments

68reactions
mo-patelcommented, Mar 30, 2020

Is your content wrapped in a <ScrollView />? If so, try keyboardShouldPersistTaps={'handled'} in <ScrollView> props.

16reactions
nafisholehcommented, Apr 30, 2020

keyboardShouldPersistTaps={'handled'} works for me, but in my case, I need to put these props into both the ScrollView and KeyboardAwareScrollView.

My code more or less looks like this:

<ScrollView 
     keyboardShouldPersistTaps={'handled'}
>
   ...
      <KeyboardAwareScrollView
           keyboardShouldPersistTaps={'handled'}
      >
         ...
         <Modal>...</Modal>
         ...
      <KeyboardAwareScrollView>
   ...
<ScrollView>
Read more comments on GitHub >

github_iconTop Results From Across the Web

submit button is not working on first click - Stack Overflow
You kept click function inside Submit function that's why you needed twice click. Button type is submit that's why first click triggering submit ......
Read more >
<input type="submit"> - HTML: HyperText Markup Language
A simple submit button ... This renders like so: Try entering some text into the text field, and then submitting the form. Upon...
Read more >
When a Click is Not Just a Click | CSS-Tricks
First things first. The <button> element, as described by MDN, is simply: The HTML element represents a clickable button, used to submit ......
Read more >
Submit button works under IE, but not under Chrome
Everything goes well as in tutorial, but finally clicking the Submit button does nothing in Chrome. It pass for the first-time after Chrome...
Read more >
JavaScript input type=submit is not working? - Tutorialspoint
To make it work, you can use onclick with input type = “submit”. Example. Following is the code − <!DOCTYPE html> <html lang="en">...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found