Fixed onboarding page

This commit is contained in:
Keannu Christian Bernasol 2023-07-17 22:44:50 +08:00
parent 8de8e67070
commit e67485d247
8 changed files with 201 additions and 110 deletions

View file

@ -0,0 +1,37 @@
import * as React from "react";
import { View, Text, ScrollView } from "react-native";
import styles from "../../styles";
import { colors } from "../../styles";
import { MotiView, MotiScrollView } from "moti";
export interface props {
children: React.ReactNode;
}
export default function AnimatedContainerNoScroll(props: props) {
return (
<MotiView
style={styles.container}
from={{
borderRadius: 0,
opacity: 0,
backgroundColor: colors.secondary_2,
paddingTop: 4,
paddingBottom: 4,
marginHorizontal: "4%",
marginVertical: "10%",
}}
animate={{
borderRadius: 15,
opacity: 1,
backgroundColor: colors.secondary_2,
paddingTop: 16,
paddingBottom: 16,
marginHorizontal: "4%",
marginVertical: "5%",
}}
transition={{ type: "timing", duration: 700 }}
>
{props.children}
</MotiView>
);
}

View file

@ -218,6 +218,29 @@ export async function GetYearLevels() {
});
}
export async function GetSubjects(
course: string,
year_level: string,
semester: string
) {
const config = await GetConfig();
return instance
.get(
"/api/v1/subjects/" + course + "/" + year_level + "/" + semester,
config
)
.then((response) => {
// console.log(JSON.stringify(response.data));
return [true, response.data];
})
.catch((error) => {
let error_message = "";
if (error.response) error_message = error.response.data;
else error_message = "Unable to reach servers";
return [false, error_message];
});
}
export async function OnboardingUpdateStudentInfo(info: OnboardingParams) {
const config = await GetConfig();
return instance

View file

@ -5,26 +5,20 @@ import styles from "../../styles";
export interface props {
children: React.ReactNode;
onPress: (event: GestureResponderEvent) => void;
color: string;
color?: string;
disabled?: boolean;
}
export default function Button({ disabled = false, ...props }: props) {
const rgb = props.color.match(/\d+/g);
export default function Button({
disabled = false,
color = "rgba(52, 52, 52, 0.8)",
...props
}: props) {
return (
<Pressable
disabled={disabled}
onPress={props.onPress}
style={{
...styles.button_template,
...{
backgroundColor: disabled
? rgb
? `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, 0.3)`
: "rgba(0, 0, 0, 0)"
: props.color,
},
}}
style={styles.button_template}
>
{props.children}
</Pressable>