Hook the onMessage event only when needed (#2271)

This commit is contained in:
Elias Nahum 2018-10-18 12:11:48 -03:00
parent 773590b83d
commit 8a72af7969
No known key found for this signature in database
GPG key ID: E038DB71E0B61702

View file

@ -161,6 +161,10 @@ class SSO extends PureComponent {
if (parsed.host.includes('.onelogin.com')) {
nextState.jsCode = oneLoginFormScalingJS;
} else if (parsed.host.includes(this.completedUrl)) {
this.webView.setNativeProps({
onMessage: this.onMessage,
});
}
if (Object.keys(nextState).length) {
@ -233,7 +237,6 @@ class SSO extends PureComponent {
onNavigationStateChange={this.onNavigationStateChange}
onShouldStartLoadWithRequest={() => true}
renderLoading={this.renderLoading}
onMessage={this.onMessage}
injectedJavaScript={jsCode}
onLoadEnd={this.onLoadEnd}
useWebKit={true}