Skip to content

Commit

Permalink
Rename existing webview components
Browse files Browse the repository at this point in the history
  • Loading branch information
Intellicode committed Jun 22, 2015
1 parent 5eed445 commit 0f5d906
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 31 deletions.
9 changes: 4 additions & 5 deletions WebView.ios.js → BridgeableWebView.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ var keyMirror = require('keyMirror');
var requireNativeComponent = require('requireNativeComponent');

var PropTypes = React.PropTypes;
var RCTWebViewManager = require('NativeModules').WebViewManager;

var RCTWebViewManager = require('NativeModules').RNBridgeableWebViewManager;
var BGWASH = 'rgba(255,255,255,0.8)';
var RCT_WEBVIEW_REF = 'webview';

Expand Down Expand Up @@ -130,7 +129,7 @@ var WebView = React.createClass({
);
} else if (this.state.viewState !== WebViewState.IDLE) {
console.error(
'RCTWebView invalid state encountered: ' + this.state.loading
'RNBridgeableWebView invalid state encountered: ' + this.state.loading
);
}

Expand All @@ -142,7 +141,7 @@ var WebView = React.createClass({
}

var webView =
<RCTWebView
<RNBridgeableWebView
ref={RCT_WEBVIEW_REF}
key="webViewKey"
style={webViewStyles}
Expand Down Expand Up @@ -221,7 +220,7 @@ var WebView = React.createClass({
}
});

var RCTWebView = requireNativeComponent('RCTWebView', WebView);
var RNBridgeableWebView = requireNativeComponent('RNBridgeableWebView', WebView);

