diff --git a/src/Transforms.ts b/src/Transforms.ts index 0687542..21593a1 100644 --- a/src/Transforms.ts +++ b/src/Transforms.ts @@ -12,13 +12,9 @@ export const transformOrigin = ( transformations: RNTransform ): RNTransform => { "worklet"; - return [ - { translateX: x }, - { translateY: y }, - ...transformations, - { translateX: -x }, - { translateY: -y }, - ]; + return ([{ translateX: x }, { translateY: y }] as RNTransform) + .concat(transformations) + .concat([{ translateX: -x }, { translateY: -y }]); }; export const transformOrigin2d = ( @@ -26,13 +22,9 @@ export const transformOrigin2d = ( transformations: Transforms2d ): Transforms2d => { "worklet"; - return [ - { translateX: x }, - { translateY: y }, - ...transformations, - { translateX: -x }, - { translateY: -y }, - ]; + return ([{ translateX: x }, { translateY: y }] as Transforms2d) + .concat(transformations) + .concat([{ translateX: -x }, { translateY: -y }]); }; export const useTranslation = ({