React Native · Expo SDK 57 New
Glass Picker
A labelled glass picker: a native menu or wheel on iOS, a dropdown on Android and a select on the web.
Installation
For Expo SDK 57 or later.
Add a components.json to your app first, as the Expo guide shows.
npx shadcn@4.14.1 add @glassyui-native/glass-picker && npx expo install --fixAdds 14 files to components/glassyui, then matches @expo/ui, expo-blur and expo-glass-effect to your Expo SDK. Rebuild your development build after adding native packages.
Usage
Glass Picker usage
import { useState } from 'react';
import { Text, View } from 'react-native';
import { GlassPicker } from '@/components/glassyui/glass-picker';
import { useGlassTheme } from '@/components/glassyui/glass-provider';
const OPTIONS = [
{ value: 'morning', label: 'Morning' },
{ value: 'afternoon', label: 'Afternoon' },
{ value: 'evening', label: 'Evening' },
];
export default function PickerExample() {
const { colors } = useGlassTheme();
const [value, setValue] = useState('morning');
return (
<View style={{ gap: 12 }}>
<GlassPicker
label="Reminder"
options={OPTIONS}
value={value}
onValueChange={setValue}
testID="native-picker"
/>
<Text style={{ color: colors.foreground }} testID="native-picker-value">
{OPTIONS.find((option) => option.value === value)?.label}
</Text>
</View>
);
}
It also uses Glass Provider. Install them together:
npx shadcn@4.14.1 add @glassyui-native/glass-picker @glassyui-native/glass-provider && npx expo install --fixAPI reference
GlassPicker
The platform picker on a glass surface; generic over T extends string.
| Prop | Type | Default | Description |
|---|---|---|---|
labelRequired | string | None | Visible label and accessible name. |
optionsRequired | readonly { label: string; value: T }[] | None | The choices; each value must be unique. |
value / onValueChangeRequired | T / (value: T) => void | None | The selected value and its change handler; value must match an option, or the picker throws. |
appearance | 'menu' | 'wheel' | 'menu' | wheel shows an inline wheel on iOS; Android and the web always use a dropdown. |
disabled | boolean | false | Prevents selection changes. |
style | StyleProp<ViewStyle> | None | Applies to the glass surface. |
testID | string | None | Passed to the native picker, or as data-testid on the web select. |
- Types
GlassPickerProps