Skip to content

Commit

Permalink
Merge pull request CRAlpha#225 from indapublic/patch/issue-222/get-vi…
Browse files Browse the repository at this point in the history
…ew-manager-config

Fixed warning UIManager['CRAWKWebView'] is no longer supported
  • Loading branch information
insraq authored Feb 27, 2019
2 parents bf0c8ed + 1f9962c commit 365a24e
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions WKWebView.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ class WKWebView extends React.Component {
goForward = () => {
UIManager.dispatchViewManagerCommand(
this.getWebViewHandle(),
UIManager.CRAWKWebView.Commands.goForward,
this.getCRAWKWebView().Commands.goForward,
null
);
};
Expand All @@ -396,7 +396,7 @@ class WKWebView extends React.Component {
goBack = () => {
UIManager.dispatchViewManagerCommand(
this.getWebViewHandle(),
UIManager.CRAWKWebView.Commands.goBack,
this.getCRAWKWebView().Commands.goBack,
null
);
};
Expand All @@ -422,7 +422,7 @@ class WKWebView extends React.Component {
this.setState({ viewState: WebViewState.LOADING });
UIManager.dispatchViewManagerCommand(
this.getWebViewHandle(),
UIManager.CRAWKWebView.Commands.reload,
this.getCRAWKWebView().Commands.reload,
null
);
};
Expand All @@ -433,7 +433,7 @@ class WKWebView extends React.Component {
stopLoading = () => {
UIManager.dispatchViewManagerCommand(
this.getWebViewHandle(),
UIManager.CRAWKWebView.Commands.stopLoading,
this.getCRAWKWebView().Commands.stopLoading,
null
)
};
Expand All @@ -451,7 +451,7 @@ class WKWebView extends React.Component {
postMessage = (data) => {
UIManager.dispatchViewManagerCommand(
this.getWebViewHandle(),
UIManager.CRAWKWebView.Commands.postMessage,
this.getCRAWKWebView().Commands.postMessage,
[String(data)]
);
};
Expand All @@ -470,6 +470,14 @@ class WKWebView extends React.Component {
}
};

getCRAWKWebView = () => {
return (
UIManager.getViewManagerConfig ?
UIManager.getViewManagerConfig('CRAWKWebView') :
UIManager.CRAWKWebView
);
};

/**
* Returns the native webview node.
*/
Expand Down

0 comments on commit 365a24e

Please sign in to comment.