@@ -133,12 +133,7 @@ export type PathProps = PathBaseProps &
133133 } ;
134134
135135const AnimatedPath = memo <
136- Omit <
137- PathProps ,
138- 'animate' | 'clipRect' | 'clipOffset' | 'clipPath' | 'transitions' | 'transition'
139- > & {
140- transitions ?: { enter ?: Transition ; update ?: Transition } ;
141- }
136+ Omit < PathProps , 'animate' | 'clipRect' | 'clipOffset' | 'clipPath' | 'transition' >
142137> (
143138 ( {
144139 d = '' ,
@@ -246,18 +241,20 @@ export const Path = memo<PathProps>((props) => {
246241 [ animate , transitions ?. update , transition ] ,
247242 ) ;
248243
244+ const shouldAnimateClip = animate && enterTransition !== null ;
245+
249246 // The clip offset provides extra padding to prevent path from being cut off
250247 // Area charts typically use offset=0 for exact clipping, while lines use offset=2 for breathing room
251248 const totalOffset = clipOffset * 2 ; // Applied on both sides
252249
253250 // Animation progress for clip path reveal
254- const clipProgress = useSharedValue ( animate ? 0 : 1 ) ;
251+ const clipProgress = useSharedValue ( shouldAnimateClip ? 0 : 1 ) ;
255252
256253 useEffect ( ( ) => {
257- if ( animate && isReady ) {
254+ if ( shouldAnimateClip && isReady ) {
258255 clipProgress . value = buildTransition ( 1 , enterTransition ) ;
259256 }
260- } , [ animate , isReady , clipProgress , enterTransition ] ) ;
257+ } , [ shouldAnimateClip , isReady , clipProgress , enterTransition ] ) ;
261258
262259 // Create initial and target clip paths for animation
263260 const { initialClipPath, targetClipPath } = useMemo ( ( ) => {
@@ -288,7 +285,7 @@ export const Path = memo<PathProps>((props) => {
288285 const animatedClipPath = usePathInterpolation (
289286 clipProgress ,
290287 [ 0 , 1 ] ,
291- animate && initialClipPath && targetClipPath
288+ shouldAnimateClip && initialClipPath && targetClipPath
292289 ? [ initialClipPath , targetClipPath ]
293290 : targetClipPath
294291 ? [ targetClipPath , targetClipPath ]
@@ -306,13 +303,13 @@ export const Path = memo<PathProps>((props) => {
306303 }
307304
308305 // If not animating or paths are null, return target clip path
309- if ( ! animate || ! targetClipPath ) {
306+ if ( ! shouldAnimateClip || ! targetClipPath ) {
310307 return targetClipPath ;
311308 }
312309
313310 // Return undefined here since we'll use animatedClipPath directly
314311 return undefined ;
315- } , [ clipPathProp , animate , targetClipPath ] ) ;
312+ } , [ clipPathProp , shouldAnimateClip , targetClipPath ] ) ;
316313
317314 // Convert SVG path string to SkPath for static rendering
318315 const staticPath = useDerivedValue ( ( ) => {
@@ -365,7 +362,7 @@ export const Path = memo<PathProps>((props) => {
365362
366363 // Determine which clip path to use
367364 const finalClipPath =
368- animate && resolvedClipPath === undefined ? animatedClipPath : resolvedClipPath ;
365+ shouldAnimateClip && resolvedClipPath === undefined ? animatedClipPath : resolvedClipPath ;
369366
370367 // If finalClipPath is null, render without clipping
371368 if ( finalClipPath === null ) {
0 commit comments