Remove <Webkit/Webkit.h> import in RCTConvert.h (#39794)

Summary:
This PR is in response to https://github.com/facebook/react-native/pull/39758#discussion_r1344839022 .

`RCTConvert.h` currently takes an import of `<Webkit/Webkit.h>` for... one enum: `WKDataDetectorTypes`. This has a few problems:

1) RCTConvert is JS engine agnostic, it shouldn't be depending on Webkit
2) As far as I can tell, this code is dead, we also define (and use) the UIKit equivalent `UIDataDetectorTypes`.

Let's just combine the two, update some JS typing, and get rid of the Webkit header import.

## Changelog:

[IOS] [CHANGED] - Remove `<Webkit/Webkit.h>` import in `RCTConvert.h`

Pull Request resolved: https://github.com/facebook/react-native/pull/39794

Test Plan: CI should pass

Reviewed By: rshest

Differential Revision: D49898701

Pulled By: NickGerleman

fbshipit-source-id: 5420cb62317e1186426aae019bcc43d27c49ea26
This commit is contained in:
Saad Najmi
2023-10-04 06:42:17 -07:00
committed by Facebook GitHub Bot
parent acb88d477e
commit 452bf0ff06
5 changed files with 12 additions and 23 deletions
@@ -84,6 +84,9 @@ type DataDetectorTypes =
| 'link'
| 'address'
| 'calendarEvent'
| 'trackingNumber'
| 'flightNumber'
| 'lookupSuggestion'
| 'none'
| 'all';
@@ -99,6 +99,9 @@ type DataDetectorTypesType =
| 'link'
| 'address'
| 'calendarEvent'
| 'trackingNumber'
| 'flightNumber'
| 'lookupSuggestion'
| 'none'
| 'all';
@@ -137,6 +137,9 @@ type DataDetectorTypesType =
| 'link'
| 'address'
| 'calendarEvent'
| 'trackingNumber'
| 'flightNumber'
| 'lookupSuggestion'
| 'none'
| 'all';
@@ -16,9 +16,6 @@
#import <React/RCTPointerEvents.h>
#import <React/RCTTextDecorationLineType.h>
#import <yoga/Yoga.h>
#if TARGET_OS_IPHONE
#import <WebKit/WebKit.h>
#endif
/**
* This class provides a collection of conversion functions for mapping
@@ -78,10 +75,6 @@ typedef NSURL RCTFileURL;
+ (UIDataDetectorTypes)UIDataDetectorTypes:(id)json;
#endif
#if TARGET_OS_IPHONE
+ (WKDataDetectorTypes)WKDataDetectorTypes:(id)json;
#endif
+ (UIViewContentMode)UIViewContentMode:(id)json;
#if !TARGET_OS_TV
+ (UIBarStyle)UIBarStyle:(id)json;
+3 -16
View File
@@ -450,28 +450,15 @@ RCT_MULTI_ENUM_CONVERTER(
@"link" : @(UIDataDetectorTypeLink),
@"address" : @(UIDataDetectorTypeAddress),
@"calendarEvent" : @(UIDataDetectorTypeCalendarEvent),
@"trackingNumber" : @(UIDataDetectorTypeShipmentTrackingNumber),
@"flightNumber" : @(UIDataDetectorTypeFlightNumber),
@"lookupSuggestion" : @(UIDataDetectorTypeLookupSuggestion),
@"none" : @(UIDataDetectorTypeNone),
@"all" : @(UIDataDetectorTypeAll),
}),
UIDataDetectorTypePhoneNumber,
unsignedLongLongValue)
RCT_MULTI_ENUM_CONVERTER(
WKDataDetectorTypes,
(@{
@"phoneNumber" : @(WKDataDetectorTypePhoneNumber),
@"link" : @(WKDataDetectorTypeLink),
@"address" : @(WKDataDetectorTypeAddress),
@"calendarEvent" : @(WKDataDetectorTypeCalendarEvent),
@"trackingNumber" : @(WKDataDetectorTypeTrackingNumber),
@"flightNumber" : @(WKDataDetectorTypeFlightNumber),
@"lookupSuggestion" : @(WKDataDetectorTypeLookupSuggestion),
@"none" : @(WKDataDetectorTypeNone),
@"all" : @(WKDataDetectorTypeAll),
}),
WKDataDetectorTypePhoneNumber,
unsignedLongLongValue)
RCT_ENUM_CONVERTER(
UIKeyboardAppearance,
(@{