Front: Add Basic authentication view
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import React from "react";
|
||||
import { Text, View } from 'react-native';
|
||||
import { Button } from "react-native-paper";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { setUserToken } from "../state/UserSlice";
|
||||
|
||||
const AuthenticationView = () => {
|
||||
const dispatch = useDispatch();
|
||||
return (
|
||||
<View style={{ flex: 1, justifyContent: 'center' }}>
|
||||
<Text style={{ textAlign: "center" }}>Welcom to Chromacase</Text>
|
||||
<Text style={{ textAlign: "center" }}>This is the Authentication Screen</Text>
|
||||
<Button onPress={() => dispatch(setUserToken('kkkk'))}>
|
||||
Tap here to login
|
||||
</Button>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
export default AuthenticationView;
|
||||
@@ -1,26 +1,17 @@
|
||||
import React from "react";
|
||||
import { Text, View, ColorValue } from 'react-native';
|
||||
import { useTheme } from "react-native-paper";
|
||||
|
||||
const ExampleBox = (props: { textColor: ColorValue, backgroundColor: ColorValue }) => (
|
||||
<View style={{ backgroundColor: props.backgroundColor }}>
|
||||
<Text style={{ fontSize: 20, textAlign: 'center', color: props.textColor }} >Hello</Text>
|
||||
</View>
|
||||
)
|
||||
import { Text, View } from 'react-native';
|
||||
import { Button } from "react-native-paper";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { unsetUserToken } from "../state/UserSlice";
|
||||
|
||||
const HomeView = () => {
|
||||
const { colors } = useTheme();
|
||||
const dispatch = useDispatch();
|
||||
return (
|
||||
<View style={{ flex: 1, justifyContent: 'center' }}>
|
||||
<ExampleBox backgroundColor={colors.primary} textColor={colors.text} />
|
||||
<ExampleBox backgroundColor={colors.accent} textColor={colors.text} />
|
||||
<ExampleBox backgroundColor={colors.error} textColor={colors.text} />
|
||||
<ExampleBox backgroundColor={colors.surface} textColor={colors.onSurface} />
|
||||
<ExampleBox backgroundColor={colors.surface} textColor={colors.placeholder} />
|
||||
<ExampleBox backgroundColor={colors.notification} textColor={colors.text} />
|
||||
<Text style={{ textAlign: "center" }}>This is the Home Screen</Text>
|
||||
<Button onPress={() => dispatch(unsetUserToken())}>Log out</Button>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
export default HomeView;
|
||||
|
||||
Reference in New Issue
Block a user