@@ -35,7 +35,7 @@ import CONST from '@src/CONST';
35
35
import type { TranslationPaths } from '@src/languages/types' ;
36
36
import ONYXKEYS from '@src/ONYXKEYS' ;
37
37
import type { CloseAccountForm } from '@src/types/form' ;
38
- import type { Account , Credentials } from '@src/types/onyx' ;
38
+ import type { Account } from '@src/types/onyx' ;
39
39
import htmlDivElementRef from '@src/types/utils/htmlDivElementRef' ;
40
40
import viewRef from '@src/types/utils/viewRef' ;
41
41
import type LoginFormProps from './types' ;
@@ -47,19 +47,15 @@ type BaseLoginFormOnyxProps = {
47
47
48
48
/** Message to display when user successfully closed their account */
49
49
closeAccount : OnyxEntry < CloseAccountForm > ;
50
-
51
- /** The credentials of the logged in person */
52
- credentials : OnyxEntry < Credentials > ;
53
50
} ;
54
51
55
52
type BaseLoginFormProps = WithToggleVisibilityViewProps & BaseLoginFormOnyxProps & LoginFormProps ;
56
53
57
- function BaseLoginForm ( { account, credentials , closeAccount, blurOnSubmit = false , isVisible} : BaseLoginFormProps , ref : ForwardedRef < InputHandle > ) {
54
+ function BaseLoginForm ( { account, login , onLoginChanged , closeAccount, blurOnSubmit = false , isVisible} : BaseLoginFormProps , ref : ForwardedRef < InputHandle > ) {
58
55
const styles = useThemeStyles ( ) ;
59
56
const { isOffline} = useNetwork ( ) ;
60
57
const { translate} = useLocalize ( ) ;
61
58
const input = useRef < BaseTextInputRef | null > ( null ) ;
62
- const [ login , setLogin ] = useState ( ( ) => Str . removeSMSDomain ( credentials ?. login ?? '' ) ) ;
63
59
const [ formError , setFormError ] = useState < TranslationPaths | undefined > ( ) ;
64
60
const prevIsVisible = usePrevious ( isVisible ) ;
65
61
const firstBlurred = useRef ( false ) ;
@@ -101,7 +97,7 @@ function BaseLoginForm({account, credentials, closeAccount, blurOnSubmit = false
101
97
*/
102
98
const onTextInput = useCallback (
103
99
( text : string ) => {
104
- setLogin ( text ) ;
100
+ onLoginChanged ( text ) ;
105
101
if ( firstBlurred . current ) {
106
102
validate ( text ) ;
107
103
}
@@ -115,7 +111,7 @@ function BaseLoginForm({account, credentials, closeAccount, blurOnSubmit = false
115
111
CloseAccount . setDefaultData ( ) ;
116
112
}
117
113
} ,
118
- [ account , closeAccount , input , setLogin , validate ] ,
114
+ [ account , closeAccount , input , onLoginChanged , validate ] ,
119
115
) ;
120
116
121
117
function getSignInWithStyles ( ) {
@@ -338,7 +334,6 @@ BaseLoginForm.displayName = 'BaseLoginForm';
338
334
export default withToggleVisibilityView (
339
335
withOnyx < BaseLoginFormProps , BaseLoginFormOnyxProps > ( {
340
336
account : { key : ONYXKEYS . ACCOUNT } ,
341
- credentials : { key : ONYXKEYS . CREDENTIALS } ,
342
337
closeAccount : { key : ONYXKEYS . FORMS . CLOSE_ACCOUNT_FORM } ,
343
338
} ) ( forwardRef ( BaseLoginForm ) ) ,
344
339
) ;
0 commit comments