@aws-amplify/ui-react-native 1.2.0 → 1.2.2
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 +18 -0
- package/dist/Authenticator/common/DefaultFormFields/DefaultTextFormFields.js +2 -7
- package/dist/Authenticator/common/DefaultFormFields/Field.d.ts +6 -0
- package/dist/Authenticator/common/DefaultFormFields/Field.js +34 -0
- package/dist/Authenticator/common/DefaultFormFields/types.d.ts +3 -0
- package/dist/InAppMessaging/components/CarouselMessage/CarouselMessage.js +2 -1
- package/dist/InAppMessaging/constants.d.ts +1 -0
- package/dist/InAppMessaging/constants.js +1 -0
- package/dist/primitives/Carousel/types.d.ts +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/src/Authenticator/Defaults/ConfirmResetPassword/__tests__/__snapshots__/ConfirmResetPassword.spec.tsx.snap +44 -0
- package/src/Authenticator/Defaults/ForceNewPassword/__tests__/__snapshots__/ForceNewPassword.spec.tsx.snap +33 -0
- package/src/Authenticator/Defaults/SignIn/__tests__/__snapshots__/SignIn.spec.tsx.snap +33 -0
- package/src/Authenticator/Defaults/SignUp/__tests__/__snapshots__/SignUp.spec.tsx.snap +110 -0
- package/src/Authenticator/common/DefaultFormFields/DefaultTextFormFields.tsx +2 -13
- package/src/Authenticator/common/DefaultFormFields/Field.tsx +50 -0
- package/src/Authenticator/common/DefaultFormFields/types.ts +4 -0
- package/src/InAppMessaging/components/BannerMessage/__tests__/BannerMessage.spec.tsx +46 -33
- package/src/InAppMessaging/components/BannerMessage/__tests__/__snapshots__/BannerMessage.spec.tsx.snap +372 -0
- package/src/InAppMessaging/components/CarouselMessage/CarouselMessage.tsx +2 -0
- package/src/InAppMessaging/components/CarouselMessage/__tests__/CarouselMessage.spec.tsx +64 -27
- package/src/InAppMessaging/components/CarouselMessage/__tests__/CarouselMessageItem.spec.tsx +5 -11
- package/src/InAppMessaging/components/CarouselMessage/__tests__/__snapshots__/CarouselMessage.spec.tsx.snap +38 -0
- package/src/InAppMessaging/components/FullScreenMessage/__tests__/FullScreenMessage.spec.tsx +5 -5
- package/src/InAppMessaging/components/InAppMessageDisplay/__tests__/InAppMessageDisplay.spec.tsx +3 -3
- package/src/InAppMessaging/components/MessageWrapper/__tests__/MessageWrapper.spec.tsx +3 -3
- package/src/InAppMessaging/components/ModalMessage/__tests__/ModalMessage.spec.tsx +48 -34
- package/src/InAppMessaging/components/ModalMessage/__tests__/__snapshots__/ModalMessage.spec.tsx.snap +372 -0
- package/src/InAppMessaging/components/withInAppMessaging/__tests__/withInAppMessaging.spec.tsx +3 -3
- package/src/InAppMessaging/constants.ts +1 -0
- package/src/primitives/Carousel/__tests__/Carousel.spec.tsx +53 -64
- package/src/primitives/Carousel/__tests__/CarouselPageIndicator.spec.tsx +46 -44
- package/src/primitives/Carousel/__tests__/__snapshots__/Carousel.spec.tsx.snap +94 -0
- package/src/primitives/Carousel/types.ts +1 -0
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @aws-amplify/ui-react-native
|
|
2
2
|
|
|
3
|
+
## 1.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`2912fe3af`](https://github.com/aws-amplify/amplify-ui/commit/2912fe3af6f29cde562a35e931bc2e3a0de470ed), [`ea1b10a2c`](https://github.com/aws-amplify/amplify-ui/commit/ea1b10a2c802b08ee019669ba442d7446f23bd05)]:
|
|
8
|
+
- @aws-amplify/ui@5.4.2
|
|
9
|
+
- @aws-amplify/ui-react-core@2.1.7
|
|
10
|
+
|
|
11
|
+
## 1.2.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#3216](https://github.com/aws-amplify/amplify-ui/pull/3216) [`a4c5feea8`](https://github.com/aws-amplify/amplify-ui/commit/a4c5feea83057dc6fd615e2547c9456a81302060) Thanks [@calebpollman](https://github.com/calebpollman)! - fix(rna): add Field component to address iOS TextInput secureTextEntry bug
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`db8f019a7`](https://github.com/aws-amplify/amplify-ui/commit/db8f019a7737c4762ff19c1b03c7c06625277989), [`cbbf51f53`](https://github.com/aws-amplify/amplify-ui/commit/cbbf51f53c428dc378d8986ae27c3bf9e52f67ab)]:
|
|
18
|
+
- @aws-amplify/ui@5.4.1
|
|
19
|
+
- @aws-amplify/ui-react-core@2.1.6
|
|
20
|
+
|
|
3
21
|
## 1.2.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { getErrors } from '@aws-amplify/ui';
|
|
4
|
-
import
|
|
4
|
+
import Field from './Field';
|
|
5
5
|
import { FieldErrors } from './FieldErrors';
|
|
6
6
|
const DefaultTextFormFields = ({ fieldContainerStyle, fieldErrorsContainer, fieldErrorStyle, fieldStyle, fields = [], isPending, style, validationErrors, }) => {
|
|
7
7
|
const formFields = fields.map(({ name, type, ...field }) => {
|
|
8
8
|
const errors = validationErrors ? getErrors(validationErrors?.[name]) : [];
|
|
9
9
|
const hasError = errors?.length > 0;
|
|
10
|
-
const Field = type === 'password'
|
|
11
|
-
? PasswordField
|
|
12
|
-
: type === 'phone'
|
|
13
|
-
? PhoneNumberField
|
|
14
|
-
: TextField;
|
|
15
10
|
return (<Fragment key={name}>
|
|
16
|
-
<Field {...field} disabled={isPending} error={hasError} fieldStyle={fieldStyle} key={name} style={fieldContainerStyle}/>
|
|
11
|
+
<Field {...field} disabled={isPending} error={hasError} fieldStyle={fieldStyle} key={name} style={fieldContainerStyle} type={type}/>
|
|
17
12
|
<FieldErrors errors={errors} errorStyle={fieldErrorStyle} style={fieldErrorsContainer}/>
|
|
18
13
|
</Fragment>);
|
|
19
14
|
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextInput } from 'react-native';
|
|
3
|
+
import { PasswordField, PhoneNumberField, TextField, } from '../../../primitives';
|
|
4
|
+
import { platform } from '../../../utils';
|
|
5
|
+
const { IS_IOS } = platform;
|
|
6
|
+
// to prevent issues with iOS when multiple `TextInput` components have `secureTextEntry`
|
|
7
|
+
// set to `true`, insert a "hidden" `TextInput` after each `PasswordField`
|
|
8
|
+
// Issue reference: https://github.com/facebook/react-native/issues/21911
|
|
9
|
+
const HIDDEN_INPUT_PROPS = {
|
|
10
|
+
// prevent iOS screen reader from picking up element
|
|
11
|
+
accessibilityElementsHidden: true,
|
|
12
|
+
// prevent `TextInput` from capturing touch events
|
|
13
|
+
pointerEvents: 'none',
|
|
14
|
+
// this workaround requires the `height` and `width` applied to the `TextInput`
|
|
15
|
+
// are greater than `0`
|
|
16
|
+
// NOTE: do not attempt to set an opacity value here to further hide the element,
|
|
17
|
+
// it will cause the issues mitigated by this workaround to re-surface
|
|
18
|
+
style: { backgroundColor: 'transparent', height: 0.1, width: 0.1 },
|
|
19
|
+
};
|
|
20
|
+
const HiddenInput = () => <TextInput {...HIDDEN_INPUT_PROPS}/>;
|
|
21
|
+
const Field = ({ type, ...rest }) => {
|
|
22
|
+
const isPassword = type === 'password';
|
|
23
|
+
const Field = isPassword
|
|
24
|
+
? PasswordField
|
|
25
|
+
: type === 'phone'
|
|
26
|
+
? PhoneNumberField
|
|
27
|
+
: TextField;
|
|
28
|
+
return IS_IOS && isPassword ? (<>
|
|
29
|
+
<Field {...rest}/>
|
|
30
|
+
<HiddenInput />
|
|
31
|
+
</>) : (<Field {...rest}/>);
|
|
32
|
+
};
|
|
33
|
+
Field.displayName = 'Field';
|
|
34
|
+
export default Field;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
2
2
|
import { AuthenticatorFormFieldsComponent } from '@aws-amplify/ui-react-core';
|
|
3
3
|
import { RadioFieldOptions, TextFieldOptionsType } from '../../hooks';
|
|
4
|
+
export declare type FieldProps = Omit<TextFieldOptionsType, 'name'> & {
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
};
|
|
4
7
|
export interface FieldErrorsProps {
|
|
5
8
|
errors: string[];
|
|
6
9
|
errorStyle?: StyleProp<TextStyle>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { Carousel } from '../../../primitives';
|
|
3
|
+
import { IN_APP_MESSAGING_TEST_ID } from '../../constants';
|
|
3
4
|
import { MessageWrapper } from '../MessageWrapper';
|
|
4
5
|
import CarouselMessageItem from './CarouselMessageItem';
|
|
5
6
|
import { defaultStyle } from './styles';
|
|
@@ -15,6 +16,6 @@ export default function CarouselMessage(props) {
|
|
|
15
16
|
}), [style]);
|
|
16
17
|
const renderItem = ({ item }) => (<CarouselMessageItem {...item} {...rest}/>);
|
|
17
18
|
return (<MessageWrapper disableSafeAreaView>
|
|
18
|
-
<Carousel data={data ?? []} renderItem={renderItem} indicatorActiveStyle={indicatorStyle.active} indicatorInactiveStyle={indicatorStyle.inactive}/>
|
|
19
|
+
<Carousel data={data ?? []} renderItem={renderItem} indicatorActiveStyle={indicatorStyle.active} indicatorInactiveStyle={indicatorStyle.inactive} testID={IN_APP_MESSAGING_TEST_ID.CAROUSEL}/>
|
|
19
20
|
</MessageWrapper>);
|
|
20
21
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.2.
|
|
1
|
+
export declare const VERSION = "1.2.2";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '1.2.
|
|
1
|
+
export const VERSION = '1.2.2';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react-native",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
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.4.
|
|
47
|
-
"@aws-amplify/ui-react-core": "2.1.
|
|
46
|
+
"@aws-amplify/ui": "5.4.2",
|
|
47
|
+
"@aws-amplify/ui-react-core": "2.1.7"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"aws-amplify": ">= 5.0.1",
|
|
@@ -249,6 +249,17 @@ Array [
|
|
|
249
249
|
</View>
|
|
250
250
|
</View>
|
|
251
251
|
</View>
|
|
252
|
+
<TextInput
|
|
253
|
+
accessibilityElementsHidden={true}
|
|
254
|
+
pointerEvents="none"
|
|
255
|
+
style={
|
|
256
|
+
Object {
|
|
257
|
+
"backgroundColor": "transparent",
|
|
258
|
+
"height": 0.1,
|
|
259
|
+
"width": 0.1,
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/>
|
|
252
263
|
<View
|
|
253
264
|
style={
|
|
254
265
|
Array [
|
|
@@ -387,6 +398,17 @@ Array [
|
|
|
387
398
|
</View>
|
|
388
399
|
</View>
|
|
389
400
|
</View>
|
|
401
|
+
<TextInput
|
|
402
|
+
accessibilityElementsHidden={true}
|
|
403
|
+
pointerEvents="none"
|
|
404
|
+
style={
|
|
405
|
+
Object {
|
|
406
|
+
"backgroundColor": "transparent",
|
|
407
|
+
"height": 0.1,
|
|
408
|
+
"width": 0.1,
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
/>
|
|
390
412
|
</View>,
|
|
391
413
|
<View
|
|
392
414
|
accessibilityRole="alert"
|
|
@@ -795,6 +817,17 @@ Array [
|
|
|
795
817
|
</View>
|
|
796
818
|
</View>
|
|
797
819
|
</View>
|
|
820
|
+
<TextInput
|
|
821
|
+
accessibilityElementsHidden={true}
|
|
822
|
+
pointerEvents="none"
|
|
823
|
+
style={
|
|
824
|
+
Object {
|
|
825
|
+
"backgroundColor": "transparent",
|
|
826
|
+
"height": 0.1,
|
|
827
|
+
"width": 0.1,
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
/>
|
|
798
831
|
<View
|
|
799
832
|
style={
|
|
800
833
|
Array [
|
|
@@ -933,6 +966,17 @@ Array [
|
|
|
933
966
|
</View>
|
|
934
967
|
</View>
|
|
935
968
|
</View>
|
|
969
|
+
<TextInput
|
|
970
|
+
accessibilityElementsHidden={true}
|
|
971
|
+
pointerEvents="none"
|
|
972
|
+
style={
|
|
973
|
+
Object {
|
|
974
|
+
"backgroundColor": "transparent",
|
|
975
|
+
"height": 0.1,
|
|
976
|
+
"width": 0.1,
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
/>
|
|
936
980
|
</View>,
|
|
937
981
|
<View
|
|
938
982
|
accessibilityRole="button"
|
|
@@ -141,6 +141,17 @@ Array [
|
|
|
141
141
|
</View>
|
|
142
142
|
</View>
|
|
143
143
|
</View>
|
|
144
|
+
<TextInput
|
|
145
|
+
accessibilityElementsHidden={true}
|
|
146
|
+
pointerEvents="none"
|
|
147
|
+
style={
|
|
148
|
+
Object {
|
|
149
|
+
"backgroundColor": "transparent",
|
|
150
|
+
"height": 0.1,
|
|
151
|
+
"width": 0.1,
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/>
|
|
144
155
|
</View>,
|
|
145
156
|
<View
|
|
146
157
|
accessibilityRole="alert"
|
|
@@ -450,6 +461,17 @@ Array [
|
|
|
450
461
|
</View>
|
|
451
462
|
</View>
|
|
452
463
|
</View>
|
|
464
|
+
<TextInput
|
|
465
|
+
accessibilityElementsHidden={true}
|
|
466
|
+
pointerEvents="none"
|
|
467
|
+
style={
|
|
468
|
+
Object {
|
|
469
|
+
"backgroundColor": "transparent",
|
|
470
|
+
"height": 0.1,
|
|
471
|
+
"width": 0.1,
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
/>
|
|
453
475
|
</View>,
|
|
454
476
|
<View
|
|
455
477
|
accessibilityRole="button"
|
|
@@ -704,6 +726,17 @@ Array [
|
|
|
704
726
|
</View>
|
|
705
727
|
</View>
|
|
706
728
|
</View>
|
|
729
|
+
<TextInput
|
|
730
|
+
accessibilityElementsHidden={true}
|
|
731
|
+
pointerEvents="none"
|
|
732
|
+
style={
|
|
733
|
+
Object {
|
|
734
|
+
"backgroundColor": "transparent",
|
|
735
|
+
"height": 0.1,
|
|
736
|
+
"width": 0.1,
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
/>
|
|
707
740
|
<View
|
|
708
741
|
style={
|
|
709
742
|
Object {
|
|
@@ -249,6 +249,17 @@ Array [
|
|
|
249
249
|
</View>
|
|
250
250
|
</View>
|
|
251
251
|
</View>
|
|
252
|
+
<TextInput
|
|
253
|
+
accessibilityElementsHidden={true}
|
|
254
|
+
pointerEvents="none"
|
|
255
|
+
style={
|
|
256
|
+
Object {
|
|
257
|
+
"backgroundColor": "transparent",
|
|
258
|
+
"height": 0.1,
|
|
259
|
+
"width": 0.1,
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/>
|
|
252
263
|
</View>,
|
|
253
264
|
<View
|
|
254
265
|
accessibilityRole="button"
|
|
@@ -656,6 +667,17 @@ Array [
|
|
|
656
667
|
</View>
|
|
657
668
|
</View>
|
|
658
669
|
</View>
|
|
670
|
+
<TextInput
|
|
671
|
+
accessibilityElementsHidden={true}
|
|
672
|
+
pointerEvents="none"
|
|
673
|
+
style={
|
|
674
|
+
Object {
|
|
675
|
+
"backgroundColor": "transparent",
|
|
676
|
+
"height": 0.1,
|
|
677
|
+
"width": 0.1,
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
/>
|
|
659
681
|
</View>,
|
|
660
682
|
<View
|
|
661
683
|
accessibilityRole="button"
|
|
@@ -1015,6 +1037,17 @@ Array [
|
|
|
1015
1037
|
</View>
|
|
1016
1038
|
</View>
|
|
1017
1039
|
</View>
|
|
1040
|
+
<TextInput
|
|
1041
|
+
accessibilityElementsHidden={true}
|
|
1042
|
+
pointerEvents="none"
|
|
1043
|
+
style={
|
|
1044
|
+
Object {
|
|
1045
|
+
"backgroundColor": "transparent",
|
|
1046
|
+
"height": 0.1,
|
|
1047
|
+
"width": 0.1,
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
/>
|
|
1018
1051
|
</View>,
|
|
1019
1052
|
<View
|
|
1020
1053
|
accessibilityRole="alert"
|
|
@@ -249,6 +249,17 @@ Array [
|
|
|
249
249
|
</View>
|
|
250
250
|
</View>
|
|
251
251
|
</View>
|
|
252
|
+
<TextInput
|
|
253
|
+
accessibilityElementsHidden={true}
|
|
254
|
+
pointerEvents="none"
|
|
255
|
+
style={
|
|
256
|
+
Object {
|
|
257
|
+
"backgroundColor": "transparent",
|
|
258
|
+
"height": 0.1,
|
|
259
|
+
"width": 0.1,
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/>
|
|
252
263
|
<View
|
|
253
264
|
style={
|
|
254
265
|
Array [
|
|
@@ -387,6 +398,17 @@ Array [
|
|
|
387
398
|
</View>
|
|
388
399
|
</View>
|
|
389
400
|
</View>
|
|
401
|
+
<TextInput
|
|
402
|
+
accessibilityElementsHidden={true}
|
|
403
|
+
pointerEvents="none"
|
|
404
|
+
style={
|
|
405
|
+
Object {
|
|
406
|
+
"backgroundColor": "transparent",
|
|
407
|
+
"height": 0.1,
|
|
408
|
+
"width": 0.1,
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
/>
|
|
390
412
|
<View
|
|
391
413
|
style={
|
|
392
414
|
Array [
|
|
@@ -837,6 +859,17 @@ Array [
|
|
|
837
859
|
</View>
|
|
838
860
|
</View>
|
|
839
861
|
</View>
|
|
862
|
+
<TextInput
|
|
863
|
+
accessibilityElementsHidden={true}
|
|
864
|
+
pointerEvents="none"
|
|
865
|
+
style={
|
|
866
|
+
Object {
|
|
867
|
+
"backgroundColor": "transparent",
|
|
868
|
+
"height": 0.1,
|
|
869
|
+
"width": 0.1,
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
/>
|
|
840
873
|
<View
|
|
841
874
|
style={
|
|
842
875
|
Array [
|
|
@@ -975,6 +1008,17 @@ Array [
|
|
|
975
1008
|
</View>
|
|
976
1009
|
</View>
|
|
977
1010
|
</View>
|
|
1011
|
+
<TextInput
|
|
1012
|
+
accessibilityElementsHidden={true}
|
|
1013
|
+
pointerEvents="none"
|
|
1014
|
+
style={
|
|
1015
|
+
Object {
|
|
1016
|
+
"backgroundColor": "transparent",
|
|
1017
|
+
"height": 0.1,
|
|
1018
|
+
"width": 0.1,
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
/>
|
|
978
1022
|
<View
|
|
979
1023
|
style={
|
|
980
1024
|
Array [
|
|
@@ -1371,6 +1415,17 @@ Array [
|
|
|
1371
1415
|
</View>
|
|
1372
1416
|
</View>
|
|
1373
1417
|
</View>
|
|
1418
|
+
<TextInput
|
|
1419
|
+
accessibilityElementsHidden={true}
|
|
1420
|
+
pointerEvents="none"
|
|
1421
|
+
style={
|
|
1422
|
+
Object {
|
|
1423
|
+
"backgroundColor": "transparent",
|
|
1424
|
+
"height": 0.1,
|
|
1425
|
+
"width": 0.1,
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
/>
|
|
1374
1429
|
<View
|
|
1375
1430
|
style={
|
|
1376
1431
|
Array [
|
|
@@ -1512,6 +1567,17 @@ Array [
|
|
|
1512
1567
|
</View>
|
|
1513
1568
|
</View>
|
|
1514
1569
|
</View>
|
|
1570
|
+
<TextInput
|
|
1571
|
+
accessibilityElementsHidden={true}
|
|
1572
|
+
pointerEvents="none"
|
|
1573
|
+
style={
|
|
1574
|
+
Object {
|
|
1575
|
+
"backgroundColor": "transparent",
|
|
1576
|
+
"height": 0.1,
|
|
1577
|
+
"width": 0.1,
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
/>
|
|
1515
1581
|
<View
|
|
1516
1582
|
style={
|
|
1517
1583
|
Array [
|
|
@@ -1963,6 +2029,17 @@ Array [
|
|
|
1963
2029
|
</View>
|
|
1964
2030
|
</View>
|
|
1965
2031
|
</View>
|
|
2032
|
+
<TextInput
|
|
2033
|
+
accessibilityElementsHidden={true}
|
|
2034
|
+
pointerEvents="none"
|
|
2035
|
+
style={
|
|
2036
|
+
Object {
|
|
2037
|
+
"backgroundColor": "transparent",
|
|
2038
|
+
"height": 0.1,
|
|
2039
|
+
"width": 0.1,
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
/>
|
|
1966
2043
|
<View
|
|
1967
2044
|
style={
|
|
1968
2045
|
Array [
|
|
@@ -2101,6 +2178,17 @@ Array [
|
|
|
2101
2178
|
</View>
|
|
2102
2179
|
</View>
|
|
2103
2180
|
</View>
|
|
2181
|
+
<TextInput
|
|
2182
|
+
accessibilityElementsHidden={true}
|
|
2183
|
+
pointerEvents="none"
|
|
2184
|
+
style={
|
|
2185
|
+
Object {
|
|
2186
|
+
"backgroundColor": "transparent",
|
|
2187
|
+
"height": 0.1,
|
|
2188
|
+
"width": 0.1,
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
/>
|
|
2104
2192
|
<View
|
|
2105
2193
|
style={
|
|
2106
2194
|
Array [
|
|
@@ -2642,6 +2730,17 @@ Array [
|
|
|
2642
2730
|
</View>
|
|
2643
2731
|
</View>
|
|
2644
2732
|
</View>
|
|
2733
|
+
<TextInput
|
|
2734
|
+
accessibilityElementsHidden={true}
|
|
2735
|
+
pointerEvents="none"
|
|
2736
|
+
style={
|
|
2737
|
+
Object {
|
|
2738
|
+
"backgroundColor": "transparent",
|
|
2739
|
+
"height": 0.1,
|
|
2740
|
+
"width": 0.1,
|
|
2741
|
+
}
|
|
2742
|
+
}
|
|
2743
|
+
/>
|
|
2645
2744
|
<View
|
|
2646
2745
|
style={
|
|
2647
2746
|
Array [
|
|
@@ -2783,6 +2882,17 @@ Array [
|
|
|
2783
2882
|
</View>
|
|
2784
2883
|
</View>
|
|
2785
2884
|
</View>
|
|
2885
|
+
<TextInput
|
|
2886
|
+
accessibilityElementsHidden={true}
|
|
2887
|
+
pointerEvents="none"
|
|
2888
|
+
style={
|
|
2889
|
+
Object {
|
|
2890
|
+
"backgroundColor": "transparent",
|
|
2891
|
+
"height": 0.1,
|
|
2892
|
+
"width": 0.1,
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
/>
|
|
2786
2896
|
<View
|
|
2787
2897
|
style={
|
|
2788
2898
|
Array [
|
|
@@ -3,12 +3,7 @@ import { View } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
import { getErrors } from '@aws-amplify/ui';
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
PasswordField,
|
|
8
|
-
PhoneNumberField,
|
|
9
|
-
TextField,
|
|
10
|
-
} from '../../../primitives';
|
|
11
|
-
|
|
6
|
+
import Field from './Field';
|
|
12
7
|
import { FieldErrors } from './FieldErrors';
|
|
13
8
|
import { DefaultTextFormFieldsComponent } from './types';
|
|
14
9
|
|
|
@@ -27,13 +22,6 @@ const DefaultTextFormFields: DefaultTextFormFieldsComponent = ({
|
|
|
27
22
|
|
|
28
23
|
const hasError = errors?.length > 0;
|
|
29
24
|
|
|
30
|
-
const Field =
|
|
31
|
-
type === 'password'
|
|
32
|
-
? PasswordField
|
|
33
|
-
: type === 'phone'
|
|
34
|
-
? PhoneNumberField
|
|
35
|
-
: TextField;
|
|
36
|
-
|
|
37
25
|
return (
|
|
38
26
|
<Fragment key={name}>
|
|
39
27
|
<Field
|
|
@@ -43,6 +31,7 @@ const DefaultTextFormFields: DefaultTextFormFieldsComponent = ({
|
|
|
43
31
|
fieldStyle={fieldStyle}
|
|
44
32
|
key={name}
|
|
45
33
|
style={fieldContainerStyle}
|
|
34
|
+
type={type}
|
|
46
35
|
/>
|
|
47
36
|
<FieldErrors
|
|
48
37
|
errors={errors}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextInput, TextInputProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
PasswordField,
|
|
6
|
+
PhoneNumberField,
|
|
7
|
+
TextField,
|
|
8
|
+
} from '../../../primitives';
|
|
9
|
+
import { platform } from '../../../utils';
|
|
10
|
+
import { FieldProps } from './types';
|
|
11
|
+
|
|
12
|
+
const { IS_IOS } = platform;
|
|
13
|
+
|
|
14
|
+
// to prevent issues with iOS when multiple `TextInput` components have `secureTextEntry`
|
|
15
|
+
// set to `true`, insert a "hidden" `TextInput` after each `PasswordField`
|
|
16
|
+
// Issue reference: https://github.com/facebook/react-native/issues/21911
|
|
17
|
+
const HIDDEN_INPUT_PROPS: TextInputProps = {
|
|
18
|
+
// prevent iOS screen reader from picking up element
|
|
19
|
+
accessibilityElementsHidden: true,
|
|
20
|
+
// prevent `TextInput` from capturing touch events
|
|
21
|
+
pointerEvents: 'none',
|
|
22
|
+
// this workaround requires the `height` and `width` applied to the `TextInput`
|
|
23
|
+
// are greater than `0`
|
|
24
|
+
// NOTE: do not attempt to set an opacity value here to further hide the element,
|
|
25
|
+
// it will cause the issues mitigated by this workaround to re-surface
|
|
26
|
+
style: { backgroundColor: 'transparent', height: 0.1, width: 0.1 },
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const HiddenInput = () => <TextInput {...HIDDEN_INPUT_PROPS} />;
|
|
30
|
+
|
|
31
|
+
const Field = ({ type, ...rest }: FieldProps): JSX.Element => {
|
|
32
|
+
const isPassword = type === 'password';
|
|
33
|
+
const Field = isPassword
|
|
34
|
+
? PasswordField
|
|
35
|
+
: type === 'phone'
|
|
36
|
+
? PhoneNumberField
|
|
37
|
+
: TextField;
|
|
38
|
+
|
|
39
|
+
return IS_IOS && isPassword ? (
|
|
40
|
+
<>
|
|
41
|
+
<Field {...rest} />
|
|
42
|
+
<HiddenInput />
|
|
43
|
+
</>
|
|
44
|
+
) : (
|
|
45
|
+
<Field {...rest} />
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
Field.displayName = 'Field';
|
|
50
|
+
export default Field;
|
|
@@ -3,6 +3,10 @@ import { AuthenticatorFormFieldsComponent } from '@aws-amplify/ui-react-core';
|
|
|
3
3
|
|
|
4
4
|
import { RadioFieldOptions, TextFieldOptionsType } from '../../hooks';
|
|
5
5
|
|
|
6
|
+
export type FieldProps = Omit<TextFieldOptionsType, 'name'> & {
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
6
10
|
export interface FieldErrorsProps {
|
|
7
11
|
errors: string[];
|
|
8
12
|
errorStyle?: StyleProp<TextStyle>;
|