Skip to content

Commit 347e53f

Browse files
committedApr 17, 2024
Recent push
1 parent 5b9e5da commit 347e53f

8 files changed

+91
-92
lines changed
 

‎Screens/SignUp/AgeScreen.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ import ComponentStyle from '../../Styles/ComponentStyles';
1414
import SignUpStyle from '../../Styles/SignUpStyle';
1515
import { COLOR } from '../../Styles/Colors';
1616

17-
const AgeScreen = ({ SignUpData }) =>
17+
const AgeScreen = ({ navigation, route }) =>
1818
{
19-
const navigation = useNavigation();
19+
const { SignUpData } = route.params;
20+
2021
const [birthday, setBirthday] = useState(null);
2122
const [isPickerVisible, setPickerVisibility] = useState(false);
2223
const today = new Date();
@@ -56,9 +57,9 @@ const AgeScreen = ({ SignUpData }) =>
5657
{
5758
if (isValidDate(birthday))
5859
{
60+
const updatedSignUpData = { ...SignUpData, birthday };
5961
setPickerVisibility(false);
60-
SignUpData.birthday = birthday;
61-
navigation.navigate('BodyInfoScreen', { SignUpData });
62+
navigation.navigate('BodyInfoScreen', { SignUpData: updatedSignUpData });
6263
}
6364
else
6465
{

‎Screens/SignUp/BodyInfoScreen.tsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import ComponentStyle from '../../Styles/ComponentStyles';
1515
import { COLOR } from '../../Styles/Colors';
1616

1717

18-
const BodyInfoScreen = ({ SignUpData }) =>
18+
const BodyInfoScreen = ({ navigation, route }) =>
1919
{
20-
const navigation = useNavigation();
20+
const { SignUpData } = route.params;
2121

2222
const [isRulerVisible, setRulerVisibility] = useState(false);
2323
const [isWeightFocused, setWeightFocus] = useState(false);
@@ -77,10 +77,8 @@ const BodyInfoScreen = ({ SignUpData }) =>
7777
let isWeightValid = isValidWeight(weight);
7878
if (rulerVal && isValidWeight(weight) && gender)
7979
{
80-
SignUpData.height = rulerVal;
81-
SignUpData.weight = weight;
82-
SignUpData.gender = gender;
83-
navigation.navigate('GoalScreen', SignUpData);
80+
const updatedSignUpData = { ...SignUpData, heightInches: rulerVal, weight, gender };
81+
navigation.navigate('GoalScreen', { SignUpData: updatedSignUpData });
8482
}
8583
else
8684
{

‎Screens/SignUp/EmailScreen.tsx

+8-9
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface SignUpData {
1616
username: string;
1717
password: string;
1818
birthday: Date;
19-
height: number;
19+
heightInches: number;
2020
weight: number;
2121
gender: string;
2222
goal: string;
@@ -25,19 +25,19 @@ interface SignUpData {
2525
const EmailScreen = () =>
2626
{
2727
const navigation = useNavigation();
28-
const [SignUpData] = useState<SignUpData>({
28+
29+
const [email, setEmail] = useState('');
30+
const [SignUpData, setSignUpData] = useState<SignUpData>({
2931
email: '',
3032
username: '',
3133
password: '',
3234
birthday: '',
33-
height: '',
34-
weight: '',
35+
heightInches: 0,
36+
weight: 0,
3537
gender: '',
3638
goal: '',
3739
});
3840

39-
const [email, setEmail] = useState('');
40-
4141
const returnLoginArrow = () => {
4242
Alert.alert(
4343
'Do you want to stop creating your account?',
@@ -56,15 +56,14 @@ const EmailScreen = () =>
5656
}
5757
]
5858
)
59-
6059
};
6160

6261
const nextButton = () =>
6362
{
6463
if (isValidEmail(email))
6564
{
66-
SignUpData.email = email;
67-
navigation.navigate('UsernameScreen', { SignUpData });
65+
setSignUpData((prevSignUpData) => ({ ...prevSignUpData, email }));
66+
navigation.navigate('UsernameScreen',{ SignUpData });
6867
}
6968
else
7069
{

‎Screens/SignUp/GoalScreen.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ import ComponentStyle from '../../Styles/ComponentStyles';
1313
import { COLOR } from '../../Styles/Colors';
1414

1515

16-
const GoalScreen = ({ SignUpData }) =>
16+
const GoalScreen = ({ navigation, route }) =>
1717
{
18-
const navigation = useNavigation();
18+
const { SignUpData } = route.params;
1919

2020
const [goal, setGoal] = useState('');
2121

22-
2322
// These are used to better show the users their height
2423
const [feet, setFeet] = useState(0);
2524
const [inches, setInches] = useState(0);
@@ -33,7 +32,9 @@ const GoalScreen = ({ SignUpData }) =>
3332
};
3433

3534
const createAccountButton = () => {
36-
console.log(SignUpData);
35+
36+
const updatedSignUpData = { ...SignUpData, goal };
37+
console.log(updatedSignUpData);
3738
};
3839

3940
return (

‎Screens/SignUp/PasswordScreen.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import { isValidPassword } from '../../Utils/DataVerify';
1111
import Styles from '../../Styles/Styles';
1212
import SignUpStyle from '../../Styles/SignUpStyle';
1313

14-
const PasswordScreen = ({ SignUpData }) =>
14+
const PasswordScreen = ({ navigation, route }) =>
1515
{
16-
const navigation = useNavigation();
16+
const { SignUpData } = route.params;
17+
1718
const [password, setPassword] = useState('');
1819

1920
const backArrow = () => {
@@ -26,8 +27,8 @@ const PasswordScreen = ({ SignUpData }) =>
2627
let isPasswordValid = isValidPassword(password)
2728
if (isPasswordValid.isValid)
2829
{
29-
SignUpData.password = password;
30-
navigation.navigate('AgeScreen', { SignUpData });
30+
const updatedSignUpData = { ...SignUpData, password };
31+
navigation.navigate('AgeScreen', { SignUpData: updatedSignUpData });
3132
}
3233
else
3334
{
@@ -49,6 +50,7 @@ const PasswordScreen = ({ SignUpData }) =>
4950
placeholder="Password"
5051
value={password}
5152
onChangeText={setPassword}
53+
secureTextEntry={true}
5254
style={{
5355
container: SignUpStyle.input,
5456
heading: SignUpStyle.heading,

‎Screens/SignUp/UsernameScreen.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import { isValidUsername } from '../../Utils/DataVerify';
1111
import Styles from '../../Styles/Styles';
1212
import SignUpStyle from '../../Styles/SignUpStyle';
1313

14-
const UsernameScreen = ({ email }) =>
15-
{
16-
const navigation = useNavigation();
14+
const UsernameScreen = ({navigation, route }) => {
15+
const { SignUpData } = route.params;
16+
1717
const [username, setUsername] = useState('');
1818

1919
const backArrow = () => {
@@ -24,7 +24,8 @@ const UsernameScreen = ({ email }) =>
2424
{
2525
if (isValidUsername(username))
2626
{
27-
navigation.navigate('PasswordScreen', { email, username });
27+
const updatedSignUpData = { ...SignUpData, username };
28+
navigation.navigate('PasswordScreen', { SignUpData: updatedSignUpData });
2829
}
2930
else
3031
{

‎babel.config.js

-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
module.exports = function(api) {
22
api.cache(true);
33
return {
4-
{
54
"presets": ["babel-preset-expo"],
6-
//"plugins": ["@babel/plugin-proposal-optional-chaining"]
7-
}
85
};
96
};

‎package-lock.json

+58-58
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.