Support `yearAndMonth` mode on iOS
Feature request
Hi, I just found out that iOS date picker supports year&month mode starting 17.4 and this isn't supported in this library yet.
Why it is needed
There were already some people requesting for this feature but I believe it was not possible at the time:
- https://github.com/react-native-datetimepicker/datetimepicker/issues/23
- https://github.com/react-native-datetimepicker/datetimepicker/issues/521
- https://github.com/react-native-datetimepicker/datetimepicker/issues/632
As a workaround, I tried copying it with two react-native-pickers but there're some limitations where
selectionColorcan't go transparent in the latest version (https://github.com/react-native-picker/picker/issues/242#issuecomment-2634157497)- Has different style from the year & month mode of UIDatePicker, e.g. gap between items & font styles
- Has limited number of rows even height of the picker is increased
I was able to somehow solve 1&2 by sticking to the older version(2.6.0) and adjusting the styles by changing font size and scaling the whole picker down, but 3 is something that can't be solved due to limitation of the picker itself.
Possible implementation
I'm not really familiar with native code but I guess adding one more entry in the enum here would at least make it work? https://github.com/react-native-datetimepicker/datetimepicker/blob/53033d2c108fd13f53d1a82569fe0e2142c96a4b/ios/RNDateTimePickerManager.m#L24-L29
But overall, I think following needs to be handled:
- [ ] Type support and validation on the JS side for
yearAndMonthmode - [ ] Map
yearAndMonthentry in iOS native code (above) - [ ] Use fallback mode in Android if
yearAndMonthis passed - [ ] Use fallback mode or warn in iOS if
yearAndMonthis passed and iOS version is below 17.4