Skip to content

Commit 04f0179

Browse files
committed
feat: add enabled props for web
1 parent b4ac9a3 commit 04f0179

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ If set to false, the picker will be disabled, i.e. the user will not be able to
235235

236236
| Type | Required | Platform |
237237
| ---- | -------- | -------- |
238-
| bool | No | Android, Windows |
238+
| bool | No | Android, Web, Windows |
239239

240240
---
241241

js/PickerItem.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type Props = {
1313
color?: ColorValue,
1414
label: string,
1515
testID?: string,
16+
enabled?: Boolean,
1617
value?: number | string,
1718
};
1819

@@ -22,14 +23,24 @@ const createElement =
2223

2324
const Option = (props: any) => createElement('option', props);
2425

26+
/**
27+
* PickerItem Component for React Native Web
28+
* @returns
29+
*/
2530
export default function PickerItem({
2631
color,
2732
label,
2833
testID,
2934
value,
35+
enabled = true,
3036
}: Props): React.Node {
3137
return (
32-
<Option style={{color}} testID={testID} value={value} label={label}>
38+
<Option
39+
disabled={enabled === false ? true : undefined}
40+
style={{color}}
41+
testID={testID}
42+
value={value}
43+
label={label}>
3344
{label}
3445
</Option>
3546
);

typings/Picker.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export interface PickerItemProps<T = ItemValue> {
3232
* If set to false, the specific item will be disabled, i.e. the user will not be able to make a
3333
* selection.
3434
* @default true
35-
* @platform android
35+
* @platform android | web
3636
*/
3737
enabled?: boolean;
3838
}

0 commit comments

Comments
 (0)