gre / react-native-view-shot

Snapshot a React Native view and save it to an image
https://github.com/gre/react-native-view-shot-example
MIT License
2.66k stars 346 forks source link

Wrong type for onLayout #461

Closed LahmerIlyas closed 1 year ago

LahmerIlyas commented 1 year ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch react-native-view-shot@3.5.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-view-shot/src/index.d.ts b/node_modules/react-native-view-shot/src/index.d.ts
index 07128e1..fe3097c 100644
--- a/node_modules/react-native-view-shot/src/index.d.ts
+++ b/node_modules/react-native-view-shot/src/index.d.ts
@@ -11,6 +11,7 @@
 declare module 'react-native-view-shot' {
     import { Component, ReactInstance, RefObject, ReactNode } from 'react'
     import { ViewStyle } from 'react-native'
+    import type { LayoutChangeEvent } from 'react-native';

     export interface CaptureOptions {
         /**
@@ -83,9 +84,9 @@ declare module 'react-native-view-shot' {
         onCaptureFailure?(error: Error): void;
         /**
          * Invoked on mount and layout changes
-         * @param {LayoutEvent} event
+         * @param {LayoutChangeEvent} event
          */
-        onLayout?(event: LayoutEvent): void;
+        onLayout?(event: LayoutChangeEvent): void;
         /**
          * style prop as ViewStyle
          */

This issue body was partially generated by patch-package.

gre commented 1 year ago

Thanks. could you send a PR? πŸ™