Skip to content

Commit

Permalink
fix disabled check location
Browse files Browse the repository at this point in the history
  • Loading branch information
Hunter275 committed Sep 5, 2024
1 parent 0dcc2b1 commit 300fb5c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/Form/DynamicForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ export function DynamicForm<T extends FieldValues>({
disabledBy?: DisabledBy<T>[],
disabled?: boolean,
): boolean => {
if (disabled) return true;
if (!disabledBy) return false;

return disabledBy.some((field) => {
if (disabled) return true;
const value = getValues(field.fieldName);
if (value === "always") return true;
if (typeof value === "boolean") return field.invert ? value : !value;
Expand Down

0 comments on commit 300fb5c

Please sign in to comment.