var styles = StyleSheet.create({
container: {
Expand Down
2 changes: 1 addition & 1 deletion RCTWebView.h → RNBridgeableWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

@class RCTEventDispatcher;

@interface RCTWebView : RCTView
@interface RNBridgeableWebView : RCTView

@property (nonatomic, strong) NSURL *URL;
@property (nonatomic, assign) UIEdgeInsets contentInset;
Expand Down
6 changes: 3 additions & 3 deletions RCTWebView.m → RNBridgeableWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

#import "RCTWebView.h"
#import "RNBridgeableWebView.h"

#import <UIKit/UIKit.h>

Expand All @@ -18,11 +18,11 @@
#import "RCTView.h"
#import "UIView+React.h"

@interface RCTWebView () <UIWebViewDelegate, RCTAutoInsetsProtocol>
@interface RNBridgeableWebView () <UIWebViewDelegate, RCTAutoInsetsProtocol>

@end

@implementation RCTWebView
@implementation RNBridgeableWebView
{
RCTEventDispatcher *_eventDispatcher;
UIWebView *_webView;
Expand Down
2 changes: 1 addition & 1 deletion RCTWebViewManager.h → RNBridgeableWebViewManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#import "RCTViewManager.h"

@interface RCTWebViewManager : RCTViewManager
@interface RNBridgeableWebViewManager : RCTViewManager

@end
18 changes: 9 additions & 9 deletions RCTWebViewManager.m → RNBridgeableWebViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

#import "RCTWebViewManager.h"
#import "RNBridgeableWebViewManager.h"

#import "RCTBridge.h"
#import "RCTSparseArray.h"
#import "RCTUIManager.h"
#import "RCTWebView.h"
#import "RNBridgeableWebView.h"

@implementation RCTWebViewManager
@implementation RNBridgeableWebViewManager

RCT_EXPORT_MODULE()

- (UIView *)view
{
return [[RCTWebView alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
return [[RNBridgeableWebView alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
}

RCT_REMAP_VIEW_PROPERTY(url, URL, NSURL);
Expand Down Expand Up @@ -48,8 +48,8 @@ - (NSDictionary *)constantsToExport
RCT_EXPORT_METHOD(goBack:(NSNumber *)reactTag)
{
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, RCTSparseArray *viewRegistry) {
RCTWebView *view = viewRegistry[reactTag];
if (![view isKindOfClass:[RCTWebView class]]) {
RNBridgeableWebView *view = viewRegistry[reactTag];
if (![view isKindOfClass:[RNBridgeableWebView class]]) {
RCTLogError(@"Invalid view returned from registry, expecting RKWebView, got: %@", view);
}
[view goBack];
Expand All @@ -60,7 +60,7 @@ - (NSDictionary *)constantsToExport
{
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, RCTSparseArray *viewRegistry) {
id view = viewRegistry[reactTag];
if (![view isKindOfClass:[RCTWebView class]]) {
if (![view isKindOfClass:[RNBridgeableWebView class]]) {
RCTLogError(@"Invalid view returned from registry, expecting RKWebView, got: %@", view);
}
[view goForward];
Expand All @@ -71,8 +71,8 @@ - (NSDictionary *)constantsToExport
RCT_EXPORT_METHOD(reload:(NSNumber *)reactTag)
{
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, RCTSparseArray *viewRegistry) {
RCTWebView *view = viewRegistry[reactTag];
if (![view isKindOfClass:[RCTWebView class]]) {
RNBridgeableWebView *view = viewRegistry[reactTag];
if (![view isKindOfClass:[RNBridgeableWebView class]]) {
RCTLogMustFix(@"Invalid view returned from registry, expecting RKWebView, got: %@", view);
}
[view reload];
Expand Down
24 changes: 12 additions & 12 deletions RNBridgeableWebview.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
E29EA2601B374B2000EE4B2B /* RCTWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = E29EA25D1B374B2000EE4B2B /* RCTWebView.m */; };
E29EA2611B374B2000EE4B2B /* RCTWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E29EA25F1B374B2000EE4B2B /* RCTWebViewManager.m */; };
E29EA2601B374B2000EE4B2B /* RNBridgeableWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = E29EA25D1B374B2000EE4B2B /* RNBridgeableWebView.m */; };
E29EA2611B374B2000EE4B2B /* RNBridgeableWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E29EA25F1B374B2000EE4B2B /* RNBridgeableWebViewManager.m */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -25,10 +25,10 @@

/* Begin PBXFileReference section */
E29EA2361B33517A00EE4B2B /* libRNBridgeableWebview.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNBridgeableWebview.a; sourceTree = BUILT_PRODUCTS_DIR; };
E29EA25C1B374B2000EE4B2B /* RCTWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebView.h; sourceTree = "<group>"; };
E29EA25D1B374B2000EE4B2B /* RCTWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWebView.m; sourceTree = "<group>"; };
E29EA25E1B374B2000EE4B2B /* RCTWebViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebViewManager.h; sourceTree = "<group>"; };
E29EA25F1B374B2000EE4B2B /* RCTWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWebViewManager.m; sourceTree = "<group>"; };
E29EA25C1B374B2000EE4B2B /* RNBridgeableWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNBridgeableWebView.h; sourceTree = "<group>"; };
E29EA25D1B374B2000EE4B2B /* RNBridgeableWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNBridgeableWebView.m; sourceTree = "<group>"; };
E29EA25E1B374B2000EE4B2B /* RNBridgeableWebViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNBridgeableWebViewManager.h; sourceTree = "<group>"; };
E29EA25F1B374B2000EE4B2B /* RNBridgeableWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNBridgeableWebViewManager.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -45,10 +45,10 @@
E29EA22D1B33517A00EE4B2B = {
isa = PBXGroup;
children = (
E29EA25C1B374B2000EE4B2B /* RCTWebView.h */,
E29EA25D1B374B2000EE4B2B /* RCTWebView.m */,
E29EA25E1B374B2000EE4B2B /* RCTWebViewManager.h */,
E29EA25F1B374B2000EE4B2B /* RCTWebViewManager.m */,
E29EA25C1B374B2000EE4B2B /* RNBridgeableWebView.h */,
E29EA25D1B374B2000EE4B2B /* RNBridgeableWebView.m */,
E29EA25E1B374B2000EE4B2B /* RNBridgeableWebViewManager.h */,
E29EA25F1B374B2000EE4B2B /* RNBridgeableWebViewManager.m */,
E29EA2371B33517A00EE4B2B /* Products */,
);
sourceTree = "<group>";
Expand Down Expand Up @@ -117,8 +117,8 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E29EA2601B374B2000EE4B2B /* RCTWebView.m in Sources */,
E29EA2611B374B2000EE4B2B /* RCTWebViewManager.m in Sources */,
E29EA2601B374B2000EE4B2B /* RNBridgeableWebView.m in Sources */,
E29EA2611B374B2000EE4B2B /* RNBridgeableWebViewManager.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down

0 comments on commit 0f5d906

Please sign in to comment.