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.

Load WebView on initial render

See original GitHub issue

Bug description: I’m trying to preload my WebView in a tab using React Navigations Bottom Tabs Navigator and the prop lazy set to false so that the screen is loaded on initial render.

Unfortunately while the screen renders the actual WebView component does not until the tab is active, this appears to only affect iOS.

To Reproduce: Set lazy: false to screenOptions prop of Tab.navigator or options prop of Tab.Screen and render WebView as a component on the screen.

Expected behavior: WebView component should be loaded on initial render.

Environment:

  • OS: iOS
  • OS version: 15.4
  • react-native version: 0.67.4
  • react-native-webview version: 11.17.2

If there are other known working solutions to preload WebView please let me know.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:12

github_iconTop GitHub Comments

6reactions
walterholohancommented, Apr 4, 2022

We are experiencing the same issue on our React Native App which is causing a terrible user experience. When a user switches to a tab using the bottom tab bar there have to wait nearly 5 seconds for the Webview to load. If the above issue was fixed it would be amazing as the Webview would already be loaded when the user lands on that tab.

3reactions
yunjeonglopercommented, Apr 13, 2022

+1

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to start loading a WebView after the view is rendered?
The first WebView works fine, but by the time the subsequent WebViews are displayed, their animations are already completed since they have ...
Read more >
WebView
WebView renders web content in a native view. ... Boolean value that forces the WebView to show the loading view on the first...
Read more >
React Native WebView - Loading Websites and HTML in ...
First, we learned how to render simple HTML content using the WebView component. Then, we got a detailed explanation of how to use...
Read more >
Suggestions for WebView pre-loading and pre-rendering
One thing we're looking at is pre-loading WebView HTML/JS/resources. This can be done either in the native code side with shouldInterceptRequest injections ...
Read more >
Reset React Native WebView to initial url | by Andrei Pfeiffer
However, that doesn't help, because it reloads the current page, not the one that was loaded initially. Solution #2: Forcing a re-render. What ......
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