Skip to content

Commit 96f7303

Browse files
committed
Fix occasional flicker when transitioning a property
If transitionStyleHasChangedResult is true, the code in useLayoutEffect should run synchronously without rendering the style being transitioned to, but this doesn't appear to be the case 100% of the time because I've got one transition that momentarily shows the target style before running the transition. Even this doesn't repro reliably. Even though I'd expect returning the current style if transitionStyleHasChangedResult is true to be a no-op (because the useLayoutEffect should cause a synchronous render with a new value), it doesn't seem to always be that way and this PR fixes the issue
1 parent 2cd7c79 commit 96f7303

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/react-strict-dom/src/native/modules/useStyleTransition.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,10 @@ export function useStyleTransition(style: ReactNativeStyle): ReactNativeStyle {
400400
}
401401
}, [currentStyle, style, transitionStyleHasChangedResult]);
402402

403+
if (transitionStyleHasChangedResult) {
404+
return currentStyle ?? style;
405+
}
406+
403407
if (
404408
_delay == null &&
405409
_duration == null &&

0 commit comments

Comments
 (0)