Browse Source

fix(android:scalesPageToFit): scalesPageToFit does not work as intended , especially for large jpg and png images. (#275)

fixes #113

- One can verify that this for jpg images loaded on the webview (eg: https://www.ecda.gov.sg/growatbeanstalk/PublishingImages/READ%20Publications%20and%20Research/Parent%20Infographic%20Series/Infographic%204.jpg)
- This is a replication of the pull request that was originally made in the react-native repo (https://github.com/facebook/react-native/pull/17195), but was not merged in due to no reviews.
Benjos Antony 5 years ago
parent
commit
a661df1ffc

+ 2
- 1
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java View File

@@ -562,7 +562,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
562 562
 
563 563
   @ReactProp(name = "scalesPageToFit")
564 564
   public void setScalesPageToFit(WebView view, boolean enabled) {
565
-    view.getSettings().setUseWideViewPort(!enabled);
565
+    view.getSettings().setLoadWithOverviewMode(enabled);
566
+    view.getSettings().setUseWideViewPort(enabled);
566 567
   }
567 568
 
568 569
   @ReactProp(name = "domStorageEnabled")