From 8a72af796963d17bd8059ca5bbb35a01da53b319 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Thu, 18 Oct 2018 12:11:48 -0300 Subject: [PATCH] Hook the onMessage event only when needed (#2271) --- app/screens/sso/sso.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/screens/sso/sso.js b/app/screens/sso/sso.js index ff01538e7..240e3c43c 100644 --- a/app/screens/sso/sso.js +++ b/app/screens/sso/sso.js @@ -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}