1
1
import * as React from 'react' ;
2
2
import { StyleSheet , View , Text , TextInput , Pressable , ActivityIndicator } from 'react-native' ;
3
+ import { theme } from '../theme' ;
3
4
4
5
type Props = {
5
6
onLoginSuccess : ( user : string ) => void ;
@@ -77,7 +78,7 @@ export function LoginForm({ onLoginSuccess }: Props) {
77
78
* @param password The password to authenticate.
78
79
* @returns username if the username and password are correct, null otherwise.
79
80
*/
80
- async function authUser ( username : string , password : string ) : Promise < string | null > {
81
+ function authUser ( username : string , password : string ) : Promise < string | null > {
81
82
return new Promise ( ( resolve ) =>
82
83
setTimeout ( ( ) => {
83
84
const hasValidCredentials = username === 'admin' && password === 'admin1' ;
@@ -98,17 +99,17 @@ const styles = StyleSheet.create({
98
99
} ,
99
100
textLabel : {
100
101
fontSize : 16 ,
101
- color : '#444' ,
102
+ color : theme . colors . label ,
102
103
} ,
103
104
textInput : {
104
105
fontSize : 20 ,
105
106
padding : 8 ,
106
107
marginVertical : 8 ,
107
- borderColor : 'black' ,
108
+ borderColor : theme . colors . text ,
108
109
borderWidth : 1 ,
109
110
} ,
110
111
button : {
111
- backgroundColor : '#3256a8' ,
112
+ backgroundColor : theme . colors . button ,
112
113
padding : 16 ,
113
114
alignItems : 'center' ,
114
115
justifyContent : 'center' ,
@@ -118,10 +119,10 @@ const styles = StyleSheet.create({
118
119
buttonText : {
119
120
fontSize : 20 ,
120
121
fontWeight : '600' ,
121
- color : 'white' ,
122
+ color : theme . colors . buttonText ,
122
123
} ,
123
124
validator : {
124
- color : 'red' ,
125
+ color : theme . colors . validator ,
125
126
fontSize : 18 ,
126
127
marginTop : 8 ,
127
128
} ,
0 commit comments