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.

Virtual keyboard on mobile phone pops up

See original GitHub issue

When I visit my app on desktop, everything is great! However, when I open it from my phone and I click the input field of react-datepicker, my phone thinks I’d like to enter data.

So I tried the prop readOnly but unfortunately, it disables the calendar. When I click the input, nothing happens.

Any workaround to this? Maybe instead of <input>, it should be <button>?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:11

github_iconTop GitHub Comments

44reactions
Dan2Dcommented, Jun 25, 2019

Found a simple fix by setting onFocus to DatePicker component (at least it worked for me…) <DatePicker . . . . . onFocus={(e) => e.target.readOnly = true} />

9reactions
tinutscommented, Mar 13, 2019

Use a custom input to override the default one, works for me 😃

// DateInput.jsx

import React from 'react';

export default class DateInput extends React.PureComponent {
  state = {readOnly: false};

  render() {
    return (
      <input
        {...this.props}
        onFocus={() => this.setState({readOnly: true})}
        onBlur={() => this.setState({readOnly: false})}
        readOnly={this.state.readOnly}
      />
    );
  };
}
// DatePicker.jsx

<DatePicker
  ...
  customInput={<DateInput />}
  ...
/>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Anyone know how to stop the virtual keyboard from ... - Reddit
Anyone know how to stop the virtual keyboard from automatically popping up? · Go to Settings · Look for Advanced section and expand...
Read more >
CN80 Android How to prevent virtual keyboard from popping ...
Click on any text field so that the virtual keyboard shows. · On the right lower corner, click on the keyboard layout so...
Read more >
Help! My on screen keyboard keeps coming up when I use my ...
Go to Settings / Language and Input / Current Keyboard, turn off under Hardware, Show On-Screen Keyboard Even If A Physical Keyboard Is ......
Read more >
Why does the on screen keyboard pop up ev…
Why does the on screen keyboard pop up every minute on my ipad? ... white with black symbols, started after resetting the device...
Read more >
Disable Soft Keyboard while using Bluetooth keyboard
In this video, I show how to disable the on- screen keyboard when a Bluetooth keyboard is attached.While I'm sure that these instructions...
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