Skip to content

Commit

Permalink
feat(ios): add overrideUserInterfaceStyle to Picker (#14041)
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga committed May 21, 2024
1 parent a298387 commit 0c93fa7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
15 changes: 15 additions & 0 deletions apidoc/Titanium/UI/Picker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,21 @@ properties:
since: "5.2.0"
default: "black"

- name: overrideUserInterfaceStyle
summary: Forces the picker to used assigned theme instead of the system theme.
description: |
When set to [USER_INTERFACE_STYLE_DARK](Titanium.UI.USER_INTERFACE_STYLE_DARK) or
[USER_INTERFACE_STYLE_LIGHT](Titanium.UI.USER_INTERFACE_STYLE_LIGHT), the picker will ignore
the system's current theme and use the theme assigned to this property instead.
When set to [USER_INTERFACE_STYLE_UNSPECIFIED](Titanium.UI.USER_INTERFACE_STYLE_UNSPECIFIED),
the picker will use the system's current theme.
type: Number
default: Titanium.UI.USER_INTERFACE_STYLE_UNSPECIFIED
constants: Titanium.UI.USER_INTERFACE_STYLE_*
osver: {ios: {min: "13.0"}}
since: "12.4.0"

- name: format24
summary: |
Determines whether the Time pickers display in 24-hour or 12-hour clock format.
Expand Down
9 changes: 9 additions & 0 deletions iphone/Classes/TiUIPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,15 @@ - (void)setBackgroundColor_:(id)value
}
}

- (void)setOverrideUserInterfaceStyle_:(id)args
{
ENSURE_SINGLE_ARG(args, NSNumber);
if (picker != nil) {
int style = [TiUtils intValue:args def:UIUserInterfaceStyleUnspecified];
((UIDatePicker *)[self picker]).overrideUserInterfaceStyle = style;
}
}

- (void)setDateTimeColor_:(id)value
{
// Guard date picker and iOS 14+ date picker style
Expand Down

0 comments on commit 0c93fa7

Please sign in to comment.