Просмотр исходного кода

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 6 лет назад
Родитель
Сommit
a661df1ffc
1 измененных файлов: 2 добавлений и 1 удалений
  1. 2
    1
      android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java

+ 2
- 1
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java Просмотреть файл

562
 
562
 
563
   @ReactProp(name = "scalesPageToFit")
563
   @ReactProp(name = "scalesPageToFit")
564
   public void setScalesPageToFit(WebView view, boolean enabled) {
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
   @ReactProp(name = "domStorageEnabled")
569
   @ReactProp(name = "domStorageEnabled")