File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ class AddSecondaryLoginPage extends Component {
72
72
} ;
73
73
this . formType = props . route . params . type ;
74
74
this . submitForm = this . submitForm . bind ( this ) ;
75
+ this . onSecondaryLoginChange = this . onSecondaryLoginChange . bind ( this ) ;
75
76
this . validateForm = this . validateForm . bind ( this ) ;
76
77
77
78
this . phoneNumberInputRef = null ;
@@ -81,6 +82,15 @@ class AddSecondaryLoginPage extends Component {
81
82
Onyx . merge ( ONYXKEYS . USER , { error : '' } ) ;
82
83
}
83
84
85
+ onSecondaryLoginChange ( login ) {
86
+ if ( this . formType === CONST . LOGIN_TYPE . EMAIL ) {
87
+ this . setState ( { login} ) ;
88
+ } else if ( this . formType === CONST . LOGIN_TYPE . PHONE
89
+ && ( CONST . REGEX . DIGITS_AND_PLUS . test ( login ) || login === '' ) ) {
90
+ this . setState ( { login} ) ;
91
+ }
92
+ }
93
+
84
94
/**
85
95
* Add a secondary login to a user's account
86
96
*/
@@ -133,7 +143,7 @@ class AddSecondaryLoginPage extends Component {
133
143
: 'profilePage.emailAddress' ) }
134
144
ref = { el => this . phoneNumberInputRef = el }
135
145
value = { this . state . login }
136
- onChangeText = { login => this . setState ( { login } ) }
146
+ onChangeText = { this . onSecondaryLoginChange }
137
147
keyboardType = { this . formType === CONST . LOGIN_TYPE . PHONE
138
148
? CONST . KEYBOARD_TYPE . PHONE_PAD : undefined }
139
149
returnKeyType = "done"
You can’t perform that action at this time.
0 commit comments