@dloizides/auth-web 1.18.1 → 1.18.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 +10 -0
- package/dist/index.js +29 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -637,6 +637,21 @@ function useLoginSubmit({
|
|
|
637
637
|
}, [runLogin]);
|
|
638
638
|
return { errorText, handleSubmit };
|
|
639
639
|
}
|
|
640
|
+
function isKeyRepeat(event) {
|
|
641
|
+
const native = event?.nativeEvent;
|
|
642
|
+
return native?.repeat === true;
|
|
643
|
+
}
|
|
644
|
+
function useSubmitOnEnter(submit) {
|
|
645
|
+
return useCallback(
|
|
646
|
+
(event) => {
|
|
647
|
+
if (isKeyRepeat(event)) {
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
submit();
|
|
651
|
+
},
|
|
652
|
+
[submit]
|
|
653
|
+
);
|
|
654
|
+
}
|
|
640
655
|
var BffAuthStatus = /* @__PURE__ */ ((BffAuthStatus2) => {
|
|
641
656
|
BffAuthStatus2["Loading"] = "loading";
|
|
642
657
|
BffAuthStatus2["Authenticated"] = "authenticated";
|
|
@@ -775,6 +790,7 @@ function LoginForm({
|
|
|
775
790
|
missingFieldsLabel: labels.missingFields,
|
|
776
791
|
invalidCredentialsLabel: labels.invalidCredentials
|
|
777
792
|
});
|
|
793
|
+
const handleSubmitEditing = useSubmitOnEnter(handleSubmit);
|
|
778
794
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
779
795
|
/* @__PURE__ */ jsx(Text, { style: styles3.title, children: labels.title }),
|
|
780
796
|
/* @__PURE__ */ jsx(Text, { style: styles3.subtitle, children: labels.subtitle }),
|
|
@@ -790,10 +806,12 @@ function LoginForm({
|
|
|
790
806
|
editable: !isSubmitting,
|
|
791
807
|
placeholder: labels.usernamePlaceholder,
|
|
792
808
|
placeholderTextColor: theme.colors.textSecondary,
|
|
809
|
+
returnKeyType: "go",
|
|
793
810
|
style: styles3.input,
|
|
794
811
|
testID: withTestIdPrefix(AuthTestIds.loginUsernameInput, testIdPrefix),
|
|
795
812
|
value: username,
|
|
796
|
-
onChangeText: setUsername
|
|
813
|
+
onChangeText: setUsername,
|
|
814
|
+
onSubmitEditing: handleSubmitEditing
|
|
797
815
|
}
|
|
798
816
|
)
|
|
799
817
|
] }),
|
|
@@ -810,10 +828,12 @@ function LoginForm({
|
|
|
810
828
|
editable: !isSubmitting,
|
|
811
829
|
placeholder: labels.passwordPlaceholder,
|
|
812
830
|
placeholderTextColor: theme.colors.textSecondary,
|
|
831
|
+
returnKeyType: "go",
|
|
813
832
|
style: styles3.input,
|
|
814
833
|
testID: withTestIdPrefix(AuthTestIds.loginPasswordInput, testIdPrefix),
|
|
815
834
|
value: password,
|
|
816
|
-
onChangeText: setPassword
|
|
835
|
+
onChangeText: setPassword,
|
|
836
|
+
onSubmitEditing: handleSubmitEditing
|
|
817
837
|
}
|
|
818
838
|
)
|
|
819
839
|
] }),
|
|
@@ -4093,6 +4113,7 @@ function RegisterFormFields({
|
|
|
4093
4113
|
theme,
|
|
4094
4114
|
styles: styles3,
|
|
4095
4115
|
onChange,
|
|
4116
|
+
onSubmitEditing,
|
|
4096
4117
|
testIdPrefix
|
|
4097
4118
|
}) {
|
|
4098
4119
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -4112,11 +4133,13 @@ function RegisterFormFields({
|
|
|
4112
4133
|
keyboardType: config.keyboardType ?? "default",
|
|
4113
4134
|
placeholder: copy.placeholder,
|
|
4114
4135
|
placeholderTextColor: theme.colors.textSecondary,
|
|
4136
|
+
returnKeyType: "go",
|
|
4115
4137
|
secureTextEntry: config.secure === true,
|
|
4116
4138
|
style: styles3.input,
|
|
4117
4139
|
testID: withTestIdPrefix(config.testId, testIdPrefix),
|
|
4118
4140
|
value: values[config.key],
|
|
4119
|
-
onChangeText: (text) => onChange(config.key, text)
|
|
4141
|
+
onChangeText: (text) => onChange(config.key, text),
|
|
4142
|
+
onSubmitEditing
|
|
4120
4143
|
}
|
|
4121
4144
|
)
|
|
4122
4145
|
] }, config.key);
|
|
@@ -4341,6 +4364,7 @@ function RegisterForm({
|
|
|
4341
4364
|
const handlePress = useCallback(async () => {
|
|
4342
4365
|
routeRegisterOutcome(await submit(), { onSuccess, onError });
|
|
4343
4366
|
}, [onError, onSuccess, submit]);
|
|
4367
|
+
const handleSubmitEditing = useSubmitOnEnter(handlePress);
|
|
4344
4368
|
return /* @__PURE__ */ jsx(View, { style: styles3.screen, children: /* @__PURE__ */ jsxs(View, { style: styles3.card, testID: withTestIdPrefix(RegisterTestIds.form, testIdPrefix), children: [
|
|
4345
4369
|
/* @__PURE__ */ jsx(Text, { style: styles3.title, children: labels.title }),
|
|
4346
4370
|
/* @__PURE__ */ jsx(Text, { style: styles3.subtitle, children: labels.subtitle }),
|
|
@@ -4353,7 +4377,8 @@ function RegisterForm({
|
|
|
4353
4377
|
testIdPrefix,
|
|
4354
4378
|
theme,
|
|
4355
4379
|
values: state,
|
|
4356
|
-
onChange: setField
|
|
4380
|
+
onChange: setField,
|
|
4381
|
+
onSubmitEditing: handleSubmitEditing
|
|
4357
4382
|
}
|
|
4358
4383
|
),
|
|
4359
4384
|
/* @__PURE__ */ jsx(View, { style: styles3.fieldGroup, children: /* @__PURE__ */ jsx(
|