Empty view above loading content
See original GitHub issueBug 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:
Environment:
- OS: macOS Mojave
- OS version: 10.14.5
- react-native version: 59.9
- react-native-webview version: 5.12.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:5
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
I just bumped into this, and fixed by adding the same style as
styles.loadingOrErrorView
to the loading component container, in particular: