Skip to content

Commit

Permalink
fix(ios): guard new picker types (#12020)
Browse files Browse the repository at this point in the history
Fixes TIMOB-28112
  • Loading branch information
ewanharris committed Sep 9, 2020
1 parent 39ef241 commit fa8f547
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions iphone/Classes/TiUIPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,19 @@ - (void)setType_:(id)type_
}
}

#if IS_SDK_IOS_13_4
- (void)setDatePickerStyle_:(id)style
{
if (![TiUtils isIOSVersionOrGreater:@"13.4"]) {
DebugLog(@"setDatePickerStyle is only supported on iOS 13.4 and above");
return;
}
UIControl *picker = [self picker];
if ([self isDatePicker]) {
[(UIDatePicker *)picker setPreferredDatePickerStyle:[TiUtils intValue:style]];
}
}
#endif

// We're order-dependent on type being set first, so we need to make sure that anything that relies
// on whether or not this is a date picker needs to be set AFTER the initial configuration.
Expand Down
2 changes: 2 additions & 0 deletions iphone/Classes/TiUIiOSProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ - (NSNumber *)ROW_ACTION_STYLE_NORMAL

#ifdef USE_TI_UIPICKER

#if IS_SDK_IOS_13_4
- (NSNumber *)DATE_PICKER_STYLE_AUTOMATIC
{
if (![TiUtils isIOSVersionOrGreater:@"13.4"]) {
Expand All @@ -218,6 +219,7 @@ - (NSNumber *)DATE_PICKER_STYLE_COMPACT

return @(UIDatePickerStyleCompact);
}
#endif

#if IS_SDK_IOS_14
- (NSNumber *)DATE_PICKER_STYLE_INLINE
Expand Down
6 changes: 6 additions & 0 deletions iphone/iphone/Titanium_Prefix.pch
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
#define IS_SDK_IOS_14 false
#endif

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130400
#define IS_SDK_IOS_13_4 true
#else
#define IS_SDK_IOS_13_4 false
#endif

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
#define IS_SDK_IOS_13 true
#else
Expand Down

0 comments on commit fa8f547

Please sign in to comment.