index.js 486B

1234567891011121314151617181920212223
  1. //@flow
  2. import { NativeModules, findNodeHandle } from "react-native";
  3. const { RNViewShot } = NativeModules;
  4. export function takeSnapshot(
  5. view: number | ReactElement<any>,
  6. options ?: {
  7. width ?: number;
  8. height ?: number;
  9. format ?: "png" | "jpg" | "jpeg" | "webm";
  10. quality ?: number;
  11. }
  12. ): Promise<string> {
  13. if (typeof view !== "number") {
  14. view = findNodeHandle(view);
  15. }
  16. return RNViewShot.takeSnapshot(view, options);
  17. }
  18. export default { takeSnapshot };