Skip to content

Commit

Permalink
Migrate RCTWebView to WKWebView.
Browse files Browse the repository at this point in the history
  • Loading branch information
bowerman0 committed Dec 5, 2017
1 parent 7fb3a92 commit da2cf97
Show file tree
Hide file tree
Showing 5 changed files with 443 additions and 119 deletions.
4 changes: 4 additions & 0 deletions React/Base/RCTConvert.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

#import <QuartzCore/QuartzCore.h>
#import <UIKit/UIKit.h>
#if !TARGET_OS_TV
#import <WebKit/WebKit.h>
#endif

#import <React/RCTAnimationType.h>
#import <React/RCTBorderStyle.h>
Expand Down Expand Up @@ -70,6 +73,7 @@ typedef NSURL RCTFileURL;
+ (UIReturnKeyType)UIReturnKeyType:(id)json;
#if !TARGET_OS_TV
+ (UIDataDetectorTypes)UIDataDetectorTypes:(id)json;
+ (WKDataDetectorTypes)WKDataDetectorTypes:(id)json;
#endif

+ (UIViewContentMode)UIViewContentMode:(id)json;
Expand Down
13 changes: 13 additions & 0 deletions React/Base/RCTConvert.m
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,19 @@ + (NSLocale *)NSLocale:(id)json
@"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)

#endif

RCT_ENUM_CONVERTER(UIKeyboardAppearance, (@{
Expand Down
5 changes: 5 additions & 0 deletions React/Views/RCTWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

#import <WebKit/WebKit.h>

#import <React/RCTView.h>

@class RCTWebView;
Expand Down Expand Up @@ -37,6 +39,9 @@ shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
@property (nonatomic, assign) BOOL messagingEnabled;
@property (nonatomic, copy) NSString *injectedJavaScript;
@property (nonatomic, assign) BOOL scalesPageToFit;
@property (nonatomic, assign) BOOL allowsInlineMediaPlayback;
@property (nonatomic, assign) BOOL mediaPlaybackRequiresUserAction;
@property (nonatomic, assign) WKDataDetectorTypes dataDetectorTypes;

- (void)goForward;
- (void)goBack;
Expand Down
Loading

0 comments on commit da2cf97

Please sign in to comment.