import React, { FC } from 'react' import { Formy, FormApi } from '@formy/core' import { isNative } from '../utils' import { FormProps } from '../types' import { FormProvider } from '../formContext' import { useFormContext } from '../formContext' import { useForm } from '../hooks/useForm' interface FormContentProps { hook: FormApi } const FormBody: FC = (props) => { const { children } = props const { Form: FormyForm } = Formy const result = useFormContext() if (FormyForm) return if (isNative) return children return React.createElement('form', { onSubmit: result.handleSubmit, ...props }) } const FormContent: FC = ({ hook, children, ...rest }) => ( {children} ) const FormInnerHooks: FC = ({ children, ...rest }) => { const hook = useForm(rest) return ( {children} ) } export function Form(props: FormProps) { const { hook, ...rest } = props if (hook) return return }