Implement Android's dispatchViewManagerCommand interface on iOS

Summary:
public
Android implement ViewManager methods via a dispatch method on UIManager, whereas iOS implements them by exposing the methods on the view manager modules directly.

This diff polyfills Android's implementation on top of the iOS implementation, allowing the same JS API to be used for both.

Reviewed By: javache

Differential Revision: D2803020

fb-gh-sync-id: 0da0544e593dc936467d16ce957a77f7ca41355b
This commit is contained in:
Nick Lockwood
2016-01-06 05:57:25 -08:00
committed by facebook-github-bot-7
parent 28c0240361
commit 17df595e32
6 changed files with 73 additions and 10 deletions

View File

@@ -16,6 +16,7 @@ var EdgeInsetsPropType = require('EdgeInsetsPropType');
var React = require('React');
var StyleSheet = require('StyleSheet');
var Text = require('Text');
var UIManager = require('UIManager');
var View = require('View');
var invariant = require('invariant');
@@ -240,15 +241,27 @@ var WebView = React.createClass({
},
goForward: function() {
RCTWebViewManager.goForward(this.getWebViewHandle());
UIManager.dispatchViewManagerCommand(
this.getWebViewHandle(),
UIManager.RCTWebView.Commands.goForward,
null
);
},
goBack: function() {
RCTWebViewManager.goBack(this.getWebViewHandle());
UIManager.dispatchViewManagerCommand(
this.getWebViewHandle(),
UIManager.RCTWebView.Commands.goBack,
null
);
},
reload: function() {
RCTWebViewManager.reload(this.getWebViewHandle());
UIManager.dispatchViewManagerCommand(
this.getWebViewHandle(),
UIManager.RCTWebView.Commands.reload,
null
);
},
/**