chore: Added HeaderStandardAnimated to components temp#26712
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
…to component/headeranimated
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Key findings:
Since this component is not yet integrated into any user-facing features or screens, no E2E tests are necessary to validate this change. The unit tests provided adequately cover the component's functionality. Performance Test Selection: |
| it('renders back button when onBack provided', () => { | ||
| const { getByTestId } = render( | ||
| <HeaderStandardAnimated | ||
| {...defaultProps} | ||
| title="Title" | ||
| onBack={jest.fn()} | ||
| backButtonProps={{ testID: BACK_BUTTON_TEST_ID }} | ||
| />, | ||
| ); | ||
|
|
||
| expect(getByTestId(BACK_BUTTON_TEST_ID)).toBeOnTheScreen(); | ||
| }); | ||
|
|
||
| it('renders back button when backButtonProps provided', () => { | ||
| const { getByTestId } = render( | ||
| <HeaderStandardAnimated | ||
| {...defaultProps} | ||
| title="Title" | ||
| backButtonProps={{ | ||
| onPress: jest.fn(), | ||
| testID: BACK_BUTTON_TEST_ID, | ||
| }} | ||
| />, | ||
| ); | ||
|
|
||
| expect(getByTestId(BACK_BUTTON_TEST_ID)).toBeOnTheScreen(); | ||
| }); |
There was a problem hiding this comment.
non-blocking seems like these tests could be consolidated into one if we are using backButtonProps to assert for the back button
| scrollY, | ||
| titleSectionHeight, | ||
| twClassName = '', | ||
| ...headerStandardProps |
There was a problem hiding this comment.
non-blocking: I think we usually just use ...props for spread props
| }); | ||
|
|
||
| const content = title ? ( | ||
| <Box alignItems={BoxAlignItems.Center}> |
There was a problem hiding this comment.
non-blocking: Is this wrapper necessary or can we just apply the styles to the Animated.View to reduce bloat?
| @@ -0,0 +1,6 @@ | |||
| export { default } from './HeaderStandardAnimated'; | |||
| export { default as useHeaderStandardAnimated } from './useHeaderStandardAnimated'; | |||
There was a problem hiding this comment.
non-blocking: Why not just export as a named export from useHeaderStandardAnimated?
| * Extends HeaderCompactStandardProps with scroll-driven animation inputs. | ||
| * Content is driven by title/subtitle only; children is not supported. | ||
| */ | ||
| export interface HeaderStandardAnimatedProps |
There was a problem hiding this comment.
non-blocking: I think we want to move away from interface for MDMS components in favor of type
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Description
This PR adds HeaderStandardAnimated, a scroll-driven animated header component to
app/component-library/components-temp/. The header shows a full title section (e.g. withTitleStandard) when at the top of the scroll, and animates to a compact center title when the user scrolls past that section.Reason for change: Screens with a large title block (e.g. Perps market detail) need a header that stays visible and collapses to a compact title as the user scrolls. This component provides that pattern with Reanimated-driven animation tied to scroll position.
What changed:
HeaderStandardAnimated (
app/component-library/components-temp/HeaderStandardAnimated/)HeaderCompactStandardand requiresscrollYandtitleSectionHeightshared values to drive the center-title animation.HeaderBasewith optional back/close buttons, title, subtitle, or custom children. The center content is wrapped in anAnimated.Viewwhose opacity and translateY are derived from scroll (compact title appears whenscrollY >= titleSectionHeight).scrollY,titleSectionHeight(required), plus title/subtitle/children,onBack/backButtonProps,onClose/closeButtonProps,startButtonIconProps/endButtonIconProps,testID,twClassName, and otherHeaderBaseprops.useHeaderStandardAnimated
scrollY,titleSectionHeightSv,setTitleSectionHeight, andonScrollfor use withHeaderStandardAnimatedand aScrollView. Consumers callsetTitleSectionHeightfrom the title section’sonLayoutand passonScrollto theScrollView.Stories
HeaderStandardAnimated.stories.tsx: Default (title + back) and WithSubtitle, both with scrollable content and the hook wiring.Unit tests
HeaderStandardAnimated.test.tsx: Rendering (title, subtitle, children, testIDs via child prop objects), back/close button behavior and callbacks, andstartButtonIconPropspriority. Uses mocked Reanimated and safe area; shared values use a fullSharedValue<number>-shaped mock.useHeaderStandardAnimated.test.ts: Return shape, initial values, and thatsetTitleSectionHeightandonScrollupdate the shared values.Storybook
HeaderStandardAnimatedstories registered in.storybook/storybook.requires.js.Changelog
This PR is not end-user-facing; it adds a new internal header component for scroll-driven screens.
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/DSYS-287?atlOrigin=eyJpIjoiZThjYTU4Y2UyODcwNDJlMWJjMWQ0ZTQ1YmI0NjVhMGUiLCJwIjoiaiJ9
Manual testing steps
Screenshots/Recordings
Before
N/A – new component.
After
Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2026-02-27.at.13.21.34.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Low risk because this is additive and isolated to the component library (
components-temp) plus Storybook registration, with unit tests covering basic rendering and button-callback behavior.Overview
Adds
HeaderStandardAnimated, a newcomponents-tempheader wrapper aroundHeaderCompactStandardthat animates the centered title/subtitle in based onscrollYand a measuredtitleSectionHeightshared value.Introduces
useHeaderStandardAnimatedto provide the required ReanimatedSharedValues andonScrollhandler, along with Storybook stories demonstrating the scroll behavior and unit tests validating rendering and back/close/start-button callback precedence.Written by Cursor Bugbot for commit e06f5c5. This will update automatically on new commits. Configure here.