datetimepicker
datetimepicker copied to clipboard
feat: date picker startOnYearSelection
Summary
This pull request addresses issue #67 by adding a feature that allows the year picker to be shown first.
Implementation details:
- For DatePickerDialog: Used an OnShowListener so that when the dialog is displayed, the year view button is retrieved via the date_picker_header_year ID and programmatically clicked to show the year selector.
- For MaterialDatePicker: Retrieved the view responsible for displaying the year within the picker’s view group and programmatically triggered it to switch to the year selection view.
Test Plan
Tested using an Android emulator.
- Pixel 6 (Android 12) DatePickerDialog
https://github.com/user-attachments/assets/3f7dc078-9798-4ea5-9c41-0ae67defae82
- Pixel 6 (Android 12) MaterialDatePicker
https://github.com/user-attachments/assets/e71162b5-83ac-48cd-9a01-5d993b3389bd
- Pixel 7 (Android 14) DatePickerDialog
https://github.com/user-attachments/assets/510a7b30-4fc8-401c-ab71-d27ef8de60c9
- Pixel 7 (Android 14) MaterialDatePicker
https://github.com/user-attachments/assets/a0fd76e5-b606-405c-a0b5-c997a0017047
- Nexus 5X (Android 7) DatePickerDialog
https://github.com/user-attachments/assets/c1c63264-d1f1-4927-b507-ec1db23b3676
- Nexus 5X (Android 7) MaterialDatePicker
https://github.com/user-attachments/assets/236f5c58-38fe-4142-b168-47484482e5a1
What's required for testing (prerequisites)?
What are the steps to reproduce (after prerequisites)?
Compatibility
| OS | Implemented |
|---|---|
| iOS | ❌ |
| Android | ✅ |
Checklist
- [x] I have tested this on a device and a simulator
- [x] I added the documentation in
README.md - [x] I updated the typed files (TS and Flow)
- [x] I added a sample use of the API in the example project (
example/App.js) - [ ] I have added automated tests, either in JS or e2e tests, as applicable