Procházet zdrojové kódy

Moving ScrollView example in the previous code snippet

Taym95 před 7 roky
rodič
revize
0541daa9ac
1 změnil soubory, kde provedl 15 přidání a 21 odebrání
  1. 15
    21
      README.md

+ 15
- 21
README.md Zobrazit soubor

@@ -31,6 +31,21 @@ class ExampleCaptureOnMountManually extends Component {
31 31
     );
32 32
   }
33 33
 }
34
+// ScrollView
35
+class ExampleCaptureScrollViewContent extends Component {
36
+  onCapture = uri => {
37
+    console.log("do something with ", uri);
38
+  }
39
+  render() {
40
+    return (
41
+      <ScrollView>
42
+        <ViewShot onCapture={this.onCapture} captureMode="mount">
43
+          <Text>...The Scroll View Content Goes Here...</Text>
44
+        </ViewShot>
45
+      </ScrollView>
46
+    );
47
+  }
48
+}
34 49
 
35 50
 // alternative
36 51
 class ExampleCaptureOnMountSimpler extends Component {
@@ -63,27 +78,6 @@ class ExampleWaitingCapture extends Component {
63 78
   }
64 79
 }
65 80
 ```
66
-## With ScrollView
67
-```js
68
-import ViewShot from "react-native-view-shot";
69
-
70
-class ExampleCaptureOfScrollView extends Component {
71
-  componentDidMount () {
72
-    this.refs.viewShot.capture().then(uri => {
73
-      console.log("do something with ", uri);
74
-    });
75
-  }
76
-  render() {
77
-    return (
78
-        <ScrollView>
79
-            <ViewShot ref="viewShot" options={{ format: "jpg", quality: 0.9 }}>
80
-                    ... All content of the ScrollView ...
81
-            </ViewShot>                       
82
-        </ScrollView>
83
-    );
84
-  }
85
-}
86
-```
87 81
 **Props:**
88 82
 
89 83
 - **`children`**: the actual content to rasterize.