Browse Source

Update the main README to include the new captureScreen documentation.

foxmicha 6 years ago
parent
commit
15a39d83ab
1 changed files with 21 additions and 0 deletions
  1. 21
    0
      README.md

+ 21
- 0
README.md View File

@@ -110,6 +110,27 @@ This method release a previously captured `uri`. For tmpfile it will clean them
110 110
 
111 111
 NB: the tmpfile captures are automatically cleaned out after the app closes, so you might not have to worry about this unless advanced usecases. The `ViewShot` component will use it each time you capture more than once (useful for continuous capture to not leak files).
112 112
 
113
+## `captureScreen()` Android and iOS Only
114
+
115
+```js
116
+import { captureScreen } from "react-native-view-shot";
117
+
118
+captureScreen({
119
+  format: "jpg",
120
+  quality: 0.8
121
+})
122
+.then(
123
+  uri => console.log("Image saved to", uri),
124
+  error => console.error("Oops, snapshot failed", error)
125
+);
126
+```
127
+
128
+This method will capture the contents of the currently displayed screen as a native hardware screenshot. It does not require a ref input, as it does not work at the view level. This means that ScrollViews will not be captured in their entirety - only the portions currently visible to the user. 
129
+
130
+Returns a Promise of the image URI.
131
+
132
+- **`options`**: the same options as in `captureRef` method.
133
+
113 134
 ### Advanced Examples
114 135
 
115 136
 [Checkout react-native-view-shot-example](example)