import React from "react"; import { View } from "react-native"; import { Select, cn } from "heroui-native"; import { NText } from "./NText"; export interface SelectOption { label: string; value: string; } export interface NSelectProps { label?: string; selectLabel?: string; placeholder?: string; isDisabled?: boolean; /** Alias of `isDisabled`. */ disabled?: boolean; defaultValue?: SelectOption; /** The selected option, for a controlled select. */ value?: SelectOption; items: SelectOption[]; /** Alias of `items`, as the React package names it. */ options?: SelectOption[]; onValueChange?: (value: string) => void; /** Alias of `onValueChange`. */ onChange?: (value: string) => void; containerClassName?: string; labelClassName?: string; triggerClassName?: string; } export const NSelect = React.memo( ({ label = "", selectLabel = "", placeholder = "", isDisabled, disabled, defaultValue, value, items, options, onValueChange, onChange, containerClassName = "", labelClassName = "", triggerClassName = "", }) => { const list = items ?? options ?? []; const off = disabled ?? isDisabled ?? false; const change = onValueChange ?? onChange; return ( {label && {label}} ); }, ); NSelect.displayName = "NSelect";