You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
用以上版本时,
如下代码
import { Box, Form } from 'grommet';
import { z } from 'zod';
import { SubmitHandler, useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import InputNumber from 'rc-input-number';
会报
hook.js:608 React Router caught the following error during render TypeError: Illegal invocation
at Proxy.set (react-dom.development.js:1661:1)错误
但是如果将"rc-input-number": "^9.0.0",改为此版本,上面其他内容都不变,则不会报错,使用正常
The text was updated successfully, but these errors were encountered:
"react": "18.3.1",
"react-dom": "18.3.1",
"rc-input-number": "^9.3.0",
"@hookform/resolvers": "^3.9.1",
"react-hook-form": "^7.54.1",
用以上版本时,
如下代码
import { Box, Form } from 'grommet';
import { z } from 'zod';
import { SubmitHandler, useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import InputNumber from 'rc-input-number';
const zodFormSchema = z.object({
orderQty: z.coerce.number().positive('必须正数'),
});
type ZodFormFieldsProps = z.infer;
/**
export default function TestInputNumber() {
const { register, handleSubmit, setValue } = useForm({
resolver: zodResolver(zodFormSchema),
});
const onOrderQtyChange = (val: string | number | null) => {
setValue('orderQty', val ? parseFloat(val + '') : 0, {
shouldValidate: true,
shouldTouch: true,
shouldDirty: true,
});
};
const onFormSubmit: SubmitHandler = (formData) => {
console.log('formData', formData);
};
return (
<InputNumber
{...register('orderQty')}
min={0}
step={1}
onChange={onOrderQtyChange}
/>
);
}
会报
hook.js:608 React Router caught the following error during render TypeError: Illegal invocation
at Proxy.set (react-dom.development.js:1661:1)错误
但是如果将"rc-input-number": "^9.0.0",改为此版本,上面其他内容都不变,则不会报错,使用正常
The text was updated successfully, but these errors were encountered: