2024-03-15 23:24:08 +01:00
|
|
|
import { useState } from "react"
|
|
|
|
import { Image, StyleSheet } from "react-native"
|
2024-03-15 12:34:53 +01:00
|
|
|
import {
|
|
|
|
ActivityIndicator,
|
|
|
|
Banner,
|
2024-03-15 23:24:08 +01:00
|
|
|
Button,
|
|
|
|
HelperText,
|
|
|
|
TextInput,
|
2024-03-15 12:34:53 +01:00
|
|
|
} from "react-native-paper"
|
|
|
|
import { SafeAreaView } from "react-native-safe-area-context"
|
|
|
|
|
|
|
|
const LoginPage: React.FC = () => {
|
2024-03-15 23:24:08 +01:00
|
|
|
const [hasError, _sethasError] = useState<boolean>(true)
|
2024-03-15 12:34:53 +01:00
|
|
|
|
2024-03-15 23:24:08 +01:00
|
|
|
const [errorMessage, _setErrorMessage] = useState<string>("Error message")
|
2024-03-15 12:34:53 +01:00
|
|
|
|
2024-03-15 23:24:08 +01:00
|
|
|
const [isPerfomingLogin, _setIsPerfomingLogin] = useState<boolean>(true)
|
2024-03-15 12:34:53 +01:00
|
|
|
|
|
|
|
return (
|
|
|
|
<SafeAreaView style={styles.container}>
|
|
|
|
<Banner
|
|
|
|
visible
|
|
|
|
actions={[
|
|
|
|
{
|
|
|
|
label: "Report this problem",
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
icon={({ size }) => {
|
|
|
|
return (
|
|
|
|
<Image
|
|
|
|
source={{
|
|
|
|
uri: "https://avatars3.githubusercontent.com/u/17571969?s=400&v=4",
|
|
|
|
}}
|
|
|
|
style={{
|
|
|
|
width: size,
|
|
|
|
height: size,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
There was an error while trying to login.
|
|
|
|
</Banner>
|
|
|
|
<TextInput label="Email" mode="outlined" style={styles.input} />
|
|
|
|
<TextInput label="Password" mode="outlined" style={styles.input} />
|
|
|
|
<HelperText type="error" visible={hasError} style={styles.errorText}>
|
|
|
|
{errorMessage}
|
|
|
|
</HelperText>
|
2024-03-15 23:24:08 +01:00
|
|
|
<Button mode="contained">Login</Button>
|
2024-03-15 12:34:53 +01:00
|
|
|
<ActivityIndicator
|
|
|
|
animating={isPerfomingLogin}
|
|
|
|
color="blue"
|
|
|
|
size="large"
|
|
|
|
style={styles.indicator}
|
|
|
|
/>
|
|
|
|
</SafeAreaView>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
container: {
|
|
|
|
flex: 1,
|
|
|
|
alignItems: "center",
|
|
|
|
justifyContent: "center",
|
|
|
|
},
|
|
|
|
input: {
|
|
|
|
width: "80%",
|
|
|
|
marginBottom: 10,
|
|
|
|
},
|
|
|
|
errorText: {
|
|
|
|
marginBottom: 10,
|
|
|
|
},
|
|
|
|
indicator: {
|
|
|
|
marginTop: 10,
|
|
|
|
marginBottom: 10,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
export default LoginPage
|