fix(iOS/android getViewManagerConfig): Fix crash with react-native < 0.58

This commit is contained in:
Thibault Malbranche
2019-02-05 15:50:40 +01:00
parent a4c6f210cf
commit 263fc5ec3c
2 changed files with 17 additions and 3 deletions
+8 -1
View File
@@ -194,7 +194,14 @@ class WebView extends React.Component<WebViewSharedProps, State> {
); );
} }
getCommands = () => UIManager.getViewManagerConfig('RNCWebView').Commands; getViewManagerConfig = viewManagerName => {
if (!UIManager.getViewManagerConfig) {
return UIManager[viewManagerName];
}
return UIManager.getViewManagerConfig(viewManagerName);
};
getCommands = () => this.getViewManagerConfig('RNCWebView').Commands;
goForward = () => { goForward = () => {
UIManager.dispatchViewManagerCommand( UIManager.dispatchViewManagerCommand(
+9 -2
View File
@@ -296,10 +296,17 @@ class WebView extends React.Component<WebViewSharedProps, State> {
); );
} }
_getViewManagerConfig = viewManagerName => {
if (!UIManager.getViewManagerConfig) {
return UIManager[viewManagerName];
}
return UIManager.getViewManagerConfig(viewManagerName);
};
_getCommands = () => _getCommands = () =>
!this.props.useWebKit !this.props.useWebKit
? UIManager.getViewManagerConfig('RNCUIWebView').Commands ? this._getViewManagerConfig('RNCUIWebView').Commands
: UIManager.getViewManagerConfig('RNCWKWebView').Commands; : this._getViewManagerConfig('RNCWKWebView').Commands;
/** /**
* Go forward one page in the web view's history. * Go forward one page in the web view's history.