Skip to content

Commit e7687ea

Browse files
committed
Fix issue in OTP field adapter
1 parent 8abc0c8 commit e7687ea

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

identity-apps-core/react-ui-core/src/components/adapters/otp-field-adapter.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,16 @@ import PropTypes from "prop-types";
2121
import React, { useEffect, useState } from "react";
2222
import { useTranslations } from "../../hooks/use-translations";
2323
import { getTranslationByKey } from "../../utils/i18n-utils";
24-
import ValidationCriteria from "../field-validation";
2524

26-
const OTPFieldAdapter = ({ component, formState, formStateHandler, otpLength = 6 }) => {
25+
const OTPFieldAdapter = ({ component, formStateHandler, otpLength = 6 }) => {
2726

28-
const { label, required, styles, validation } = component.properties;
29-
const { errors } = formState;
30-
const fieldErrors = errors && errors.filter(error => error.field === component.properties.name);
27+
const { label, required, styles } = component.properties;
3128

3229
const { translations } = useTranslations();
3330

3431
const [ otpValues, setOtpValues ] = useState(Array(otpLength).fill(""));
3532

3633
useEffect(() => {
37-
// Join all OTP fields to form the complete OTP value
3834
formStateHandler(component.properties.name, otpValues.join(""));
3935
}, [ otpValues ]);
4036

@@ -125,9 +121,6 @@ const OTPFieldAdapter = ({ component, formState, formStateHandler, otpLength = 6
125121
/>
126122
</div>
127123
) }
128-
{ validation && (
129-
<ValidationCriteria validationConfig={ validation } errors={ fieldErrors } value={ otpValues } />
130-
) }
131124
</div>
132125
);
133126
};

0 commit comments

Comments
 (0)