Skip to content

Commit 95775b0

Browse files
committed
fix(showcase): mobile web select bug
1 parent 353ee5e commit 95775b0

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

apps/showcase/app/select.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { Text } from '~/components/ui/text';
1515

1616
export default function SelectScreen() {
1717
const triggerRef = React.useRef<React.ElementRef<typeof SelectTrigger>>(null);
18+
const triggerScollableRef = React.useRef<React.ElementRef<typeof SelectTrigger>>(null);
1819
const insets = useSafeAreaInsets();
1920
const contentInsets = {
2021
top: insets.top,
@@ -37,7 +38,14 @@ export default function SelectScreen() {
3738
/>
3839
<View className='flex-1 justify-center items-center'>
3940
<Select defaultValue={{ value: 'apple', label: 'Apple' }}>
40-
<SelectTrigger ref={triggerRef} className='w-[250px]'>
41+
<SelectTrigger
42+
ref={triggerRef}
43+
className='w-[250px]'
44+
onTouchStart={() => {
45+
// Temporary fix for https://github.com/mrzachnugent/react-native-reusables/issues/343#issuecomment-2779827475
46+
triggerRef.current?.open();
47+
}}
48+
>
4149
<SelectValue
4250
className='text-foreground text-sm native:text-lg'
4351
placeholder='Select a fruit'
@@ -68,7 +76,14 @@ export default function SelectScreen() {
6876
<View>
6977
<Text className='text-center text-muted-foreground pb-2'>With scroll view</Text>
7078
<Select defaultValue={{ value: 'apple', label: 'Apple' }}>
71-
<SelectTrigger className='w-[250px]'>
79+
<SelectTrigger
80+
ref={triggerScollableRef}
81+
className='w-[250px]'
82+
onTouchStart={() => {
83+
// Temporary fix for https://github.com/mrzachnugent/react-native-reusables/issues/343#issuecomment-2779827475
84+
triggerScollableRef.current?.open();
85+
}}
86+
>
7287
<SelectValue
7388
className='text-foreground text-sm native:text-lg'
7489
placeholder='Select a fruit'

0 commit comments

Comments
 (0)