react-native-anchor-point icon indicating copy to clipboard operation
react-native-anchor-point copied to clipboard

`withAnchorPoint` doesn't accept animated style

Open thomasttvo opened this issue 3 years ago • 0 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-anchor-point/index.ts b/node_modules/react-native-anchor-point/index.ts
index f789fa7..41b0ca9 100644
--- a/node_modules/react-native-anchor-point/index.ts
+++ b/node_modules/react-native-anchor-point/index.ts
@@ -1,4 +1,4 @@
-import type { TransformsStyle } from "react-native";
+import type { TransformsStyle, Animated } from "react-native";
 
 export interface Point {
     x: number;
@@ -16,7 +16,11 @@ const isValidSize = (size: Size): boolean => {
 
 const defaultAnchorPoint = { x: 0.5, y: 0.5 };
 
-export const withAnchorPoint = (transform: TransformsStyle, anchorPoint: Point, size: Size) => {
+export const withAnchorPoint = (
+  transform: TransformsStyle | Animated.WithAnimatedValue<TransformsStyle>,
+  anchorPoint: Point, size: Size
+) => {
     if(!isValidSize(size)) {
         return transform;
     }

This issue body was partially generated by patch-package.

thomasttvo avatar Dec 03 '21 20:12 thomasttvo