Skip to content

Commit

Permalink
Add early return to useStyleTransition
Browse files Browse the repository at this point in the history
Return early if we don't have anything to animate.

Close #226
  • Loading branch information
ecreeth authored and necolas committed Dec 16, 2024
1 parent 7d567a9 commit 27f0198
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/react-strict-dom/src/native/modules/useStyleTransition.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,16 @@ export function useStyleTransition(style: ReactNativeStyle): ReactNativeStyle {
}
}, [animatedValue]);

if (
_delay == null &&
_duration == null &&
_transitionProperty == null &&
_timingFunction == null
) {
// Avoid further calculations if we don't have anything to animate
return style;
}

if (transitionStyleHasChanged(transitionStyle, currentStyle)) {
setCurrentStyle(style);
setPreviousStyle(currentStyle);
Expand Down

0 comments on commit 27f0198

Please sign in to comment.