question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Empty view above loading content

See original GitHub issue

Bug description: After upgrading RN version to 59.9 we switched from the RN web views to this community package, and all web views within both iOS and android app have a view appearing above the loading screen briefly that is completely white, this view can be flexed smaller (try changing the flex: 1 to flex: 10 in below code).

To Reproduce: Create a fresh react-native init project,

packages.json

{
  "name": "WebViewTester",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.8.3",
    "react-native": "0.59.9",
    "react-native-webview": "^5.6.0"
  },
  "devDependencies": {
    "@babel/core": "7.4.5",
    "@babel/runtime": "7.4.5",
    "babel-jest": "24.8.0",
    "jest": "24.8.0",
    "metro-react-native-babel-preset": "0.54.1",
    "react-test-renderer": "16.8.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

App.js

import React, { Component } from "react";
import { Text, View } from "react-native";
import WebView from "react-native-webview";
export default class App extends Component {
    render() {
        return (
            <WebView
                source={{
                    uri: "https://www.facebook.com"
                }}
                startInLoadingState={true}
                bounces={false}
                renderLoading={() => {
                    return (
                        <View
                            style={{
                                flex: 1,
                                backgroundColor: "#00ff00",
                                justifyContent: "center",
                                alignContent: "center"
                            }}
                        >
                            <Text style={{}}>Loading...</Text>
                        </View>
                    );
                }}
            />
        );
    }
}

npm install and react-native link the project

Expected behavior: Navigate to facebook.com with a green loading screen filling entire screen with flex

Screenshots/Videos: Simulator Screen Shot - iPhone X - 2019-06-26 at 17 47 32

Environment:

  • OS: macOS Mojave
  • OS version: 10.14.5
  • react-native version: 59.9
  • react-native-webview version: 5.12.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:5

github_iconTop GitHub Comments

4reactions
filippoitalianocommented, Jul 8, 2019

The component used in renderLoading is designed to be positioned is absolute way. This is the style used in the default loading view: https://github.com/react-native-community/react-native-webview/blob/master/src/WebView.styles.ts#L17.

2reactions
dapicestercommented, Oct 9, 2019

I just bumped into this, and fixed by adding the same style as styles.loadingOrErrorView to the loading component container, in particular:

position: 'absolute',
height: '100%',
width: '100%',
Read more comments on GitHub >

github_iconTop Results From Across the Web

Empty view above loading content · Issue #684 · react-native ...
Bug description: After upgrading RN version to 59.9 we switched from the RN web views to this community package, and all web views...
Read more >
ListView with empty view and a loading view - Stack Overflow
I'm trying to have a design where the loading is centered in the middle of the listview. Not on top or bottom. Footer...
Read more >
Recycler view with Empty View, Loading View and Error View
A simple linear layout with a ImageView and TextView indicating a empty content. Here is how it looks. empty layout.
Read more >
The art of creating a good empty view - UX Collective
An empty view is a state in your product that provides no data for the user to consume or interact with. Users can...
Read more >
An MVC Approach to Loading, Error and Empty View Controllers
I like approaching this type of problem by making as few changes as possible to the UIViewController displaying the content. It's already really ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found