@hero-design/rn 8.84.0 → 8.84.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- (node:2999) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
1
+ (node:3048) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
2
2
  (Use `node --trace-warnings ...` to show where the warning was created)
3
3
  
4
4
  src/index.ts → lib/index.js, es/index.js...
5
5
  (!) [plugin replace] @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
6
6
  (!) [plugin node-resolve] preferring built-in module 'events' over local alternative at '/home/runner/work/hero-design/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning.or passing a function to 'preferBuiltins' to provide more fine-grained control over which built-in modules to prefer.
7
- created lib/index.js, es/index.js in 52.3s
7
+ created lib/index.js, es/index.js in 50.4s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.84.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3582](https://github.com/Thinkei/hero-design/pull/3582) [`2200c47a7d703b4f1d558370307a7de3529c4823`](https://github.com/Thinkei/hero-design/commit/2200c47a7d703b4f1d558370307a7de3529c4823) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [DatePicker] Add custom locale support for iOS
8
+
3
9
  ## 8.84.0
4
10
 
5
11
  ### Minor Changes
package/es/index.js CHANGED
@@ -14502,7 +14502,8 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
14502
14502
  _ref$supportedOrienta = _ref.supportedOrientations,
14503
14503
  supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta,
14504
14504
  _ref$variant = _ref.variant,
14505
- variant = _ref$variant === void 0 ? 'default' : _ref$variant;
14505
+ variant = _ref$variant === void 0 ? 'default' : _ref$variant,
14506
+ locale = _ref.locale;
14506
14507
  var _useState = useState(getDateValue(value || new Date(), minDate, maxDate)),
14507
14508
  _useState2 = _slicedToArray(_useState, 2),
14508
14509
  selectingDate = _useState2[0],
@@ -14557,6 +14558,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
14557
14558
  supportedOrientations: supportedOrientations
14558
14559
  }, /*#__PURE__*/React__default.createElement(StyledPickerWrapper$1, null, variant === 'month-year' ? /*#__PURE__*/React__default.createElement(MonthYearPickerViewIOS, {
14559
14560
  value: value,
14561
+ locale: locale,
14560
14562
  minimumDate: minDate,
14561
14563
  maximumDate: maxDate,
14562
14564
  onChange: function onChange(date) {
@@ -14568,6 +14570,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
14568
14570
  flex: 1
14569
14571
  }
14570
14572
  }) : null, variant === 'default' ? /*#__PURE__*/React__default.createElement(DateTimePicker, {
14573
+ locale: locale,
14571
14574
  testID: "datePickerIOS",
14572
14575
  value: selectingDate,
14573
14576
  minimumDate: minDate,
package/lib/index.js CHANGED
@@ -14530,7 +14530,8 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
14530
14530
  _ref$supportedOrienta = _ref.supportedOrientations,
14531
14531
  supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta,
14532
14532
  _ref$variant = _ref.variant,
14533
- variant = _ref$variant === void 0 ? 'default' : _ref$variant;
14533
+ variant = _ref$variant === void 0 ? 'default' : _ref$variant,
14534
+ locale = _ref.locale;
14534
14535
  var _useState = React.useState(getDateValue(value || new Date(), minDate, maxDate)),
14535
14536
  _useState2 = _slicedToArray(_useState, 2),
14536
14537
  selectingDate = _useState2[0],
@@ -14585,6 +14586,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
14585
14586
  supportedOrientations: supportedOrientations
14586
14587
  }, /*#__PURE__*/React__namespace.default.createElement(StyledPickerWrapper$1, null, variant === 'month-year' ? /*#__PURE__*/React__namespace.default.createElement(reactNativeMonthYearPicker.MonthYearPickerViewIOS, {
14587
14588
  value: value,
14589
+ locale: locale,
14588
14590
  minimumDate: minDate,
14589
14591
  maximumDate: maxDate,
14590
14592
  onChange: function onChange(date) {
@@ -14596,6 +14598,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
14596
14598
  flex: 1
14597
14599
  }
14598
14600
  }) : null, variant === 'default' ? /*#__PURE__*/React__namespace.default.createElement(DateTimePicker__default.default, {
14601
+ locale: locale,
14599
14602
  testID: "datePickerIOS",
14600
14603
  value: selectingDate,
14601
14604
  minimumDate: minDate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.84.0",
3
+ "version": "8.84.1",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -35,6 +35,7 @@ const DatePickerIOS = ({
35
35
  testID,
36
36
  supportedOrientations = ['portrait'],
37
37
  variant = 'default',
38
+ locale,
38
39
  }: DatePickerIOSProps) => {
39
40
  const [selectingDate, setSelectingDate] = useState<Date>(
40
41
  getDateValue(value || new Date(), minDate, maxDate)
@@ -83,6 +84,7 @@ const DatePickerIOS = ({
83
84
  {variant === 'month-year' ? (
84
85
  <MonthYearPickerViewIOS
85
86
  value={value}
87
+ locale={locale}
86
88
  minimumDate={minDate}
87
89
  maximumDate={maxDate}
88
90
  onChange={(date: Date | undefined) => {
@@ -95,6 +97,7 @@ const DatePickerIOS = ({
95
97
  ) : null}
96
98
  {variant === 'default' ? (
97
99
  <DateTimePicker
100
+ locale={locale}
98
101
  testID="datePickerIOS"
99
102
  value={selectingDate}
100
103
  minimumDate={minDate}
@@ -102,6 +102,40 @@ describe('DatePickerIOS', () => {
102
102
  expect(onChange).toBeCalledWith(new Date('December 17, 1995'));
103
103
  });
104
104
 
105
+ it('renders correctly with custom locale', () => {
106
+ const onChange = jest.fn();
107
+ const { getByText, queryByTestId, toJSON } = renderWithTheme(
108
+ <DatePickerIOS
109
+ locale="zh-CN"
110
+ value={new Date('December 21, 1995')}
111
+ label="Start date"
112
+ confirmLabel="Confirm"
113
+ onChange={onChange}
114
+ />
115
+ );
116
+
117
+ expect(getByText('Start date')).toBeDefined();
118
+ expect(queryByTestId('text-input').props.value).toBe('21/12/1995');
119
+ expect(queryByTestId('datePickerIOS')).toBeNull();
120
+
121
+ // Open date picker
122
+ fireEvent.press(getByText('Start date'));
123
+ expect(queryByTestId('datePickerIOS')).toBeTruthy();
124
+
125
+ expect(toJSON()).toMatchSnapshot();
126
+
127
+ // Change date
128
+ fireEvent(
129
+ queryByTestId('datePickerIOS'),
130
+ 'onChange',
131
+ null,
132
+ new Date('December 17, 1995')
133
+ );
134
+ fireEvent.press(getByText('Confirm'));
135
+
136
+ expect(onChange).toBeCalledWith(new Date('December 17, 1995'));
137
+ });
138
+
105
139
  it('renders correct help text', () => {
106
140
  const { getByText } = renderWithTheme(
107
141
  <DatePickerIOS