Skip to content

Commit

Permalink
feat: add support for locale + regex + simpler code
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLindhout committed Dec 15, 2022
1 parent 976b814 commit 401a73b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ function AddressEdit({
<TextInput
mode="outlined"
label="Street"
{...fh.streetAddress('street')}
{...fh.streetAddress('street', { required: true })}
/>
<TextInput
mode="outlined"
Expand Down
2 changes: 1 addition & 1 deletion src/translations/nl.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { TranslationsType } from './utils';

const nl: TranslationsType = {
required: (params) => `${params.label || params.fieldKey} is required`,
required: (params) => `${params.label || params.fieldKey} is verplicht`,
lengtShouldBeLongerThan: (params) =>
`${params.label || params.fieldKey} moet langer zijn dan ${
params.requiredLength
Expand Down
2 changes: 1 addition & 1 deletion src/useFormState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ function checkErrorObject(errors: any) {
for (let key of keys) {
if (isObject(errors[key])) {
if (checkErrorObject(errors[key])) {
return false;
return true;
}
} else {
if (!!errors[key]) {
Expand Down

0 comments on commit 401a73b

Please sign in to comment.