@@ -20,7 +20,7 @@ import {
2020 ValueContext ,
2121} from '../Contexts'
2222import { FormProps , FormRef } from '../types'
23- import isReactNative from '../utility/isReactNative '
23+ import FormInner from './FormInner '
2424import getNewValue from './getNewValue'
2525
2626function Form ( props : FormProps , ref : React . Ref < FormRef > ) {
@@ -108,30 +108,19 @@ function Form(props: FormProps, ref: React.Ref<FormRef>) {
108108 [ props ] ,
109109 )
110110
111- const renderChild = ( ) => {
112- if ( isReactNative ( ) ) {
113- return props . children
114- }
115-
116- if ( props . useFormTag !== false ) {
117- return (
118- < form { ...domProps } onSubmit = { onFormSubmit } >
119- { props . children }
120- </ form >
121- )
122- }
123-
124- return props . children
125- }
126-
127- console . log ( '[simple-react-form] state' , state )
128- console . log ( '[simple-react-form] props' , props )
129-
130111 return (
131112 < ParentFieldNameContext . Provider value = { null } >
132113 < ErrorMessagesContext . Provider value = { props . errorMessages } >
133114 < OnChangeContext . Provider value = { onChange } >
134- < ValueContext . Provider value = { state } > { renderChild ( ) } </ ValueContext . Provider >
115+ < ValueContext . Provider value = { state } >
116+ < FormInner
117+ domProps = { domProps }
118+ onFormSubmit = { onFormSubmit }
119+ useFormTag = { props . useFormTag }
120+ >
121+ { props . children }
122+ </ FormInner >
123+ </ ValueContext . Provider >
135124 </ OnChangeContext . Provider >
136125 </ ErrorMessagesContext . Provider >
137126 </ ParentFieldNameContext . Provider >
0 commit comments