Manwei vor 7 Jahren
Ursprung
Commit
910edd6457

+ 1
- 1
README.md Datei anzeigen

@@ -42,7 +42,7 @@ Returns a Promise of the image URI.
42 42
     - `"base64"`: encode as base64 and returns the raw string. Use only with small images as this may result of lags (the string is sent over the bridge). *N.B. This is not a data uri, use `data-uri` instead*.
43 43
     - `"data-uri"`: same as `base64` but also includes the [Data URI scheme](https://en.wikipedia.org/wiki/Data_URI_scheme) header.
44 44
  - **`filename`** *(string)*: the name of the generated file if any (Android only). Defaults to `ReactNative_snapshot_image_${timestamp}`.
45
- - **`isScrollView`** *(bool)*: View is evaluated the real height when the value is true.
45
+ - **`snapshotContentContainer`** *(bool)*: View is evaluated the real height when the value is true.(Android only)
46 46
 
47 47
 ## Caveats
48 48
 

+ 2
- 2
android/src/main/java/fr/greweb/reactnativeviewshot/RNViewShotModule.java Datei anzeigen

@@ -64,12 +64,12 @@ public class RNViewShotModule extends ReactContextBaseJavaModule {
64 64
         Integer width = options.hasKey("width") ? (int)(displayMetrics.density * options.getDouble("width")) : null;
65 65
         Integer height = options.hasKey("height") ? (int)(displayMetrics.density * options.getDouble("height")) : null;
66 66
         String result = options.hasKey("result") ? options.getString("result") : "file";
67
-        Boolean isScrollView = options.hasKey("isScrollView") ? options.getBoolean("isScrollView"):false;
67
+        Boolean snapshotContentContainer = options.hasKey("snapshotContentContainer") ? options.getBoolean("snapshotContentContainer"):false;
68 68
         try {
69 69
             String name = options.hasKey("filename") ? options.getString("filename") : null;
70 70
             File tmpFile = "file".equals(result) ? createTempFile(getReactApplicationContext(), format, name) : null;
71 71
             UIManagerModule uiManager = this.reactContext.getNativeModule(UIManagerModule.class);
72
-            uiManager.addUIBlock(new ViewShot(tag, format, compressFormat, quality, width, height, tmpFile, result,isScrollView,promise));
72
+            uiManager.addUIBlock(new ViewShot(tag, format, compressFormat, quality, width, height, tmpFile, result,snapshotContentContainer,promise));
73 73
         }
74 74
         catch (Exception e) {
75 75
             promise.reject(ViewShot.ERROR_UNABLE_TO_SNAPSHOT, "Failed to snapshot view tag "+tag);

+ 4
- 4
android/src/main/java/fr/greweb/reactnativeviewshot/ViewShot.java Datei anzeigen

@@ -36,7 +36,7 @@ public class ViewShot implements UIBlock {
36 36
     private File output;
37 37
     private String result;
38 38
     private Promise promise;
39
-    private Boolean isScrollView;
39
+    private Boolean snapshotContentContainer;
40 40
 
41 41
     public ViewShot(
42 42
             int tag,
@@ -47,7 +47,7 @@ public class ViewShot implements UIBlock {
47 47
             @Nullable Integer height,
48 48
             File output,
49 49
             String result,
50
-            Boolean isScrollView,
50
+            Boolean snapshotContentContainer,
51 51
             Promise promise) {
52 52
         this.tag = tag;
53 53
         this.extension = extension;
@@ -57,7 +57,7 @@ public class ViewShot implements UIBlock {
57 57
         this.height = height;
58 58
         this.output = output;
59 59
         this.result = result;
60
-        this.isScrollView = isScrollView;
60
+        this.snapshotContentContainer = snapshotContentContainer;
61 61
         this.promise = promise;
62 62
     }
63 63
 
@@ -124,7 +124,7 @@ public class ViewShot implements UIBlock {
124 124
         }
125 125
 
126 126
         //evaluate real height
127
-        if (this.isScrollView){
127
+        if (this.snapshotContentContainer){
128 128
             h=0;
129 129
             ScrollView scrollView = (ScrollView)view;
130 130
             for (int i = 0; i < scrollView.getChildCount(); i++) {