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 15
15
},
16
16
"scripts" : {
17
17
"start" : " watchman watch-del-all && export DEV_MODE=true && react-native start" ,
18
+ "start:web" : " npm --prefix webDemo run start" ,
18
19
"ios" : " react-native run-ios" ,
19
20
"android" : " react-native run-android" ,
20
21
"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({
23
23
if ( Constants . isWeb && ! props . value && props . defaultValue && props . defaultValue !== value ) {
24
24
setValue ( props . defaultValue ) ;
25
25
26
- if ( validateOnChange ) {
26
+ if ( validateOnStart ) {
27
27
validateField ( props . defaultValue ) ;
28
28
}
29
29
}
30
30
31
31
/* On purpose listen only to props.defaultValue change */
32
32
/* eslint-disable-next-line react-hooks/exhaustive-deps*/
33
- } , [ props . defaultValue , validateOnChange ] ) ;
33
+ } , [ props . defaultValue , validateOnStart ] ) ;
34
34
35
35
useEffect ( ( ) => {
36
36
if ( validateOnStart ) {
@@ -42,7 +42,7 @@ export default function useFieldState({
42
42
if ( props . value !== value ) {
43
43
setValue ( props . value ) ;
44
44
45
- if ( validateOnChange ) {
45
+ if ( validateOnChange && value !== props . defaultValue ) {
46
46
validateField ( props . value ) ;
47
47
}
48
48
}
Original file line number Diff line number Diff line change @@ -173,7 +173,14 @@ const itemsToRender: ItemToRender[] = [
173
173
migrate
174
174
defaultValue = { defaultValue }
175
175
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 }
177
184
onChangeText = { ( text : string ) => {
178
185
console . log ( text ) ;
179
186
} }
You can’t perform that action at this time.
0 commit comments