Merge branch '32-fix-welcome-component-colors' into 'main'
Resolve "fix welcome component colors" Closes #32 See merge request thschleicher/interaktive-systeme!11
This commit is contained in:
commit
8bd54574cc
6 changed files with 56 additions and 34 deletions
|
|
@ -9,6 +9,7 @@ import { useRouter } from "expo-router"
|
||||||
import { useAuth } from '../../contexts/AuthContext';
|
import { useAuth } from '../../contexts/AuthContext';
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
|
const backgroundColor = useThemeColor("backgroundColor")
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const {onLogout} = useAuth();
|
const {onLogout} = useAuth();
|
||||||
const [plusShow, setPlusShow] = useState(true);
|
const [plusShow, setPlusShow] = useState(true);
|
||||||
|
|
@ -53,7 +54,7 @@ export default function Page() {
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView style={{flex: 1}}>
|
<SafeAreaView style={{flex: 1, backgroundColor: backgroundColor}}>
|
||||||
{plusShow && <Plus onPress={()=>{
|
{plusShow && <Plus onPress={()=>{
|
||||||
router.push("/(tabs)/home/addItem")
|
router.push("/(tabs)/home/addItem")
|
||||||
}}/>}
|
}}/>}
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,17 @@ import { useAuth } from './contexts/AuthContext'
|
||||||
import { Redirect } from 'expo-router';
|
import { Redirect } from 'expo-router';
|
||||||
import { FontAwesome } from "@expo/vector-icons";
|
import { FontAwesome } from "@expo/vector-icons";
|
||||||
import { Input } from '../components';
|
import { Input } from '../components';
|
||||||
|
import { useThemeColor } from '../hooks/hooks';
|
||||||
|
|
||||||
export default function login() {
|
export default function login() {
|
||||||
const [email, setEmail] = useState("");
|
const [email, setEmail] = useState("");
|
||||||
const [password, setPassword] = useState("")
|
const [password, setPassword] = useState("")
|
||||||
const {authState, onLogin} = useAuth();
|
const {authState, onLogin} = useAuth()
|
||||||
|
const backgroundColor = useThemeColor("backgroundColor")
|
||||||
|
const textColor = useThemeColor("primaryText");
|
||||||
|
const elementDefaultColor = useThemeColor("elementDefaultColor")
|
||||||
|
|
||||||
|
|
||||||
// const {authState, onLogin} = useAuth();
|
// const {authState, onLogin} = useAuth();
|
||||||
// useEffect(() => {
|
// useEffect(() => {
|
||||||
// login()
|
// login()
|
||||||
|
|
@ -22,24 +28,27 @@ export default function login() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<SafeAreaView style={{flex: 1, justifyContent: "center"}}>
|
<SafeAreaView style={{flex: 1, justifyContent: "center", backgroundColor: backgroundColor}}>
|
||||||
{authState?.authenticated &&
|
{authState?.authenticated &&
|
||||||
<Redirect href={"/"}></Redirect>}
|
<Redirect href={"/"}></Redirect>}
|
||||||
<Input
|
<Input
|
||||||
placeholder={'Email'}
|
placeholder={'Enter Email'}
|
||||||
label='Email or Username'
|
label='Email or Username'
|
||||||
leftIcon={<FontAwesome name="user" size={20} />}
|
labelColor={textColor}
|
||||||
|
leftIcon={<FontAwesome name="user" size={20} color={textColor} />}
|
||||||
onChangeHandler={setEmail}
|
onChangeHandler={setEmail}
|
||||||
|
bgColor ={elementDefaultColor}
|
||||||
/>
|
/>
|
||||||
<Input
|
<Input
|
||||||
placeholder={'Enter Password'}
|
placeholder={'Enter Password'}
|
||||||
label='Password'
|
label='Password'
|
||||||
leftIcon={<FontAwesome name="key" size={20} />}
|
labelColor={textColor}
|
||||||
rightIcon={<FontAwesome name="key" size={20} />}
|
leftIcon={<FontAwesome name="key" size={20} color={textColor}/>}
|
||||||
onChangeHandler={setPassword}
|
onChangeHandler={setPassword}
|
||||||
|
bgColor ={elementDefaultColor}
|
||||||
secure = {true}
|
secure = {true}
|
||||||
/>
|
/>
|
||||||
<Button title='login' onPress={login}></Button>
|
<Button title='Login' onPress={login}></Button>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,12 @@ import { SIZES } from '../../../constants/theme';
|
||||||
|
|
||||||
type SearchBarProps = {placeholder: string} & ViewProps
|
type SearchBarProps = {placeholder: string} & ViewProps
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default function SearchBar(props: SearchBarProps) {
|
export default function SearchBar(props: SearchBarProps) {
|
||||||
const [isActive, setIsactive] = React.useState(false);
|
const [isActive, setIsactive] = React.useState(false);
|
||||||
|
|
||||||
const backgroundColor = useThemeColor("backgroundColor");
|
const textColor = useThemeColor("interactiveText")
|
||||||
|
const backgroundColor = useThemeColor("elementDefaultColor");
|
||||||
|
|
||||||
const handleChange = (text:string) : void => {
|
const handleChange = (text:string) : void => {
|
||||||
if(text !== ""){
|
if(text !== ""){
|
||||||
if(!isActive){
|
if(!isActive){
|
||||||
|
|
@ -24,9 +24,16 @@ export default function SearchBar(props: SearchBarProps) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Handle textCancel
|
// cant apply the background color otherwise
|
||||||
|
const containerStyle = {
|
||||||
|
...styles.container,
|
||||||
|
backgroundColor: backgroundColor // apply dynamic background color
|
||||||
|
};
|
||||||
|
|
||||||
|
//TODO: Handle textCancel
|
||||||
|
// changed styles.container to containerStyle
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={containerStyle}>
|
||||||
<TextInput onChangeText = {handleChange} style={[{fontSize: SIZES.normal, height: "100%"}, styles.TextInput]} autoCorrect={false} keyboardType='web-search' placeholder={props.placeholder}></TextInput>
|
<TextInput onChangeText = {handleChange} style={[{fontSize: SIZES.normal, height: "100%"}, styles.TextInput]} autoCorrect={false} keyboardType='web-search' placeholder={props.placeholder}></TextInput>
|
||||||
|
|
||||||
{isActive &&
|
{isActive &&
|
||||||
|
|
@ -46,7 +53,6 @@ const styles = StyleSheet.create({
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
height: 40,
|
height: 40,
|
||||||
backgroundColor: "red", //tochange
|
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
paddingHorizontal: 10
|
paddingHorizontal: 10
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,13 @@ export default function Welcome(props: WelcomeProps) {
|
||||||
const onpress = props.onPress
|
const onpress = props.onPress
|
||||||
|
|
||||||
const textcolor = useThemeColor("primaryText")
|
const textcolor = useThemeColor("primaryText")
|
||||||
|
//const backgroundColor: string = useThemeColor("backgroundColor")
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{
|
<View style={{
|
||||||
marginVertical: 20,
|
marginVertical: 20,
|
||||||
marginHorizontal: MARGINS.normal,
|
marginHorizontal: MARGINS.normal,
|
||||||
|
//backgroundColor: backgroundColor,
|
||||||
}}>
|
}}>
|
||||||
<View style={{
|
<View style={{
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { TextInputEndEditingEventData } from 'react-native/Libraries/Components/
|
||||||
|
|
||||||
interface InputProps {
|
interface InputProps {
|
||||||
label? : string,
|
label? : string,
|
||||||
|
labelColor?: string,
|
||||||
outlined? : boolean,
|
outlined? : boolean,
|
||||||
placeholder?: string,
|
placeholder?: string,
|
||||||
leftIcon?: any,
|
leftIcon?: any,
|
||||||
|
|
@ -20,6 +21,7 @@ interface InputProps {
|
||||||
|
|
||||||
function Input({
|
function Input({
|
||||||
label,
|
label,
|
||||||
|
labelColor,
|
||||||
outlined,
|
outlined,
|
||||||
placeholder,
|
placeholder,
|
||||||
leftIcon,
|
leftIcon,
|
||||||
|
|
@ -32,13 +34,17 @@ function Input({
|
||||||
errorColor,
|
errorColor,
|
||||||
bgColor
|
bgColor
|
||||||
} : InputProps) {
|
} : InputProps) {
|
||||||
|
const labelStyle = {
|
||||||
|
...styles.label,
|
||||||
|
color: labelColor ? labelColor : 'black',
|
||||||
|
};
|
||||||
const containerBorder = outlined ? styles.outlined : styles.standard
|
const containerBorder = outlined ? styles.outlined : styles.standard
|
||||||
if(numLines == undefined){
|
if(numLines == undefined){
|
||||||
numLines = 1
|
numLines = 1
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<View style={{padding:10}}>
|
<View style={{padding:10}}>
|
||||||
<Text style={styles.label}>{label}</Text>
|
<Text style={labelStyle}>{label}</Text>
|
||||||
<View
|
<View
|
||||||
style={[styles.container, containerBorder, {backgroundColor: bgColor ? bgColor : "white"}]}>
|
style={[styles.container, containerBorder, {backgroundColor: bgColor ? bgColor : "white"}]}>
|
||||||
<View style={{paddingRight:10}}>{leftIcon}</View>
|
<View style={{paddingRight:10}}>{leftIcon}</View>
|
||||||
|
|
@ -48,7 +54,7 @@ function Input({
|
||||||
}
|
}
|
||||||
onChangeText={onChangeHandler}
|
onChangeText={onChangeHandler}
|
||||||
onEndEditing={validate}
|
onEndEditing={validate}
|
||||||
multiline={numLines > 1 ? true : false}
|
multiline={numLines > 1}
|
||||||
numberOfLines={numLines}
|
numberOfLines={numLines}
|
||||||
style={{flex: 4}}
|
style={{flex: 4}}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,30 @@
|
||||||
export default {
|
export default {
|
||||||
light: {
|
light: {
|
||||||
primaryText: "#000000",
|
primaryText: "#000000",
|
||||||
secondaryText: "#404040",
|
secondaryText: "#9E9E9E",
|
||||||
interactiveText: "#0645AD",
|
interactiveText: "#388BFF",
|
||||||
|
|
||||||
|
tabIconDefault: "#FFFFFF",
|
||||||
|
tabIconSelected: "#EF6C00",
|
||||||
|
|
||||||
|
backgroundColor: "#FFFFFF",
|
||||||
tabIconDefault: "gray",
|
containerColor: "#F5F5F5",
|
||||||
tabIconSelected: "#ED7D31",
|
elementDefaultColor: "#E0E0E0",
|
||||||
color: "#000000",
|
elementSelectedColor: "#9E9E9E",
|
||||||
accentColor: "#ED7D31",
|
accentColor: "#EF6C00",
|
||||||
backgroundColor: "#ffffff",
|
|
||||||
tabBarColor: "gray",
|
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
// Text
|
|
||||||
primaryText: "#FFFFFF",
|
primaryText: "#FFFFFF",
|
||||||
secondaryText: "#B3B3B3",
|
secondaryText: "#B3B3B3",
|
||||||
interactiveText: "#0645AD",
|
interactiveText: "#388BFF",
|
||||||
|
|
||||||
// Tabs
|
|
||||||
tabIconDefault: "#FFFFFF",
|
tabIconDefault: "#FFFFFF",
|
||||||
tabIconSelected: "#ED7D31",
|
tabIconSelected: "#EF6C00",
|
||||||
|
|
||||||
//
|
backgroundColor: "#121212",
|
||||||
color: "#FFFFFF",
|
containerColor: "#181818",
|
||||||
accentColor: "#ED7D31",
|
elementDefaultColor: "#535353",
|
||||||
backgroundColor: "#181818",
|
elementSelectedColor: "#B3B3B3",
|
||||||
tabBarColor: "#121212",
|
accentColor: "#EF6C00",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in a new issue