Skip to content

Commit

Permalink
fix(🐛): Fix bug in TS typings (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcandillon authored Apr 18, 2020
1 parent 09397f8 commit bf85b02
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/Matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type TransformName =
| "rotateZ"
| "rotate";
type Transformations = { [Name in TransformName]: Animated.Adaptable<number> };
type Transforms = (
export type Transforms = (
| Pick<Transformations, "translateX">
| Pick<Transformations, "translateY">
| Pick<Transformations, "scale">
Expand Down
11 changes: 6 additions & 5 deletions packages/core/src/Transformations.ts
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -9,15 +10,15 @@ export const translateZ = (
z: Animated.Adaptable<number>
) => ({ 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,
Expand Down

0 comments on commit bf85b02

Please sign in to comment.