Mobile Scrollbar defaults to browser style
https://stackoverflow.com/questions/65740512/mobile-scrollbar-for-react-select-defaults-to-browser-style
I know that it says not to post issues here that should be in StackOverflow, but I've only gotten basically a view a day and hope that maybe someone is running into a similar issue here.
I have a react-select component with a custom scrollbar that works in desktop browsers as expected, but on mobile the scrollbar defaults to browser values.
const styles = {
menu: provided => ({
...provided,
width: '100%',
height: '240px',
boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.25)',
overflowY: 'scroll',
'::-webkit-scrollbar-thumb': {
background: royal, // imported color string
height: '50px',
},
'::-webkit-scrollbar-thumb:hover': {
background: royal,
height: '50px',
},
'::-webkit-scrollbar-track': {
background: softGrey,
},
'::-webkit-scrollbar': {
width: '4px',
background: softGrey,
},
}),
menuList: () => ({
'::-webkit-scrollbar': {
width: '4px',
},
}),
}
<Select
placeholder={placeholder}
styles={styles}
onMenuOpen={onOpenHandler}
onMenuClose={onCloseHandler}
onChange={onChangeHandler}
onInputChange={() => {}}
controlShouldRenderValue
label={label}
value={value}
defaultValue={defaultValue}
options={options}
/>
The github references using menuList, but I found that using menu and menuList got me the desired style. I tried every variant of:
- using !important
- moving only to menuList
- having in both menu and menuList
- using react-select v2 (2.4.1) and v3 (3.2.0)
@serkolch I can confirm that this behavior happens. But unfortunately this is not a problem with this library.
I can only assume that you are using a WebKit browser on your mobile device. Possibly iOS, running latest-ish version? If that is the case than you are unfortunately out of luck. It seems as custom scrollbars do no longer work / are no longer supported on iOS 14+ (source).
@serkolch it would appear that the response from the source provided above came directly from an Apple developer so it would seem this is a case of Apple being Apple again. I will mark this as closed but if there are any further concerns or questions, please feel free to reply and we can re-open if applicable.