This commit is contained in:
oneao committed 2025-11-05 22:25:09 +08:00
1 parent c7a1f83c67
commit 6849579652
19 files changed
+600 -249

No files matched your search

@@ -9,7 +9,7 @@ export interface FormRef {
interface FormProps {
children: React.ReactNode
form: Record<string, any>
scrollRef: React.RefObject<ScrollView | null>
scrollRef?: React.RefObject<ScrollView | null>
}
interface FormContextType {
@@ -57,7 +57,7 @@ const Form = forwardRef<FormRef, FormProps>(({ children, form, scrollRef }, ref)
const scrollToField = (name: string) => {
const y = fieldPositions.current.get(name)
if (y !== undefined && scrollRef.current) {
if (y !== undefined && scrollRef?.current) {
scrollRef.current.scrollTo({ y, animated: true })
}
}
@@ -22,7 +22,7 @@ interface RuleType {
}
interface FormItemProps<T> {
name: keyof T
name?: keyof T
label?: string
rules?: RuleType[]
children: React.ReactNode