From 6637c03fbb430265e8cdac2cd3972bddfde1c75a Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Sat, 11 Dec 2021 15:20:07 +0100 Subject: [PATCH] feat: remove locale prop (#540) BREAKING CHANGE: locale prop removed --- README.md | 17 ++++++++--------- ios/RNDateTimePickerManager.m | 1 - src/datetimepicker.ios.js | 2 -- src/index.d.ts | 5 ----- src/types.js | 5 ----- 5 files changed, 8 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 4bbb438c..714a9279 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,6 @@ React Native date & time picker component for iOS, Android and Windows. - [`firstDayOfWeek` (`optional`, `Windows only`)](#firstDayOfWeek-optional-windows-only) - [`textColor` (`optional`, `iOS only`)](#textColor-optional-ios-only) - [`themeVariant` (`optional`, `iOS only`)](#themeVariant-optional-ios-only) - - [`locale` (`optional`, `iOS only`)](#locale-optional-ios-only) - [`is24Hour` (`optional`, `Windows and Android only`)](#is24hour-optional-windows-and-android-only) - [`neutralButtonLabel` (`optional`, `Android only`)](#neutralbuttonlabel-optional-android-only) - [`minuteInterval` (`optional`)](#minuteinterval-optional) @@ -177,6 +176,14 @@ export const App = () => { }; ``` +## Locale note + +On Android, the picker will be controlled by the system locale. If you wish to change it, [see instructions here](https://stackoverflow.com/a/2900144/2070942). + +On iOS, the locale can be controlled from xCode, as [documented here](https://developer.apple.com/documentation/xcode/adding-support-for-languages-and-regions). + +For Expo, follow the [localization docs](https://docs.expo.dev/distribution/app-stores/#localizing-your-ios-app). + ## Props > Please note that this library currently exposes functionality from [`UIDatePicker`](https://developer.apple.com/documentation/uikit/uidatepicker?language=objc) on iOS and [DatePickerDialog](https://developer.android.com/reference/android/app/DatePickerDialog) + [TimePickerDialog](https://developer.android.com/reference/android/app/TimePickerDialog) on Android, and [`CalendarDatePicker`](https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/calendar-date-picker) +[TimePicker](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.timepicker?view=winrt-19041) on Windows. @@ -310,14 +317,6 @@ Allows changing of the textColor of the date picker. Has effect only when `displ ``` -#### `locale` (`optional`, `iOS only`) - -Allows changing of the locale of the component. By default it uses the device's locale. - -```js - -``` - #### `is24Hour` (`optional`, `Windows and Android only`) Allows changing of the time picker to a 24 hour format. By default, this value is decided automatcially based on the user's chosen locale and other preferences. diff --git a/ios/RNDateTimePickerManager.m b/ios/RNDateTimePickerManager.m index 84a73f8b..f3f6f355 100644 --- a/ios/RNDateTimePickerManager.m +++ b/ios/RNDateTimePickerManager.m @@ -97,7 +97,6 @@ + (NSString*) datepickerStyleToString: (UIDatePickerStyle) style API_AVAILABLE( } RCT_EXPORT_VIEW_PROPERTY(date, NSDate) -RCT_EXPORT_VIEW_PROPERTY(locale, NSLocale) RCT_EXPORT_VIEW_PROPERTY(minimumDate, NSDate) RCT_EXPORT_VIEW_PROPERTY(maximumDate, NSDate) RCT_EXPORT_VIEW_PROPERTY(minuteInterval, NSInteger) diff --git a/src/datetimepicker.ios.js b/src/datetimepicker.ios.js index 6821ac12..104f5ece 100644 --- a/src/datetimepicker.ios.js +++ b/src/datetimepicker.ios.js @@ -43,7 +43,6 @@ const getDisplaySafe = (display: IOSDisplay): IOSDisplay => { export default function Picker({ value, - locale, maximumDate, minimumDate, style, @@ -116,7 +115,6 @@ export default function Picker({ ref={_picker} style={StyleSheet.compose(heightStyle, style)} date={dates.value} - locale={locale !== null && locale !== '' ? locale : undefined} maximumDate={dates.maximumDate} minimumDate={dates.minimumDate} mode={mode} diff --git a/src/index.d.ts b/src/index.d.ts index c3e95ad7..2efec9a0 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -67,11 +67,6 @@ export type IOSNativeProps = Readonly< BaseProps & { date?: Date; - /** - * The date picker locale. - */ - locale?: string; - /** * The interval at which minutes can be selected. */ diff --git a/src/types.js b/src/types.js index e95b511d..3158b690 100644 --- a/src/types.js +++ b/src/types.js @@ -88,11 +88,6 @@ export type IOSNativeProps = $ReadOnly<{| ...BaseProps, date?: ?Date, - /** - * The date picker locale. - */ - locale?: ?string, - /** * The interval at which minutes can be selected. */