Skip to content

Commit 401a73b

Browse files
feat: add support for locale + regex + simpler code
1 parent 976b814 commit 401a73b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

example/src/App.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ function AddressEdit({
174174
<TextInput
175175
mode="outlined"
176176
label="Street"
177-
{...fh.streetAddress('street')}
177+
{...fh.streetAddress('street', { required: true })}
178178
/>
179179
<TextInput
180180
mode="outlined"

src/translations/nl.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { TranslationsType } from './utils';
22

33
const nl: TranslationsType = {
4-
required: (params) => `${params.label || params.fieldKey} is required`,
4+
required: (params) => `${params.label || params.fieldKey} is verplicht`,
55
lengtShouldBeLongerThan: (params) =>
66
`${params.label || params.fieldKey} moet langer zijn dan ${
77
params.requiredLength

src/useFormState.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ function checkErrorObject(errors: any) {
838838
for (let key of keys) {
839839
if (isObject(errors[key])) {
840840
if (checkErrorObject(errors[key])) {
841-
return false;
841+
return true;
842842
}
843843
} else {
844844
if (!!errors[key]) {

0 commit comments

Comments
 (0)