fateh999 / react-native-paper-dropdown

Dropdown using react native paper TextInput and Menu
MIT License
130 stars 74 forks source link

Provide a feature to disable options in dropdown #114

Open vndpal opened 1 month ago

vndpal commented 1 month ago

It would be nice if there is a way to disable few options from the dropdown. it can be implemented like below

const OPTIONS = [
  { label: 'Male', value: 'male',disabled:false },
  { label: 'Female', value: 'female',disabled:true },
  { label: 'Other', value: 'other',disabled:false},
];

export default function App() {
  const [gender, setGender] = useState<string>();

  return (
    <PaperProvider>
      <View style={{ margin: 16 }}>
        <Dropdown
          label="Gender"
          placeholder="Select Gender"
          options={OPTIONS}
          value={gender}
          onSelect={setGender}
        />
      </View>
    </PaperProvider>
  );
fateh999 commented 1 month ago

@vndpal thanks for the suggestion, will try to add this feature in a new release