Skip to content

Commit

Permalink
feat: Remove console.log statements and update keyboard behavior in S…
Browse files Browse the repository at this point in the history
…ignUp screen
  • Loading branch information
KamogeloMoeketse committed Aug 7, 2024
1 parent 7472929 commit 4334926
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 34 deletions.
2 changes: 1 addition & 1 deletion frontend/occupi-mobile4/screens/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const Dashboard = () => {
try {
const prediction = await getFormattedPredictionData();
if (prediction) {
console.log(prediction);
// console.log(prediction);
setCurrentData(prediction);
}
} catch (error) {
Expand Down
67 changes: 37 additions & 30 deletions frontend/occupi-mobile4/screens/Login/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ import {
InputSlot,
FormControlLabel,
FormControlLabelText,
View
View,
} from '@gluestack-ui/themed';
import { retrievePushToken } from '@/utils/notifications';
import GradientButton from '@/components/GradientButton';
import { Controller, useForm } from 'react-hook-form';
import { AlertTriangle, EyeIcon, EyeOffIcon } from 'lucide-react-native';
import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import { Keyboard } from 'react-native';
import { Keyboard, KeyboardAvoidingView, Platform, ScrollView } from 'react-native';
// import { FacebookIcon, GoogleIcon } from './assets/Icons/Social';
import StyledExpoRouterLink from '../../components/StyledExpoRouterLink';
import { router } from 'expo-router';
Expand Down Expand Up @@ -88,18 +88,18 @@ const SignUpForm = () => {
const onSubmit = async (_data: SignUpSchemaType) => {
if (_data.password === _data.confirmpassword) {
setLoading(true);
const response = await userRegister(_data.email, _data.password, _data.employeeId);
toast.show({
placement: 'top',
render: ({ id }) => {
return (
<Toast nativeID={String(id)} variant="accent" action={response === 'Successful login!' ? 'success' : 'error'}>
<ToastTitle>{response}</ToastTitle>
</Toast>
);
}
});
setLoading(false);
const response = await userRegister(_data.email, _data.password, _data.employeeId);
toast.show({
placement: 'top',
render: ({ id }) => {
return (
<Toast nativeID={String(id)} variant="accent" action={response === 'Successful login!' ? 'success' : 'error'}>
<ToastTitle>{response}</ToastTitle>
</Toast>
);
}
});
setLoading(false);
} else {
toast.show({
placement: 'bottom right',
Expand Down Expand Up @@ -480,21 +480,28 @@ function SignUpFormComponent() {

export default function SignUp() {
return (
<View flex="$1" pt="$12" backgroundColor='white'>
<Box
sx={{
'@md': {
display: 'flex',
},
}}
flex={1}
display="none"
>
{/* <SideContainerWeb /> */}
</Box>
<Box flex={1}>
<SignUpFormComponent />
</Box>
</View>
// <ScrollView>
<KeyboardAvoidingView
behavior={Platform.OS === "ios" ? "padding" : "height"}
style={{ flex: 1 }}
>
<ScrollView flex="$1" pt="$12" backgroundColor='white'>
<Box
sx={{
'@md': {
display: 'flex',
},
}}
flex={1}
display="none"
>
{/* <SideContainerWeb /> */}
</Box>
<Box flex={1}>
<SignUpFormComponent />
</Box>
</ScrollView>
</KeyboardAvoidingView>
// </ScrollView>
);
}
2 changes: 1 addition & 1 deletion frontend/occupi-mobile4/screens/Login/SplashScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default function SplashScreen() {
useEffect(() => {
const timer = setTimeout(() => {
setSelectedIndex(1); // Assuming Onboarding1 is at index 1
router.replace('/signup'); // Navigate to Onboarding1 screen
router.replace('/login'); // Navigate to Onboarding1 screen
}, 5000); // 8 seconds

return () => clearTimeout(timer); // Clean up timer on component unmount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const Notifications = () => {
};

if (notifications) {
console.log('yurpp');
// console.log('yurpp');
notifications.forEach(notification => {
const formattedDate = formatNotificationDate(notification.send_time);

Expand Down
2 changes: 1 addition & 1 deletion frontend/occupi-mobile4/utils/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export async function updateDetails(name: string, dob: string, gender: string, c
console.log(response);
if (state === "verify_otp_register") {
setState("logged_out");
router.replace('/login');
router.replace('/home');
return;
}
router.replace('/settings')
Expand Down

0 comments on commit 4334926

Please sign in to comment.