@aws-amplify/ui-react-native 1.2.3 → 1.2.5

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @aws-amplify/ui-react-native
2
2
 
3
+ ## 1.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3198](https://github.com/aws-amplify/amplify-ui/pull/3198) [`9cb6696a2`](https://github.com/aws-amplify/amplify-ui/commit/9cb6696a227b7c5b4ce36920c2093289fa45cc95) Thanks [@ioanabrooks](https://github.com/ioanabrooks)! - fix(ui-react-native): Fixes an issue where undefined values end up in the state machine causing internal errors to be exposed to end users.
8
+
9
+ - Updated dependencies [[`57f1a3f43`](https://github.com/aws-amplify/amplify-ui/commit/57f1a3f438b8288ffda46764f7a87e1739e61313), [`dd9de348a`](https://github.com/aws-amplify/amplify-ui/commit/dd9de348abcafdcd721600f543d58353957dac25), [`4d652033e`](https://github.com/aws-amplify/amplify-ui/commit/4d652033e120daa82665b4bb4035b56fa8d33bf8)]:
10
+ - @aws-amplify/ui@5.5.2
11
+ - @aws-amplify/ui-react-core@2.1.10
12
+
13
+ ## 1.2.4
14
+
15
+ ### Patch Changes
16
+
17
+ - [#3283](https://github.com/aws-amplify/amplify-ui/pull/3283) [`98a632137`](https://github.com/aws-amplify/amplify-ui/commit/98a63213766d598ed6a64a06b53fffc408d547fd) Thanks [@wlee221](https://github.com/wlee221)! - Trim non-password fields on Authenticator forms. This will prevent unnecessary validation messages from showing up.
18
+
19
+ - Updated dependencies [[`98a632137`](https://github.com/aws-amplify/amplify-ui/commit/98a63213766d598ed6a64a06b53fffc408d547fd), [`01912077c`](https://github.com/aws-amplify/amplify-ui/commit/01912077c6d4fcdd3cbe9b6de2bb53fc490d0f41), [`08111e7e6`](https://github.com/aws-amplify/amplify-ui/commit/08111e7e60af5baf3b7e408f9545514c34e09078)]:
20
+ - @aws-amplify/ui@5.5.1
21
+ - @aws-amplify/ui-react-core@2.1.9
22
+
3
23
  ## 1.2.3
4
24
 
5
25
  ### Patch Changes
@@ -62,7 +62,7 @@ export default function useFieldValues({ componentName, fields = [], handleBlur,
62
62
  const handleFormSubmit = () => {
63
63
  const submitValue = isRadioFieldComponent
64
64
  ? values
65
- : fieldsWithHandlers.reduce((acc, { name, value, type }) => {
65
+ : fieldsWithHandlers.reduce((acc, { name, value = '', type }) => {
66
66
  /*
67
67
  For phone numbers pass the first 3 charactes from value as dialCode until we support a dialCode picker
68
68
  */
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.2.3";
1
+ export declare const VERSION = "1.2.5";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.2.3';
1
+ export const VERSION = '1.2.5';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react-native",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -43,8 +43,8 @@
43
43
  "type-fest": "^2.3.4"
44
44
  },
45
45
  "dependencies": {
46
- "@aws-amplify/ui": "5.5.0",
47
- "@aws-amplify/ui-react-core": "2.1.8"
46
+ "@aws-amplify/ui": "5.5.2",
47
+ "@aws-amplify/ui-react-core": "2.1.10"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "aws-amplify": ">= 5.0.1",
@@ -271,6 +271,32 @@ describe('useFieldValues', () => {
271
271
  });
272
272
  });
273
273
 
274
+ it('does not submit undefined values for fields', () => {
275
+ const textField = {
276
+ label: 'test',
277
+ type: 'default',
278
+ name: 'testDefault',
279
+ } as TextFieldOptionsType;
280
+ const phoneTextField = {
281
+ type: 'phone',
282
+ name: 'testPhone',
283
+ } as TextFieldOptionsType;
284
+ const { result } = renderHook(() =>
285
+ useFieldValues({
286
+ ...props,
287
+ fields: [textField, phoneTextField],
288
+ })
289
+ );
290
+
291
+ result.current.handleFormSubmit();
292
+ expect(props.handleSubmit).toHaveBeenCalledTimes(1);
293
+ expect(props.handleSubmit).toHaveBeenCalledWith({
294
+ country_code: '',
295
+ [textField.name]: '',
296
+ [phoneTextField.name]: '',
297
+ });
298
+ });
299
+
274
300
  it('submits the expected values for phone fields', () => {
275
301
  const phoneTextField = {
276
302
  type: 'phone',
@@ -294,7 +320,7 @@ describe('useFieldValues', () => {
294
320
  expect(props.handleSubmit).toHaveBeenCalledTimes(1);
295
321
  expect(props.handleSubmit).toHaveBeenCalledWith({
296
322
  country_code: mockValue.substring(0, 3),
297
- [textField.name]: mockValue.substring(3, mockValue.length),
323
+ [phoneTextField.name]: mockValue.substring(3, mockValue.length),
298
324
  });
299
325
  });
300
326
  });
@@ -96,7 +96,7 @@ export default function useFieldValues<FieldType extends TypedField>({
96
96
  const handleFormSubmit = () => {
97
97
  const submitValue = isRadioFieldComponent
98
98
  ? values
99
- : fieldsWithHandlers.reduce((acc, { name, value, type }) => {
99
+ : fieldsWithHandlers.reduce((acc, { name, value = '', type }) => {
100
100
  /*
101
101
  For phone numbers pass the first 3 charactes from value as dialCode until we support a dialCode picker
102
102
  */
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.2.3';
1
+ export const VERSION = '1.2.5';