React-native: webview release source={require(xxx.html)} not work

Created on 4 Jun 2016  Â·  23Comments  Â·  Source: facebook/react-native

  • [ ] Provide a minimal code snippet / rnplay example that reproduces the bug.

<WebView source={require('./helloworld.html')} />

ios release/debug is OK, android debug is OK too, only broken on android release versions, is blank page, nothing rendered.

  • [0.27.rc1] What's the version of React Native you're using?
    0.27.rc1
  • [android] Does this occur on iOS, Android or both?
    android release
  • [mac] Are you using Mac, Linux or Windows?
    mac
iOS Locked

Most helpful comment

this works as for me!!!

All 23 comments

@facebook-github-bot label Android

@facebook-github-bot label Android

I'm having the same issue with 0.26.3. Any known workarounds?

The same issue with 0.27.2

How to solve?

happens on android release build, seems to be working on emulator. the url somehow points to http://localhost:8081/on debug build.

same here 0.37 - onload event is fired but only white page is shown. what's funny that I could not "reuired" html between apk assets but maybe it is hidden somewhere else.

same here 0.39.2, When I release andorid apk, webview can not load html by require('./index.html') , but ios work well.
How to fix this? someone has any idea?

Facing same issue 0.38.1. Please tell how to solve or some workaround for webViewBridge?

SameProblem.

You might wanna check this solution.

https://github.com/facebook/react-native/issues/505#issuecomment-244463151

Still seeing this with 0.42

this works as a workaround for me: https://github.com/facebook/react-native/issues/505#issuecomment-218480163

I'm running into this issue on 0.44 as well.

HTML files still not being packaged in Android release on React Native 0.45.1

When will this be fixed? This is really annoying..

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

@hramos Please reopen this issue, its behaviour is different between ios and android release version

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 6.10.3
Yarn: 0.24.5
npm: 3.10.10
Watchman: 4.7.0
Xcode: Xcode 9.0 Build version 9A235
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react: 16.0.0-alpha.12 => 16.0.0-alpha.12
react-native: 0.48.4 => 0.48.4

Steps to Reproduce

(Write your steps here:)

  1. create index.html
<html>
    <head>
        <title>Title</title>
    </head>
    <body>
        <h1>Hello World</h1>
    </body>
</html>
  1. modify index.ios.js and index.android.js
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  WebView,
  View
} from 'react-native';

export default class WebViewTest extends Component {
  render() {
    return (
      <View style={styles.container}>
        <WebView
          scalesPageToFit={true}
          source={require('WebViewTest/index.html')}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
});

AppRegistry.registerComponent('WebViewTest', () => WebViewTest);
  1. Build Release APK
  2. Run On Android

Expected Behavior

Hello World show up on screen.

Actual Behavior

Nothing.
Just Blank Screen

Reproducible Demo

https://github.com/yosimasu/WebViewTest

I create new issue

this works as for me!!!

@HHuiHao Great
This works. You just need write a simple shell script to cpoy you html files to android assets.

16133

just ckeckout my answer it worked for me
i used ckeditor

Was this page helpful?
0 / 5 - 0 ratings