From bf85b02433e0b7a4cda7cb243b353f665f0acdda Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sat, 18 Apr 2020 21:51:06 +0200 Subject: [PATCH] =?UTF-8?q?fix(=F0=9F=90=9B):=20Fix=20bug=20in=20TS=20typi?= =?UTF-8?q?ngs=20(#225)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/Matrix.ts | 2 +- packages/core/src/Transformations.ts | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/core/src/Matrix.ts b/packages/core/src/Matrix.ts index 31609b02..877690ab 100644 --- a/packages/core/src/Matrix.ts +++ b/packages/core/src/Matrix.ts @@ -36,7 +36,7 @@ type TransformName = | "rotateZ" | "rotate"; type Transformations = { [Name in TransformName]: Animated.Adaptable }; -type Transforms = ( +export type Transforms = ( | Pick | Pick | Pick diff --git a/packages/core/src/Transformations.ts b/packages/core/src/Transformations.ts index fc8f16e9..efde2dfd 100644 --- a/packages/core/src/Transformations.ts +++ b/packages/core/src/Transformations.ts @@ -1,6 +1,7 @@ import Animated from "react-native-reanimated"; -import { Point } from "./Coordinates"; +import { Vector } from "./Vectors"; +import { Transforms } from "./Matrix"; const { divide, sub, multiply } = Animated; @@ -9,15 +10,15 @@ export const translateZ = ( z: Animated.Adaptable ) => ({ scale: divide(perspective, sub(perspective, z)) }); -export const translate = ({ x: translateX, y: translateY }: Point) => [ +export const translate = ({ x: translateX, y: translateY }: Vector) => [ { translateX }, { translateY }, ]; export const transformOrigin = ( - { x, y }: Point, - ...transformations: Animated.AnimatedTransform[] -): Animated.AnimatedTransform[] => [ + { x, y }: Vector, + ...transformations: Transforms +): Transforms => [ { translateX: x }, { translateY: y }, ...transformations,