Skip to content

Commit

Permalink
Fix duplicate [RCTConvert UIUserInterfaceStyle:]
Browse files Browse the repository at this point in the history
Summary:
After #36122 we have two of these. This change consolidates the two category methods to be part of the base RCTConvert class instead.

Changelog:
[iOS][Fixed] - Fix duplicate [RCTConvert UIUserInterfaceStyle:]

Reviewed By: cipolleschi

Differential Revision: D44050929

fbshipit-source-id: dd216545e6194446c593cd693072f3959d653d7f
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Mar 14, 2023
1 parent 01f2936 commit d8b4737
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 28 deletions.
1 change: 1 addition & 0 deletions React/Base/RCTConvert.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ typedef NSURL RCTFileURL;
+ (UIKeyboardType)UIKeyboardType:(id)json;
+ (UIKeyboardAppearance)UIKeyboardAppearance:(id)json;
+ (UIReturnKeyType)UIReturnKeyType:(id)json;
+ (UIUserInterfaceStyle)UIUserInterfaceStyle:(id)json API_AVAILABLE(ios(12));
#if !TARGET_OS_TV
+ (UIDataDetectorTypes)UIDataDetectorTypes:(id)json;
#endif
Expand Down
10 changes: 10 additions & 0 deletions React/Base/RCTConvert.m
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,16 @@ + (UIKeyboardType)UIKeyboardType:(id)json RCT_DYNAMIC
UIReturnKeyDefault,
integerValue)

RCT_ENUM_CONVERTER(
UIUserInterfaceStyle,
(@{
@"unspecified" : @(UIUserInterfaceStyleUnspecified),
@"light" : @(UIUserInterfaceStyleLight),
@"dark" : @(UIUserInterfaceStyleDark),
}),
UIUserInterfaceStyleUnspecified,
integerValue)

RCT_ENUM_CONVERTER(
UIViewContentMode,
(@{
Expand Down
14 changes: 0 additions & 14 deletions React/CoreModules/RCTAlertManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,6 @@ @implementation RCTConvert (UIAlertViewStyle)

@end

@implementation RCTConvert (UIUserInterfaceStyle)

RCT_ENUM_CONVERTER(
UIUserInterfaceStyle,
(@{
@"unspecified" : @(UIUserInterfaceStyleUnspecified),
@"light" : @(UIUserInterfaceStyleLight),
@"dark" : @(UIUserInterfaceStyleDark),
}),
UIUserInterfaceStyleUnspecified,
integerValue)

@end

@interface RCTAlertManager () <NativeAlertManagerSpec>

@end
Expand Down
14 changes: 0 additions & 14 deletions React/CoreModules/RCTAppearance.mm
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,6 @@ void RCTOverrideAppearancePreference(NSString *const colorSchemeOverride)
return RCTAppearanceColorSchemeLight;
}

@implementation RCTConvert (UIUserInterfaceStyle)

RCT_ENUM_CONVERTER(
UIUserInterfaceStyle,
(@{
@"light" : @(UIUserInterfaceStyleLight),
@"dark" : @(UIUserInterfaceStyleDark),
@"unspecified" : @(UIUserInterfaceStyleUnspecified)
}),
UIUserInterfaceStyleUnspecified,
integerValue);

@end

@interface RCTAppearance () <NativeAppearanceSpec>
@end

Expand Down

0 comments on commit d8b4737

Please sign in to comment.