7

Is it possible to have react-select fall back to the native select on mobile devices?

And actually, why is that not the default behaviour?

zok
  • 6,065
  • 10
  • 43
  • 65
  • The native html select is extremely limited in its options to be styled and adjusted. I would assume that the react-select library has choses not to do so that they could offer more flexible and wide-ranging features. – Fluous Jan 05 '23 at 13:46

2 Answers2

7

This isn't the responsibility of react-select, though if you need this behavior you can compose your own component to achieve it.

You'll need some sort of isMobile() check -- "Detecting a mobile browser"

const MobileAwareSelect = (props) => isMobile() ? (
  <select>{props.options.map(...)}</select>
) : (
  <ReactSelect {...props} />
);
jossmac
  • 208
  • 3
  • 8
2

blurInputOnSelect:

  • boolean = isTouchCapable()
  • Remove focus from the input when the user selects an option (handy for dismissing the keyboard on touch devices)
Roshan RZN
  • 66
  • 4