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.

WebView with inline HTML not working

See original GitHub issue

Environment

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
      Memory: 871.64 MB / 16.00 GB
      Shell: 2.7.1 - /usr/local/bin/fish
    Binaries:
      Node: 8.11.3 - /usr/local/opt/node@8/bin/node
      Yarn: 1.9.2 - /usr/local/bin/yarn
      npm: 5.6.0 - /usr/local/opt/node@8/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
      Android SDK:
        Build Tools: 23.0.1, 25.0.0, 25.0.3, 26.0.1, 26.0.3
        API Levels: 23, 25, 26
    IDEs:
      Android Studio: 3.1 AI-173.4819257
      Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
    npmPackages:
      react: ^16.4.1 => 16.4.1
      react-native: ^0.56.0 => 0.56.0
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7

Description

WebView not working any more as expected when used with inline HTML. The regression was introduced in commit 634e7e11e3ad39e0b13bf20cc7722c0cfd3c3e28 by @mmmulani with the commit message:

iOS only: Breaking Change: Restrict WebView to only http(s) URLs

Summary: To prevent people from linking file:// or other URLs inside RN WebViews, default <WebView> to not allowing those types of URLs. This adds the originWhitelist to specify other schemes or domains to be allowed. If the url is not allowed, it will be opened in Safari/by the OS instead.

This is not well documented in CHANGELOG which leads to unexpected breaking behavior. It is also not described as an iOS specific change.

What was the rationale behind the breaking change?

This issue is related to #19986.

Reproducible Demo

See #19986’s Reproducible Demo.

Workaround

Adding originWhitelist wildcard as in #19986’s comment.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hramoscommented, Jul 31, 2018

It’s the one linked to under “Start a Discussion” when you open a new issue at https://github.com/facebook/react-native/issues/new/choose

screen shot 2018-07-31 at 4 00 19 pm

0reactions
rodrigobdzcommented, Aug 1, 2018

Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inline HTML not working · Issue #1388 · react-native-webview ...
Bug description: Nothing rendered To Reproduce: import React, {Component} from 'react'; import { StyleSheet, Text, ...
Read more >
Loading inline CSS in Android Webview problem
I am developing an androind webview based application - the HTML, CSS and Javascript is built dynamically - I have done this before...
Read more >
How to add inline HTML in Webview Flutter - Medium
Now I have dart file named: Webview. dart. # The following adds the Cupertino Icons font to your application.
Read more >
Webview API - Visual Studio Code
Webview API. The webview API allows extensions to create fully customizable views within Visual Studio Code. For example, the built-in Markdown extension ...
Read more >
How to use WebView in React Native - Educative.io
A WebView is an embedded browser that can be used to display web pages inside your React Native applications. It can display anything...
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