React-select native select on mobile

Viewed 4295

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?

2 Answers

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} />
);

blurInputOnSelect:

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