Skip to content

Commit 15a39d8

Browse files
committed
Update the main README to include the new captureScreen documentation.
1 parent 21cd028 commit 15a39d8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,27 @@ This method release a previously captured `uri`. For tmpfile it will clean them
110110

111111
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).
112112

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+
113134
### Advanced Examples
114135

115136
[Checkout react-native-view-shot-example](example)

0 commit comments

Comments
 (0)