Norlihazmey Ghazali Norlihazmey Ghazali - 2 years ago 85
Android Question

Webview not showing any content(html) react native

Contents did showing up perfectly inside emulator and debug with real device but does not showing anything when testing out with real device (using released .apk). It just only showed blank container with white color. Or do i missed something?

ref={(wView) => {this.wView = wView}}
// onBridgeMessage={this.onBridgeMessage}
injectedJavaScript="window.postMessage = String(Object.hasOwnProperty).replace('hasOwnProperty', 'postMessage');"
source={mainHtml} <-- load with, var mainHtml = require('./MainHtml.html');
style={{width: 320,height:100,flex: 1}}/>


  • react-native-cli: 2.0.1

  • react-native: 0.43.4

  • react: 16.0.0-alpha.6

  • Device(ASUS Zenfone)

  • Android version 6.0.1

Answer Source

From what I've read here this is a known issue with Android when deploying in Release. The workaround is to point to the file with a uri:

{ uri: 'file:///pathto/file.html' }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download