Skip to content

Commit

Permalink
Add disabled modifier prop (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-levy authored May 28, 2024
1 parent d19cbd8 commit abcbb01
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/docs/03-API/08-modifiers.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ To approximate this in React Native, views are styled using props. Each prop cor
| shadow | { color?: Color; x?: number; y?: number; radius: number; opacity?: number; } |
| background | Color \| LinearGradient |
| hidden | boolean |
| disabled | boolean |
| frame | Frame |
| zIndex | number |
| opacity | number |
Expand Down
5 changes: 5 additions & 0 deletions ios/Common/View+Modifiers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ struct ReactNativeViewModifiers: ViewModifier {
view = AnyView(view.tag(tag))
}

case "disabled":
if let disabled = value as? Bool {
view = AnyView(view.disabled(disabled))
}

case "foregroundStyle":
if let colorVal = value as? String {
let color = getColor(colorVal) as Color?
Expand Down
1 change: 1 addition & 0 deletions src/utils/modifiers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export type Modifiers = {
opacity?: number;
};
background?: Color | LinearGradient;
disabled?: boolean;
hidden?: boolean;
frame?:
| {
Expand Down

0 comments on commit abcbb01

Please sign in to comment.