From a9baba6a927f28d85849c9758d38ca64f1277fbc Mon Sep 17 00:00:00 2001 From: Shubh Porwal Date: Sun, 17 May 2026 19:57:31 +0530 Subject: [PATCH] fix: support older react-native codegen parsers --- src/EaseViewNativeComponent.ts | 99 +++++++++++++++------------------- tsconfig.json | 1 - 2 files changed, 42 insertions(+), 58 deletions(-) diff --git a/src/EaseViewNativeComponent.ts b/src/EaseViewNativeComponent.ts index 4f22c1e..8016493 100644 --- a/src/EaseViewNativeComponent.ts +++ b/src/EaseViewNativeComponent.ts @@ -1,13 +1,15 @@ import { codegenNativeComponent, - type CodegenTypes, type ViewProps, type HostComponent, type ColorValue, } from 'react-native'; - -type Float = CodegenTypes.Float; -type Int32 = CodegenTypes.Int32; +import type { + DirectEventHandler, + Float, + Int32, + WithDefault, +} from 'react-native/Libraries/Types/CodegenTypes'; type NativeTransitionConfig = Readonly<{ type: string; @@ -32,80 +34,63 @@ type NativeTransitions = Readonly<{ export interface NativeProps extends ViewProps { // Bitmask of which properties are animated (0 = none, let style handle all) - animatedProperties?: CodegenTypes.WithDefault; + animatedProperties?: WithDefault; // Animate target values - animateOpacity?: CodegenTypes.WithDefault; - animateTranslateX?: CodegenTypes.WithDefault; - animateTranslateY?: CodegenTypes.WithDefault; - animateScaleX?: CodegenTypes.WithDefault; - animateScaleY?: CodegenTypes.WithDefault; - animateRotate?: CodegenTypes.WithDefault; - animateRotateX?: CodegenTypes.WithDefault; - animateRotateY?: CodegenTypes.WithDefault; - animateBorderRadius?: CodegenTypes.WithDefault; + animateOpacity?: WithDefault; + animateTranslateX?: WithDefault; + animateTranslateY?: WithDefault; + animateScaleX?: WithDefault; + animateScaleY?: WithDefault; + animateRotate?: WithDefault; + animateRotateX?: WithDefault; + animateRotateY?: WithDefault; + animateBorderRadius?: WithDefault; animateBackgroundColor?: ColorValue; - animateBorderWidth?: CodegenTypes.WithDefault; + animateBorderWidth?: WithDefault; animateBorderColor?: ColorValue; - animateShadowOpacity?: CodegenTypes.WithDefault; - animateShadowRadius?: CodegenTypes.WithDefault; + animateShadowOpacity?: WithDefault; + animateShadowRadius?: WithDefault; animateShadowColor?: ColorValue; - animateShadowOffsetX?: CodegenTypes.WithDefault; - animateShadowOffsetY?: CodegenTypes.WithDefault; - animateElevation?: CodegenTypes.WithDefault; + animateShadowOffsetX?: WithDefault; + animateShadowOffsetY?: WithDefault; + animateElevation?: WithDefault; // Initial values for enter animations - initialAnimateOpacity?: CodegenTypes.WithDefault; - initialAnimateTranslateX?: CodegenTypes.WithDefault; - initialAnimateTranslateY?: CodegenTypes.WithDefault; - initialAnimateScaleX?: CodegenTypes.WithDefault; - initialAnimateScaleY?: CodegenTypes.WithDefault; - initialAnimateRotate?: CodegenTypes.WithDefault; - initialAnimateRotateX?: CodegenTypes.WithDefault; - initialAnimateRotateY?: CodegenTypes.WithDefault; - initialAnimateBorderRadius?: CodegenTypes.WithDefault< - CodegenTypes.Float, - 0.0 - >; + initialAnimateOpacity?: WithDefault; + initialAnimateTranslateX?: WithDefault; + initialAnimateTranslateY?: WithDefault; + initialAnimateScaleX?: WithDefault; + initialAnimateScaleY?: WithDefault; + initialAnimateRotate?: WithDefault; + initialAnimateRotateX?: WithDefault; + initialAnimateRotateY?: WithDefault; + initialAnimateBorderRadius?: WithDefault; initialAnimateBackgroundColor?: ColorValue; - initialAnimateBorderWidth?: CodegenTypes.WithDefault; + initialAnimateBorderWidth?: WithDefault; initialAnimateBorderColor?: ColorValue; - initialAnimateShadowOpacity?: CodegenTypes.WithDefault< - CodegenTypes.Float, - 0.0 - >; - initialAnimateShadowRadius?: CodegenTypes.WithDefault< - CodegenTypes.Float, - 0.0 - >; + initialAnimateShadowOpacity?: WithDefault; + initialAnimateShadowRadius?: WithDefault; initialAnimateShadowColor?: ColorValue; - initialAnimateShadowOffsetX?: CodegenTypes.WithDefault< - CodegenTypes.Float, - 0.0 - >; - initialAnimateShadowOffsetY?: CodegenTypes.WithDefault< - CodegenTypes.Float, - 0.0 - >; - initialAnimateElevation?: CodegenTypes.WithDefault; + initialAnimateShadowOffsetX?: WithDefault; + initialAnimateShadowOffsetY?: WithDefault; + initialAnimateElevation?: WithDefault; // Unified transition config — one struct with per-property configs transitions?: NativeTransitions; // Transform origin (0–1 fractions, default center) - transformOriginX?: CodegenTypes.WithDefault; - transformOriginY?: CodegenTypes.WithDefault; + transformOriginX?: WithDefault; + transformOriginY?: WithDefault; // 3D perspective distance (default 1280, matches RN default) - transformPerspective?: CodegenTypes.WithDefault; + transformPerspective?: WithDefault; // Events - onTransitionEnd?: CodegenTypes.DirectEventHandler< - Readonly<{ finished: boolean }> - >; + onTransitionEnd?: DirectEventHandler>; // Android hardware layer optimization (no-op on iOS) - useHardwareLayer?: CodegenTypes.WithDefault; + useHardwareLayer?: WithDefault; } export default codegenNativeComponent( diff --git a/tsconfig.json b/tsconfig.json index 3a0a2d6..03fdd5c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,6 @@ }, "allowUnreachableCode": false, "allowUnusedLabels": false, - "customConditions": ["react-native-strict-api"], "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "jsx": "react-jsx",