Commit fdcc8a1c authored by Ishini Kiridena's avatar Ishini Kiridena

completed family status uis

parent 06b50cf3
...@@ -5,9 +5,11 @@ import MainScreen from "./components/shared/mainview"; ...@@ -5,9 +5,11 @@ import MainScreen from "./components/shared/mainview";
import SplashScreenComponent from "./components/shared/splashscreen"; import SplashScreenComponent from "./components/shared/splashscreen";
import SharedLogin from "./components/shared/sharedLogin"; import SharedLogin from "./components/shared/sharedLogin";
import SharedRegisterScreen from "./components/shared/sharedRegistration"; import SharedRegisterScreen from "./components/shared/sharedRegistration";
import PatientRegOne from "./components/practitionerscreens/registration/regOne"; import PatientRegOne from "./components/patientscreens/registration/regOne";
import PatientRegTwo from "./components/practitionerscreens/registration/regTwo"; import PatientRegTwo from "./components/patientscreens/registration/regTwo";
import PatientRegThree from "./components/practitionerscreens/registration/regThree"; import PatientRegThree from "./components/patientscreens/registration/regThree";
import PatientRegisterFour from "./components/patientscreens/registration/regFour";
import PatientRegFourOptional from "./components/patientscreens/registration/regFourOptional";
const Stack = createStackNavigator(); const Stack = createStackNavigator();
...@@ -54,6 +56,16 @@ export default function App() { ...@@ -54,6 +56,16 @@ export default function App() {
component={PatientRegThree} component={PatientRegThree}
options={{ headerShown: false }} options={{ headerShown: false }}
/> />
<Stack.Screen
name="PatientRegFour"
component={PatientRegisterFour}
options={{ headerShown: false }}
/>
<Stack.Screen
name="PatientRegFourOptional"
component={PatientRegFourOptional}
options={{ headerShown: false }}
/>
</Stack.Navigator> </Stack.Navigator>
) : ( ) : (
<SplashScreenComponent /> <SplashScreenComponent />
...@@ -61,21 +73,3 @@ export default function App() { ...@@ -61,21 +73,3 @@ export default function App() {
</NavigationContainer> </NavigationContainer>
); );
} }
// export default function App() {
// return (
// <View style={styles.container}>
// <Text>Open up App.js to start working on your app!</Text>
// <StatusBar style="auto" />
// </View>
// );
// }
// const styles = StyleSheet.create({
// container: {
// flex: 1,
// backgroundColor: "#fff",
// alignItems: "center",
// justifyContent: "center",
// },
// });
import React, { useState } from "react";
import { View, Text, StyleSheet, Button } from "react-native";
import RadioForm, {
RadioButton,
RadioButtonInput,
RadioButtonLabel,
} from "react-native-simple-radio-button";
export default function PatientRegFour({ navigation, route }) {
const [parentStatus, setParentStatus] = useState(0);
const radioOptions = [
{ label: "Yes", value: 0 },
{ label: "No", value: 1 },
{ label: "Complicated", value: 2 },
];
const handleParentStatusChange = (value) => {
setParentStatus(value);
};
const handleNext = () => {
var data = {
email: route.params.email,
username: route.params.username,
password: route.params.password,
name: route.params.name,
pronoun: route.params.pronoun,
stringDate: route.params.stringDate,
gender: route.params.gender,
orphan: "No",
siblingCount: 0,
};
if (parentStatus === 0) {
navigation.navigate("PatientRegFourOptional", data);
console.log(data);
} else {
//navigation.navigation("PatientRegFive", data)
data.orphan = "Yes";
console.log(data);
}
};
return (
<View style={styles.container}>
<Text>Did you grow up with parents?</Text>
<RadioForm
radio_props={radioOptions}
initial={parentStatus}
onPress={handleParentStatusChange}
formHorizontal={false}
labelHorizontal={true}
buttonColor={"#2196f3"}
selectedButtonColor={"#2196f3"}
labelStyle={{ fontSize: 16, marginHorizontal: 10 }}
style={{ marginVertical: 10 }}
/>
<Button title="Next" onPress={handleNext} />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
},
});
import React, { useState } from "react";
import { View, Text, StyleSheet, TextInput, Button } from "react-native";
export default function PatientRegFourOptional({ navigation, route }) {
const [siblingCount, setSiblingCount] = useState("");
const handleNext = () => {
var data = {
email: route.params.email,
username: route.params.username,
password: route.params.password,
name: route.params.name,
pronoun: route.params.pronoun,
stringDate: route.params.stringDate,
gender: route.params.gender,
orphan: route.params.orphan,
siblingCount: siblingCount.toString(),
};
//navigation.navigate("PatientRegFive", data);
console.log(data);
};
return (
<View style={styles.container}>
<Text>How many siblings did you have?</Text>
<TextInput
style={styles.input}
onChangeText={(text) => setSiblingCount(text)}
value={siblingCount.toString()}
keyboardType="numeric"
/>
<Button title="Next" onPress={handleNext} />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
},
inputContainer: {
marginTop: 20,
},
input: {
height: 40,
width: 200,
borderColor: "gray",
borderWidth: 1,
paddingHorizontal: 10,
},
});
...@@ -18,6 +18,7 @@ export default function PatientRegThree({ navigation, route }) { ...@@ -18,6 +18,7 @@ export default function PatientRegThree({ navigation, route }) {
const [birthday, setBirthday] = useState(new Date()); const [birthday, setBirthday] = useState(new Date());
const [gender, setGender] = useState(""); const [gender, setGender] = useState("");
const [showDatePicker, setShowDatePicker] = useState(false); const [showDatePicker, setShowDatePicker] = useState(false);
var stringDate;
const handleDateChange = (event, selectedDate) => { const handleDateChange = (event, selectedDate) => {
const currentDate = selectedDate || date; const currentDate = selectedDate || date;
...@@ -25,16 +26,21 @@ export default function PatientRegThree({ navigation, route }) { ...@@ -25,16 +26,21 @@ export default function PatientRegThree({ navigation, route }) {
setBirthday(currentDate); setBirthday(currentDate);
}; };
const convertDateToString = () => {
stringDate = birthday.toLocaleDateString();
};
const handleNext = () => { const handleNext = () => {
// navigation.navigate("PatientRegFour", { convertDateToString();
// email: route.params.email, navigation.navigate("PatientRegFour", {
// username: route.params.username, email: route.params.email,
// password: route.params.password, username: route.params.username,
// name: route.params.name, password: route.params.password,
// pronoun: route.params.pronoun, name: route.params.name,
// birthday, pronoun: route.params.pronoun,
// gender, stringDate,
// }); gender,
});
console.log({ console.log({
email: route.params.email, email: route.params.email,
username: route.params.username, username: route.params.username,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment