123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
-
-
- declare module 'react-native-view-shot' {
- import { Component, ReactInstance } from 'react'
- import { StyleObj } from 'react-native/Libraries/StyleSheet/StyleSheetTypes'
-
- export interface CaptureOptions {
-
-
- width?: number;
-
-
- height?: number;
-
-
- format?: 'jpg' | 'png' | 'webm' | 'raw';
-
-
- quality?: number;
-
-
- result?: 'tmpfile' | 'base64' | 'data-uri' | 'zip-base64';
-
-
- snapshotContentContainer?: boolean;
- }
-
- export interface ViewShotProperties {
- options?: CaptureOptions;
-
-
- captureMode?: 'mount' | 'continuous' | 'update';
-
-
- onCapture?(uri: string): void;
-
-
- onCaptureFailure?(error: Error): void;
-
-
- style?: StyleObj;
- }
-
- export default class ViewShot extends Component<ViewShotProperties> {
- }
-
-
-
- export function captureRef(viewRef: ReactInstance, options?: CaptureOptions): Promise<string>
-
- /**
- * This method release a previously captured uri. For tmpfile it will clean them out, for other result types it
- * just won't do anything.
- *
- * 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).
- * @param {string} uri
- */
- export function releaseCapture(uri: string): void
-
- /**
- * 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.
- *
- * Returns a Promise of the image URI.
- *
- * @param {"react-native-view-shot".CaptureOptions} options
- * @return {Promise<string>}
- */
- export function captureScreen(options?: CaptureOptions): Promise<string>
- }
|