Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webview postMessage slow in Release/Production build #18506

Closed
2 of 3 tasks
Karasynth opened this issue Mar 22, 2018 · 7 comments
Closed
2 of 3 tasks

Webview postMessage slow in Release/Production build #18506

Karasynth opened this issue Mar 22, 2018 · 7 comments
Labels
Component: WebView Related to the WebView component. Resolution: Locked This issue was locked by the bot.

Comments

@Karasynth
Copy link

Karasynth commented Mar 22, 2018

I'm using a webview to send click events back to react-native. When building for debug, the time to receive the message is quick ( 0.5 seconds), but when building for release/production the time is ~ 5 seconds in the simulator and ~10 seconds on device. I have also tried using react-native-wkwebview-reborn with the same result.

Environment

OS: OS X El Capitan 10.11.6
Node: 6.4.0
Yarn: Not Found
npm: 3.10.3
Watchman: 4.6.0
Xcode: Xcode 8.0 Build version 8A218a
Android Studio: 2.1 AI-143.3101438

Packages: (wanted => installed)
react: 16.0.0 => 16.0.0
react-native: ^0.51.0 => 0.51.0

Steps to Reproduce

index.html

<script>
    function sendMessage(){
        window.postMessage('{"key":' + 1 +'}')
    }
</script>
<body>
    <button onclick='sendMessage()'>
        Send 
    </button>
</body>

index.js

onWebViewMessage(event) {
    console.log("Message received from webview", event);
  }
....
<WebView
            ref={webview => {
              this.myWebView = webview;
            }}
            scrollEnabled={true}
            source={require("./index.html")}
            onMessage={this.onWebViewMessage}
            style={{flex: 1}}
   />

Expected Behavior

Similar performance and speed to debug.

Actual Behavior

Much slower.

@react-native-bot
Copy link
Collaborator

Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest release, v0.54?

Thank you for your contributions.

@react-native-bot react-native-bot added ⏪Old Version Component: WebView Related to the WebView component. labels Mar 22, 2018
@Karasynth
Copy link
Author

Karasynth commented Mar 22, 2018

I haven't had the chance to update to Sierra/XCode9, running into the same issue here when building: #18238

Could someone try to reproduce in 0.54?

Edit: Got it running in 0.53, same behaviour though.

@bestsamcn

This comment has been minimized.

@sambernaerdt

This comment has been minimized.

@hramos
Copy link
Contributor

hramos commented Jun 15, 2018

Closing as author did not respond to followup.

@hramos hramos closed this as completed Jun 15, 2018
@miraan
Copy link

miraan commented Jun 18, 2018

@sambernaerdt Interesting, was the logging on the React Native side, or from inside the WebView?

@staroflead
Copy link

@sambernaerdt thanks for the hint, I have remove the logging and it's no longer delay

@facebook facebook locked as resolved and limited conversation to collaborators Jun 15, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jun 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Component: WebView Related to the WebView component. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

7 participants