Skip to content

Commit

Permalink
feat: remove locale prop (#540)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: locale prop removed
  • Loading branch information
vonovak authored Dec 11, 2021
1 parent ecf8f26 commit 6637c03
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 22 deletions.
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -310,14 +317,6 @@ Allows changing of the textColor of the date picker. Has effect only when `displ
<RNDateTimePicker textColor="red" />
```

#### `locale` (`optional`, `iOS only`)

Allows changing of the locale of the component. By default it uses the device's locale.

```js
<RNDateTimePicker locale="es-ES" />
```

#### `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.
Expand Down
1 change: 0 additions & 1 deletion ios/RNDateTimePickerManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions src/datetimepicker.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const getDisplaySafe = (display: IOSDisplay): IOSDisplay => {

export default function Picker({
value,
locale,
maximumDate,
minimumDate,
style,
Expand Down Expand Up @@ -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}
Expand Down
5 changes: 0 additions & 5 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
5 changes: 0 additions & 5 deletions src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit 6637c03

Please sign in to comment.