Skip to content

Commit

Permalink
Fix PropTypes errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kowczarz committed Sep 20, 2023
1 parent 416b0bd commit 106afb7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/hooks/useForm/FormProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function getInitialValueByType(valueType) {
}

function FormProvider({validate, shouldValidateOnBlur, shouldValidateOnChange, children, formState, network, enabledWhenOffline, onSubmit, ...rest}) {
const inputRefs = useRef({});
const inputRefs = useRef(null);
const touchedInputs = useRef({});
const [inputValues, setInputValues] = useState({});
const [errors, setErrors] = useState({});
Expand Down
5 changes: 2 additions & 3 deletions src/hooks/useForm/FormWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const propTypes = {

errors: PropTypes.objectOf(PropTypes.string).isRequired,

inputRefs: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.element})])).isRequired,
inputRefs: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object])).isRequired,
};

const defaultProps = {
Expand All @@ -77,10 +77,9 @@ const defaultProps = {
};

function FormWrapper(props) {
const {onSubmit, children, formState, errors, inputRefs, submitButtonText, footerContent, isSubmitButtonVisible, style, enabledWhenOffline, isSubmitActionDangerous, formID} = props;
const formRef = useRef(null);
const formContentRef = useRef(null);
const {onSubmit, children, formState, errors, inputRefs, submitButtonText, footerContent, isSubmitButtonVisible, style, enabledWhenOffline, isSubmitActionDangerous, formID} = props;

const errorMessage = useMemo(() => {
const latestErrorMessage = ErrorUtils.getLatestErrorMessage(formState);
return typeof latestErrorMessage === 'string' ? latestErrorMessage : '';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useForm/InputWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import FormContext from './FormContext';

const propTypes = {
RenderInput: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
RenderInput: PropTypes.oneOfType([PropTypes.func, PropTypes.elementType]).isRequired,
inputID: PropTypes.string.isRequired,
valueType: PropTypes.string,
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),
Expand Down

0 comments on commit 106afb7

Please sign in to comment.