From 82c26005d04c79191f0d895b1c2dc3c3c57a4401 Mon Sep 17 00:00:00 2001 From: Doberjohn Date: Tue, 17 Nov 2026 23:07:11 +0200 Subject: [PATCH 1/3] fix(menu): scale the menu in on every open, not only the first After a hide, scaleX and scaleY kept the measured size. A reopen with the same anchor and size then started withTiming at its target, so Reanimated skipped it and the menu only faded in. Reset both to 0 when the hide animation finishes, so each open starts from zero like the first one. --- src/components/Menu/Menu.tsx | 4 ++ src/components/__tests__/Menu.test.tsx | 55 ++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/src/components/Menu/Menu.tsx b/src/components/Menu/Menu.tsx index 5c5990a2b8..abc11d30ed 100644 --- a/src/components/Menu/Menu.tsx +++ b/src/components/Menu/Menu.tsx @@ -322,6 +322,10 @@ const Menu = ({ return; } + // Start the next open from zero, as the first one does. Left at the + // measured size, a reopen with the same size would skip the scale animation. + scaleX.value = 0; + scaleY.value = 0; setMenuLayout({ width: 0, height: 0 }); setRendered(false); isShownRef.current = false; diff --git a/src/components/__tests__/Menu.test.tsx b/src/components/__tests__/Menu.test.tsx index 3d104b9fa4..6e3bfa4b46 100644 --- a/src/components/__tests__/Menu.test.tsx +++ b/src/components/__tests__/Menu.test.tsx @@ -10,6 +10,7 @@ import { jest, } from '@jest/globals'; import { act, screen, waitFor } from '@testing-library/react-native'; +import { getAnimatedStyle } from 'react-native-reanimated'; import { render } from '../../test-utils'; import { LightTheme } from '../../theme/schemes'; @@ -457,3 +458,57 @@ it('does not crash when Keyboard.metrics is unavailable (react-native-web)', asy dimensionsSpy.mockRestore(); } }); + +it('scales in again when reopened at the same anchor', async () => { + const testID = 'reopened-menu'; + const measureSpy = jest + .spyOn(ViewPrototype, 'measureInWindow') + .mockImplementation((fn) => fn(100, 100, 80, 32)); + + function makeMenu(visible: boolean) { + return ( + + Open menu} + testID={testID} + > + + + + ); + } + + // The style partway through the open animation. + const openAndSample = async () => { + await act(async () => { + await screen.rerender(makeMenu(true)); + }); + await act(() => jest.advanceTimersByTimeAsync(100)); + const style = getAnimatedStyle(screen.getByTestId(testID)); + await act(() => jest.advanceTimersByTimeAsync(500)); + return style; + }; + + try { + await render(makeMenu(false)); + + const firstOpen = await openAndSample(); + // Partway through the first open, the menu is still growing. + expect(firstOpen).not.toMatchObject({ + transform: [{ scaleX: 1 }, { scaleY: 1 }], + }); + + await act(async () => { + await screen.rerender(makeMenu(false)); + }); + await act(() => jest.advanceTimersByTimeAsync(500)); + expect(screen.queryByTestId(testID)).toBeNull(); + + const secondOpen = await openAndSample(); + expect(secondOpen).toEqual(firstOpen); + } finally { + measureSpy.mockRestore(); + } +}); From 5a0c0593ca4caf5fb6a02e0722085ca7951fb565 Mon Sep 17 00:00:00 2001 From: Doberjohn Date: Wed, 18 Nov 2026 02:05:21 +0200 Subject: [PATCH 2/3] chore(menu): remove a redundant test comment --- src/components/__tests__/Menu.test.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/__tests__/Menu.test.tsx b/src/components/__tests__/Menu.test.tsx index 6e3bfa4b46..1d6d9fb0f0 100644 --- a/src/components/__tests__/Menu.test.tsx +++ b/src/components/__tests__/Menu.test.tsx @@ -480,7 +480,6 @@ it('scales in again when reopened at the same anchor', async () => { ); } - // The style partway through the open animation. const openAndSample = async () => { await act(async () => { await screen.rerender(makeMenu(true)); From 008cdd94997c04df4e12bea229c3fb12dba91aaa Mon Sep 17 00:00:00 2001 From: John Fanidis Date: Wed, 18 Nov 2026 02:12:56 +0200 Subject: [PATCH 3/3] Clean up comments in Menu.tsx Remove comments related to scale animation handling. --- src/components/Menu/Menu.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/Menu/Menu.tsx b/src/components/Menu/Menu.tsx index abc11d30ed..268246b5a0 100644 --- a/src/components/Menu/Menu.tsx +++ b/src/components/Menu/Menu.tsx @@ -322,8 +322,6 @@ const Menu = ({ return; } - // Start the next open from zero, as the first one does. Left at the - // measured size, a reopen with the same size would skip the scale animation. scaleX.value = 0; scaleY.value = 0; setMenuLayout({ width: 0, height: 0 });