From 6a563f42b651d3262da1e51c10f15b5b5ddce97c Mon Sep 17 00:00:00 2001 From: Bohdan Artiukhov <69891500+bohdanprog@users.noreply.github.com> Date: Mon, 29 Jul 2024 13:57:19 +0200 Subject: [PATCH] fix: type problem ReactNativeSvg.web.ts (#2374) # Summary Fix type problem in `ReactNativeSvg.web.ts` --- src/ReactNativeSVG.web.ts | 8 +++++--- src/lib/extract/extractTransform.ts | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ReactNativeSVG.web.ts b/src/ReactNativeSVG.web.ts index cab8c237..44a16d13 100644 --- a/src/ReactNativeSVG.web.ts +++ b/src/ReactNativeSVG.web.ts @@ -26,7 +26,6 @@ import type { FilterProps } from './elements/filters/Filter'; import type { FeColorMatrixProps } from './elements/filters/FeColorMatrix'; import type { GestureResponderEvent, - TransformsStyle, ImageProps as RNImageProps, } from 'react-native'; import { @@ -40,7 +39,10 @@ import type { } from './lib/extract/types'; import SvgTouchableMixin from './lib/SvgTouchableMixin'; import { resolve } from './lib/resolve'; -import { transformsArrayToProps } from './lib/extract/extractTransform'; +import { + transformsArrayToProps, + type TransformsStyleArray, +} from './lib/extract/extractTransform'; import { resolveAssetUri } from './lib/resolveAssetUri'; type BlurEvent = object; @@ -156,7 +158,7 @@ function parseTransformProp( transformArray.push(`matrix(${transform.join(' ')})`); } else { const stringifiedProps = transformsArrayToProps( - transform as TransformsStyle['transform'] + transform as TransformsStyleArray ); transformArray.push(...stringifyTransformProps(stringifiedProps)); } diff --git a/src/lib/extract/extractTransform.ts b/src/lib/extract/extractTransform.ts index 3805f3ae..61e0f90d 100644 --- a/src/lib/extract/extractTransform.ts +++ b/src/lib/extract/extractTransform.ts @@ -8,7 +8,10 @@ import type { TransformProps, } from './types'; -type TransformsStyleArray = Exclude; +export type TransformsStyleArray = Exclude< + TransformsStyle['transform'], + string +>; function appendTransformProps(props: TransformedProps) { const { x, y, originX, originY, scaleX, scaleY, rotation, skewX, skewY } =