This repository has been archived by the owner on Aug 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
FindPw.tsx
95 lines (82 loc) · 2.21 KB
/
FindPw.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import React, { useState, useEffect } from 'react';
import styled, { withTheme, ThemeProps, DefaultTheme } from 'styled-components/native';
import TextInput from '../shared/TextInput';
import Button from '../shared/Button';
import StatusBar from '../shared/StatusBar';
import { getString } from '../../../STRINGS';
const StyledContainer = styled.View`
flex: 1;
background: ${({ theme }) => theme.colors.background};
flex-direction: column;
align-items: center;
`;
const StyledScrollView = styled.ScrollView`
align-self: stretch;
`;
const StyledWrapper = styled.View`
margin-top: 40px;
width: 78%;
`;
const StyledButtonWrapper = styled.View`
width: 100%;
align-items: flex-end;
margin-top: 16px;
`;
interface IProps extends ThemeProps<DefaultTheme> {
navigation: any;
}
interface IState {
email: string;
isLoading: boolean;
}
function Screen(props: IProps) {
const [isLoading, setLoading] = useState(false);
const [email, setEmail] = useState('');
useEffect(() => {
if (isLoading) {
setLoading(false);
}
}, [isLoading]);
const onTextChanged = (type: string, text: string) => {
switch (type) {
case 'EMAIL':
setEmail(text);
break;
}
};
const onSendLink = () => {
setLoading(true);
};
const { theme } = props;
return (
<StyledContainer>
<StatusBar isDarkContent={false}/>
<StyledScrollView
contentContainerStyle={{
alignItems: 'center',
justifyContent: 'center',
}}
>
<StyledWrapper>
<TextInput
testID='input_email'
style={{ marginTop: 8 * theme.ratio }}
txtLabel={getString('EMAIL')}
txtHint={ getString('EMAIL') }
txt={ email }
onTextChanged={ (text) => onTextChanged('EMAIL', text)}
placeholderTextColor={theme.colors.text}
/>
<StyledButtonWrapper>
<Button
testID='btnSendLink'
isLoading={isLoading}
onPress={() => onSendLink()}
>{getString('SEND_LINK')}</Button>
</StyledButtonWrapper>
</StyledWrapper>
</StyledScrollView>
</StyledContainer>
);
}
export default withTheme(Screen);