Skip to content

Commit

Permalink
Clean up code, reduce diff for easier reviewing
Browse files Browse the repository at this point in the history
  • Loading branch information
ciampo committed Sep 25, 2024
1 parent d67f6f2 commit 283dc1e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ function UnconnectedNavigatorScreen(
);
}

// Generate a unique ID for the screen.
const screenId = useId();

const wrapperRef = useRef< HTMLDivElement >( null );
const mergedWrapperRef = useMergeRefs( [ forwardedRef, wrapperRef ] );

const {
children,
className,
Expand All @@ -59,6 +55,7 @@ function UnconnectedNavigatorScreen(
const { isInitial, isBack, focusTargetSelector, skipFocus } = location;

const isMatch = match === screenId;
const wrapperRef = useRef< HTMLDivElement >( null );
const skipAnimationAndFocusRestoration = !! isInitial && ! isBack;

// Register / unregister screen with the navigator context.
Expand Down Expand Up @@ -142,6 +139,8 @@ function UnconnectedNavigatorScreen(
skipFocus,
] );

const mergedWrapperRef = useMergeRefs( [ forwardedRef, wrapperRef ] );

return shouldRenderScreen ? (
<View
ref={ mergedWrapperRef }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export function useScreenAnimatePresence( {
skipAnimation: boolean;
isBack?: boolean;
onAnimationEnd?: React.AnimationEventHandler< Element >;
screenEl?: HTMLElement | null;
} ) {
const isRTL = isRTLFn();
const prefersReducedMotion = useReducedMotion();
Expand All @@ -67,8 +66,8 @@ export function useScreenAnimatePresence( {
useState< AnimationStatus >( 'INITIAL' );

// Start enter and exit animations when the screen is selected or deselected.
// The animation status is set to `*_END` immediately if the animation should
// be skipped.
// The animation status is set to `IN` or `OUT` immediately if the animation
// should be skipped.
const becameSelected =
animationStatus !== 'ANIMATING_IN' &&
animationStatus !== 'IN' &&
Expand Down

0 comments on commit 283dc1e

Please sign in to comment.