WIP: WebView extraction - iOS working both UI and WK versions

This commit is contained in:
Jamon Holmgren 2018-09-08 14:50:13 -07:00
parent 6123deaf12
commit 922151ec42
10 changed files with 55 additions and 341 deletions

View File

@ -1,6 +1,6 @@
#import <React/RCTView.h>
@class RNCWebView;
@class RCTUIWebView;
/**
* Special scheme used to pass messages to the injectedJavaScript
@ -10,17 +10,17 @@
*/
extern NSString *const RNCJSNavigationScheme;
@protocol RNCWebViewDelegate <NSObject>
@protocol RCTUIWebViewDelegate <NSObject>
- (BOOL)webView:(RNCWebView *)webView
- (BOOL)webView:(RCTUIWebView *)webView
shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
withCallback:(RCTDirectEventBlock)callback;
@end
@interface RNCWebView : RCTView
@interface RCTUIWebView : RCTView
@property (nonatomic, weak) id<RNCWebViewDelegate> delegate;
@property (nonatomic, weak) id<RCTUIWebViewDelegate> delegate;
@property (nonatomic, copy) NSDictionary *source;
@property (nonatomic, assign) UIEdgeInsets contentInset;

View File

@ -1,4 +1,4 @@
#import "RNCWebView.h"
#import "RCTUIWebView.h"
// #import <UIKit/UIKit.h>
#import <React/RCTAutoInsetsProtocol.h>
@ -13,7 +13,7 @@ NSString *const RNCJSNavigationScheme = @"react-js-navigation";
static NSString *const kPostMessageHost = @"postMessage";
@interface RNCWebView () <UIWebViewDelegate, RCTAutoInsetsProtocol>
@interface RCTUIWebView () <UIWebViewDelegate, RCTAutoInsetsProtocol>
@property (nonatomic, copy) RCTDirectEventBlock onLoadingStart;
@property (nonatomic, copy) RCTDirectEventBlock onLoadingFinish;
@ -23,7 +23,7 @@ static NSString *const kPostMessageHost = @"postMessage";
@end
@implementation RNCWebView
@implementation RCTUIWebView
{
UIWebView *_webView;
NSString *_injectedJavaScript;

View File

@ -0,0 +1,5 @@
#import <React/RCTViewManager.h>
@interface RCTUIWebViewManager : RCTViewManager
@end

View File

@ -1,15 +1,15 @@
#import "RNCWebViewManager.h"
#import "RCTUIWebViewManager.h"
#import <React/RCTBridge.h>
#import <React/RCTUIManager.h>
#import <React/UIView+React.h>
#import "RNCWebView.h"
#import "RCTUIWebView.h"
@interface RNCWebViewManager () <RNCWebViewDelegate>
@interface RCTUIWebViewManager () <RCTUIWebViewDelegate>
@end
@implementation RNCWebViewManager
@implementation RCTUIWebViewManager
{
NSConditionLock *_shouldStartLoadLock;
BOOL _shouldStartLoad;
@ -19,7 +19,7 @@ RCT_EXPORT_MODULE()
- (UIView *)view
{
RNCWebView *webView = [RNCWebView new];
RCTUIWebView *webView = [RCTUIWebView new];
webView.delegate = self;
return webView;
}
@ -44,10 +44,10 @@ RCT_REMAP_VIEW_PROPERTY(dataDetectorTypes, _webView.dataDetectorTypes, UIDataDet
RCT_EXPORT_METHOD(goBack:(nonnull NSNumber *)reactTag)
{
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCWebView *> *viewRegistry) {
RNCWebView *view = viewRegistry[reactTag];
if (![view isKindOfClass:[RNCWebView class]]) {
RCTLogError(@"Invalid view returned from registry, expecting RNCWebView, got: %@", view);
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTUIWebView *> *viewRegistry) {
RCTUIWebView *view = viewRegistry[reactTag];
if (![view isKindOfClass:[RCTUIWebView class]]) {
RCTLogError(@"Invalid view returned from registry, expecting RCTUIWebView, got: %@", view);
} else {
[view goBack];
}
@ -58,8 +58,8 @@ RCT_EXPORT_METHOD(goForward:(nonnull NSNumber *)reactTag)
{
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
id view = viewRegistry[reactTag];
if (![view isKindOfClass:[RNCWebView class]]) {
RCTLogError(@"Invalid view returned from registry, expecting RNCWebView, got: %@", view);
if (![view isKindOfClass:[RCTUIWebView class]]) {
RCTLogError(@"Invalid view returned from registry, expecting RCTUIWebView, got: %@", view);
} else {
[view goForward];
}
@ -68,10 +68,10 @@ RCT_EXPORT_METHOD(goForward:(nonnull NSNumber *)reactTag)
RCT_EXPORT_METHOD(reload:(nonnull NSNumber *)reactTag)
{
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCWebView *> *viewRegistry) {
RNCWebView *view = viewRegistry[reactTag];
if (![view isKindOfClass:[RNCWebView class]]) {
RCTLogError(@"Invalid view returned from registry, expecting RNCWebView, got: %@", view);
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTUIWebView *> *viewRegistry) {
RCTUIWebView *view = viewRegistry[reactTag];
if (![view isKindOfClass:[RCTUIWebView class]]) {
RCTLogError(@"Invalid view returned from registry, expecting RCTUIWebView, got: %@", view);
} else {
[view reload];
}
@ -80,10 +80,10 @@ RCT_EXPORT_METHOD(reload:(nonnull NSNumber *)reactTag)
RCT_EXPORT_METHOD(stopLoading:(nonnull NSNumber *)reactTag)
{
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCWebView *> *viewRegistry) {
RNCWebView *view = viewRegistry[reactTag];
if (![view isKindOfClass:[RNCWebView class]]) {
RCTLogError(@"Invalid view returned from registry, expecting RNCWebView, got: %@", view);
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTUIWebView *> *viewRegistry) {
RCTUIWebView *view = viewRegistry[reactTag];
if (![view isKindOfClass:[RCTUIWebView class]]) {
RCTLogError(@"Invalid view returned from registry, expecting RCTUIWebView, got: %@", view);
} else {
[view stopLoading];
}
@ -92,10 +92,10 @@ RCT_EXPORT_METHOD(stopLoading:(nonnull NSNumber *)reactTag)
RCT_EXPORT_METHOD(postMessage:(nonnull NSNumber *)reactTag message:(NSString *)message)
{
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCWebView *> *viewRegistry) {
RNCWebView *view = viewRegistry[reactTag];
if (![view isKindOfClass:[RNCWebView class]]) {
RCTLogError(@"Invalid view returned from registry, expecting RNCWebView, got: %@", view);
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTUIWebView *> *viewRegistry) {
RCTUIWebView *view = viewRegistry[reactTag];
if (![view isKindOfClass:[RCTUIWebView class]]) {
RCTLogError(@"Invalid view returned from registry, expecting RCTUIWebView, got: %@", view);
} else {
[view postMessage:message];
}
@ -104,10 +104,10 @@ RCT_EXPORT_METHOD(postMessage:(nonnull NSNumber *)reactTag message:(NSString *)m
RCT_EXPORT_METHOD(injectJavaScript:(nonnull NSNumber *)reactTag script:(NSString *)script)
{
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCWebView *> *viewRegistry) {
RNCWebView *view = viewRegistry[reactTag];
if (![view isKindOfClass:[RNCWebView class]]) {
RCTLogError(@"Invalid view returned from registry, expecting RNCWebView, got: %@", view);
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTUIWebView *> *viewRegistry) {
RCTUIWebView *view = viewRegistry[reactTag];
if (![view isKindOfClass:[RCTUIWebView class]]) {
RCTLogError(@"Invalid view returned from registry, expecting RCTUIWebView, got: %@", view);
} else {
[view injectJavaScript:script];
}
@ -116,7 +116,7 @@ RCT_EXPORT_METHOD(injectJavaScript:(nonnull NSNumber *)reactTag script:(NSString
#pragma mark - Exported synchronous methods
- (BOOL)webView:(__unused RNCWebView *)webView
- (BOOL)webView:(__unused RCTUIWebView *)webView
shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
withCallback:(RCTDirectEventBlock)callback
{

View File

@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
E914DBF6214474710071092B /* RCTUIWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E914DBF3214474710071092B /* RCTUIWebViewManager.m */; };
E914DBF7214474710071092B /* RCTUIWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = E914DBF4214474710071092B /* RCTUIWebView.m */; };
E91B351D21446E6C00F9801F /* RCTWKWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E91B351B21446E6C00F9801F /* RCTWKWebViewManager.m */; };
E91B351E21446E6C00F9801F /* RCTWKWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = E91B351C21446E6C00F9801F /* RCTWKWebView.m */; };
/* End PBXBuildFile section */
@ -25,6 +27,10 @@
/* Begin PBXFileReference section */
134814201AA4EA6300B7C361 /* libRCTWebView.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTWebView.a; sourceTree = BUILT_PRODUCTS_DIR; };
E914DBF2214474710071092B /* RCTUIWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUIWebView.h; sourceTree = "<group>"; };
E914DBF3214474710071092B /* RCTUIWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIWebViewManager.m; sourceTree = "<group>"; };
E914DBF4214474710071092B /* RCTUIWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIWebView.m; sourceTree = "<group>"; };
E914DBF5214474710071092B /* RCTUIWebViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUIWebViewManager.h; sourceTree = "<group>"; };
E91B351921446E6C00F9801F /* RCTWKWebViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWKWebViewManager.h; sourceTree = "<group>"; };
E91B351A21446E6C00F9801F /* RCTWKWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWKWebView.h; sourceTree = "<group>"; };
E91B351B21446E6C00F9801F /* RCTWKWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWKWebViewManager.m; sourceTree = "<group>"; };
@ -53,6 +59,10 @@
58B511D21A9E6C8500147676 = {
isa = PBXGroup;
children = (
E914DBF2214474710071092B /* RCTUIWebView.h */,
E914DBF4214474710071092B /* RCTUIWebView.m */,
E914DBF5214474710071092B /* RCTUIWebViewManager.h */,
E914DBF3214474710071092B /* RCTUIWebViewManager.m */,
E91B351A21446E6C00F9801F /* RCTWKWebView.h */,
E91B351C21446E6C00F9801F /* RCTWKWebView.m */,
E91B351921446E6C00F9801F /* RCTWKWebViewManager.h */,
@ -118,6 +128,8 @@
buildActionMask = 2147483647;
files = (
E91B351D21446E6C00F9801F /* RCTWKWebViewManager.m in Sources */,
E914DBF7214474710071092B /* RCTUIWebView.m in Sources */,
E914DBF6214474710071092B /* RCTUIWebViewManager.m in Sources */,
E91B351E21446E6C00F9801F /* RCTWKWebView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -1,265 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
E91B3466214383EF00F9801F /* RCTWKWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E91B3464214383EF00F9801F /* RCTWKWebViewManager.m */; };
E91B3467214383EF00F9801F /* RCTWKWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = E91B3465214383EF00F9801F /* RCTWKWebView.m */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
58B511D91A9E6C8500147676 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "include/$(PRODUCT_NAME)";
dstSubfolderSpec = 16;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
134814201AA4EA6300B7C361 /* libRCTWKWebView.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTWKWebView.a; sourceTree = BUILT_PRODUCTS_DIR; };
E91B3462214383EF00F9801F /* RCTWKWebViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWKWebViewManager.h; sourceTree = "<group>"; };
E91B3463214383EF00F9801F /* RCTWKWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWKWebView.h; sourceTree = "<group>"; };
E91B3464214383EF00F9801F /* RCTWKWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWKWebViewManager.m; sourceTree = "<group>"; };
E91B3465214383EF00F9801F /* RCTWKWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWKWebView.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
58B511D81A9E6C8500147676 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
134814211AA4EA7D00B7C361 /* Products */ = {
isa = PBXGroup;
children = (
134814201AA4EA6300B7C361 /* libRCTWKWebView.a */,
);
name = Products;
sourceTree = "<group>";
};
58B511D21A9E6C8500147676 = {
isa = PBXGroup;
children = (
E91B3463214383EF00F9801F /* RCTWKWebView.h */,
E91B3465214383EF00F9801F /* RCTWKWebView.m */,
E91B3462214383EF00F9801F /* RCTWKWebViewManager.h */,
E91B3464214383EF00F9801F /* RCTWKWebViewManager.m */,
134814211AA4EA7D00B7C361 /* Products */,
);
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
58B511DA1A9E6C8500147676 /* RCTWKWebView */ = {
isa = PBXNativeTarget;
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTWKWebView" */;
buildPhases = (
58B511D71A9E6C8500147676 /* Sources */,
58B511D81A9E6C8500147676 /* Frameworks */,
58B511D91A9E6C8500147676 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = RCTWKWebView;
productName = RCTDataManager;
productReference = 134814201AA4EA6300B7C361 /* libRCTWKWebView.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
58B511D31A9E6C8500147676 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0830;
ORGANIZATIONNAME = Facebook;
TargetAttributes = {
58B511DA1A9E6C8500147676 = {
CreatedOnToolsVersion = 6.1.1;
};
};
};
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTWKWebView" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 58B511D21A9E6C8500147676;
productRefGroup = 58B511D21A9E6C8500147676;
projectDirPath = "";
projectRoot = "";
targets = (
58B511DA1A9E6C8500147676 /* RCTWKWebView */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
58B511D71A9E6C8500147676 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E91B3466214383EF00F9801F /* RCTWKWebViewManager.m in Sources */,
E91B3467214383EF00F9801F /* RCTWKWebView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
58B511ED1A9E6C8500147676 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
58B511EE1A9E6C8500147676 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
58B511F01A9E6C8500147676 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../../React/**",
"$(SRCROOT)/../../react-native/React/**",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTWKWebView;
SKIP_INSTALL = YES;
};
name = Debug;
};
58B511F11A9E6C8500147676 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../../React/**",
"$(SRCROOT)/../../react-native/React/**",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTWKWebView;
SKIP_INSTALL = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTWKWebView" */ = {
isa = XCConfigurationList;
buildConfigurations = (
58B511ED1A9E6C8500147676 /* Debug */,
58B511EE1A9E6C8500147676 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTWKWebView" */ = {
isa = XCConfigurationList;
buildConfigurations = (
58B511F01A9E6C8500147676 /* Debug */,
58B511F11A9E6C8500147676 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 58B511D31A9E6C8500147676 /* Project object */;
}

View File

@ -1,9 +0,0 @@
// !$*UTF8*$!
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:RCTWKWebView.xcodeproj">
</FileRef>
</Workspace>

View File

@ -1,24 +0,0 @@
Pod::Spec.new do |s|
s.name = "RNCWebView"
s.version = "1.0.0"
s.summary = "RNCWebView"
s.description = <<-DESC
RNCWebView
DESC
s.homepage = ""
s.license = "MIT"
# s.license = { :type => "MIT", :file => "FILE_LICENSE" }
s.author = { "author" => "author@domain.cn" }
s.platform = :ios, "7.0"
s.source = { :git => "https://github.com/author/RNCWebView.git", :tag => "master" }
s.source_files = "RNCWebView/**/*.{h,m}"
s.requires_arc = true
s.dependency "React"
#s.dependency "others"
end

View File

@ -1,5 +0,0 @@
#import <React/RCTViewManager.h>
@interface RNCWebViewManager : RCTViewManager
@end

View File

@ -42,7 +42,7 @@ function processDecelerationRate(decelerationRate) {
return decelerationRate;
}
const RCTWebViewManager = NativeModules.WKWebViewManager;
const RCTUIWebViewManager = NativeModules.UIWebViewManager;
const RCTWKWebViewManager = NativeModules.WKWebViewManager;
const BGWASH = 'rgba(255,255,255,0.8)';
@ -193,7 +193,7 @@ class WebView extends React.Component {
if (this.props.useWebKit) {
viewManager = viewManager || RCTWKWebViewManager;
} else {
viewManager = viewManager || RCTWebViewManager;
viewManager = viewManager || RCTUIWebViewManager;
}
const compiledWhitelist = [