Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-select native select on mobile

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?

like image 963
zok Avatar asked Aug 14 '17 11:08

zok


Video Answer


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} />
);
like image 149
jossmac Avatar answered Sep 19 '22 21:09

jossmac


blurInputOnSelect:

  • boolean = isTouchCapable()
  • Remove focus from the input when the user selects an option (handy for dismissing the keyboard on touch devices)
like image 41
spidey geek Avatar answered Sep 19 '22 21:09

spidey geek