Skip to content

feat: add Calendar component and replace mobile native date picker#139

Open
sverg-cb wants to merge 1 commit intomasterfrom
sverg/datepicker-mobile
Open

feat: add Calendar component and replace mobile native date picker#139
sverg-cb wants to merge 1 commit intomasterfrom
sverg/datepicker-mobile

Conversation

@sverg-cb
Copy link
Contributor

@sverg-cb sverg-cb commented Oct 31, 2025

What changed? Why?

New Features:

  • [Mobile] Standalone Calendar component cloned from cds-web and updated for cds-mobile

Enhancements:

  • [Mobile] Comprehensive accessibility with screen reader support for Calendar component
  • [Mobile] Replaced react-native-date-picker with Calendar component for DatePicker
  • [Mobile + Web] Added/replaced calendar style props to match the new "classnames/styles" APIs
  • [Mobile] Added custom a11y labels for Calendar navigation
  • [Mobile] Added accessibilityState to Tooltip trigger

Dependencies:

  • [Mobile] Remove react-native-date-picker (no longer needed)

Tests:

  • [Mobile] Add Storybook for Calendar, including DatePicker, standalone, and custom triggers
  • [Mobile] Add unit tests for Calendar and DatePicker
  • [Web] Add slot styling examples for Calendar storybook

Documentation:

  • [Mobile] Added mobile docs for Calendar
  • [Mobile + Web] Updated Calendar and DatePicker documentation to reflect the updated style APIs

UI changes

Calendar

iOS Old iOS New
N/A IMG_5190
Android Old Android New
N/A Screenshot_20260309_124735

DatePicker

iOS Old iOS New
mdp_ios_old IMG_5189
Android Old Android New
mdp_android_old Screenshot_20260309_125309

Accessibility

Using the Android Emulator with TalkBack

Screen_recording_20260309_130525.webm

Using a physical iPhone with VoiceOver

ScreenRecording_03-09-2026.14-34-23_1.MP4

Documentation

Calendar DatePicker
Screenshot 2026-03-09 at 12 58 01 PM Screenshot 2026-03-09 at 12 57 42 PM

Testing

How has it been tested?

  • Unit tests
  • Interaction tests
  • Pseudo State tests
  • Manual - Web
  • Manual - Android (Emulator / Device)
  • Manual - iOS (Emulator / Device)

Testing instructions

For unit and interaction tests, use yarn nx test mobile.

Refer to the mobile-app docs for information on how to test via Expo.

View local Docusaurus changes with yarn nx dev docs.

Change management

type=routine
risk=low
impact=sev5

automerge=false

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Oct 31, 2025

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 1
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1
CODEOWNERS 🟡 See below

🟡 CODEOWNERS

Code Owner Status Calculation
ui-systems-eng-team 🟡 0/1
Denominator calculation
Additional CODEOWNERS Requirement
Show calculation
Sum 0
0
From CODEOWNERS 1
Sum 1

@sverg-cb sverg-cb force-pushed the sverg/datepicker-mobile branch from d88e834 to 158cf94 Compare March 4, 2026 22:20
@sverg-cb sverg-cb force-pushed the sverg/datepicker-mobile branch from 158cf94 to 4b25572 Compare March 4, 2026 23:22
@sverg-cb sverg-cb requested a review from hcopp March 4, 2026 23:25
@sverg-cb sverg-cb marked this pull request as ready for review March 4, 2026 23:25
@sverg-cb sverg-cb force-pushed the sverg/datepicker-mobile branch from 12c3396 to c7cf5a9 Compare March 9, 2026 18:39
@sverg-cb sverg-cb changed the title feat(mobile): add Calendar component and replace native date picker feat: add Calendar component and replace mobile native date picker Mar 9, 2026
@sverg-cb sverg-cb force-pushed the sverg/datepicker-mobile branch from c7cf5a9 to 09e03c7 Compare March 9, 2026 18:43
@sverg-cb sverg-cb force-pushed the sverg/datepicker-mobile branch from 09e03c7 to 4ed26a2 Compare March 9, 2026 18:50
@sverg-cb sverg-cb force-pushed the sverg/datepicker-mobile branch from 4ed26a2 to 100b03a Compare March 9, 2026 19:47
New Features:

* [Mobile] Standalone Calendar component cloned from cds-web and updated for cds-mobile

Enhancements:

* [Mobile] Comprehensive accessibility with screen reader support for Calendar component
* [Mobile] Replaced react-native-date-picker with Calendar component for DatePicker
* [Mobile + Web] Added/replaced calendar style props to match the new "classnames/styles" APIs
* [Mobile] Added custom a11y labels for Calendar navigation

Dependencies:

* [Mobile] Remove react-native-date-picker (no longer needed)

Tests:

* [Mobile] Add Storybook for Calendar, including DatePicker, standalone, and custom triggers
* [Mobile] Add unit tests for Calendar and DatePicker
* [Web] Add slot styling examples for Calendar storybook

Documentation:

* [Mobile] Added mobile docs for Calendar
* [Mobile + Web] Updated Calendar and DatePicker documentation to reflect the updated style APIs
@sverg-cb sverg-cb force-pushed the sverg/datepicker-mobile branch from 100b03a to c4c11b1 Compare March 9, 2026 21:41
@sverg-cb sverg-cb requested a review from hcopp March 9, 2026 21:42
* @default 'Today'
*/
todayAccessibilityHint?: string;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for any confusion on this, we don't want to include the base props in common. We will just have them both inside of Calendar.tsx and DatePicker.tsx on web and mobile but they should match.

*/
reduceMotion?: boolean;
/** Callback fired when the open animation completes. */
onOpenComplete?: () => void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for a11y?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regarding DatePicker, yes

* announce state (e.g. "dimmed" on iOS) and do not activate on double-tap;
* touch/press is unchanged.
*/
accessibilityState?: AccessibilityState;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we still plan on having tooltip changes? Thought those weren't needed.

/** Custom class name for the date cell (CalendarPressable). */
dayCellClassName?: string;
/** Custom style for the date cell (CalendarPressable). */
dayCellStyle?: React.CSSProperties;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't have style/className one offs, it should all be inside of styles/classNames

<Calendar
ref={calendarRef}
className={calendarClassName}
classNames={classNames?.calendar}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I think we have been trying to flatten styles here but please check out Stepper, Select, and Carousel as those are newer components. Also not a big deal if someone can't customize the inner workings of calendar from a root, especially if we let them override it somehow. We could look at a "CalendarComponent" prop or something.

disabled?: StyleProp<TextStyle>;
highlighted?: StyleProp<TextStyle>;
};
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably don't need this level of detail with dayCell and text.

)}
</HStack>

<VStack style={styles?.content}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a separate VStack here? double check on web as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants