UNPKG

@react-native-aria/listbox

Version:
37 lines (34 loc) 790 B
import { usePress } from '@react-native-aria/interactions'; /** * Provides the behavior and accessibility implementation for an option in a listbox. * See `useListBox` for more details about listboxes. * @param props - Props for the option. * @param state - State for the listbox, as returned by `useListState`. */ export function useOption(props, state, _ref) { let { isSelected, isDisabled, key } = props; const onPress = () => { //@ts-ignore state.selectionManager.select(key); }; let { pressProps } = usePress({ onPress, isDisabled }); return { optionProps: { ...pressProps, accessibilityState: { isSelected } }, labelProps: {}, descriptionProps: {} }; } //# sourceMappingURL=useOption.js.map