File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 1515 },
1616 "scripts" : {
1717 "start" : " watchman watch-del-all && export DEV_MODE=true && react-native start" ,
18+ "start:web" : " npm --prefix webDemo run start" ,
1819 "ios" : " react-native run-ios" ,
1920 "android" : " react-native run-android" ,
2021 "iPad" : " react-native run-ios --simulator='iPad Pro (9.7 inch)'" ,
Original file line number Diff line number Diff line change @@ -23,14 +23,14 @@ export default function useFieldState({
2323 if ( Constants . isWeb && ! props . value && props . defaultValue && props . defaultValue !== value ) {
2424 setValue ( props . defaultValue ) ;
2525
26- if ( validateOnChange ) {
26+ if ( validateOnStart ) {
2727 validateField ( props . defaultValue ) ;
2828 }
2929 }
3030
3131 /* On purpose listen only to props.defaultValue change */
3232 /* eslint-disable-next-line react-hooks/exhaustive-deps*/
33- } , [ props . defaultValue , validateOnChange ] ) ;
33+ } , [ props . defaultValue , validateOnStart ] ) ;
3434
3535 useEffect ( ( ) => {
3636 if ( validateOnStart ) {
@@ -42,7 +42,7 @@ export default function useFieldState({
4242 if ( props . value !== value ) {
4343 setValue ( props . value ) ;
4444
45- if ( validateOnChange ) {
45+ if ( validateOnChange && value !== props . defaultValue ) {
4646 validateField ( props . value ) ;
4747 }
4848 }
Original file line number Diff line number Diff line change @@ -173,7 +173,14 @@ const itemsToRender: ItemToRender[] = [
173173 migrate
174174 defaultValue = { defaultValue }
175175 containerStyle = { { marginBottom : 10 } }
176- placeholder = "type here..."
176+ placeholder = "Enter your email..."
177+ validationMessage = { [ 'Email is required' , 'Email is invalid' ] }
178+ validationMessagePosition = { 'top' }
179+ enableErrors
180+ validate = { [ 'required' , 'email' ] }
181+ validateOnStart = { false }
182+ validateOnChange
183+ validateOnBlur = { false }
177184 onChangeText = { ( text : string ) => {
178185 console . log ( text ) ;
179186 } }
You can’t perform that action at this time.
0 commit comments