From 59d9f8ca5eb96b4b455b60ed170dfb05bc9c7251 Mon Sep 17 00:00:00 2001 From: Karl Tarvas Date: Tue, 3 Oct 2017 18:30:21 -0700 Subject: [PATCH] Fix Android 4.1-4.3 WebView source baseUrl bug Summary: Resolves https://github.com/facebook/react-native/issues/11753 and https://github.com/facebook/react-native/issues/9835. Android versions 4.1-4.3 don't understand the MIME type `text/html; charset=utf-8` and default to `text/plain` instead, rendering the content as an unparsed HTML string. Since the encoding is already set and passed separately, removing it from the MIME type has no negative effects. The same fix has already been discussed, successfully tested and incorporated in https://github.com/NativeScript/NativeScript/issues/1038. Closes https://github.com/facebook/react-native/pull/13789 Differential Revision: D5971910 Pulled By: shergin fbshipit-source-id: 07795bdf0f13ddb1e8eec779d1cad59244f3687e --- .../com/facebook/react/views/webview/ReactWebViewManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java index 3377bda0d6fa4d..557aff02bf5c01 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java @@ -89,7 +89,7 @@ public class ReactWebViewManager extends SimpleViewManager { protected static final String REACT_CLASS = "RCTWebView"; protected static final String HTML_ENCODING = "UTF-8"; - protected static final String HTML_MIME_TYPE = "text/html; charset=utf-8"; + protected static final String HTML_MIME_TYPE = "text/html"; protected static final String BRIDGE_NAME = "__REACT_WEB_VIEW_BRIDGE"; protected static final String HTTP_METHOD_POST = "POST";