Skip to content

Commit

Permalink
final. todo: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinekllee committed Jul 22, 2023
1 parent a4713f4 commit 8183647
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 184 deletions.
1 change: 1 addition & 0 deletions frontend/app/screens/LoginScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function LoginScreen({ navigation }) {
const auth = getAuth();

await signInWithEmailAndPassword(auth, email, password);
// await signInWithEmailAndPassword(auth, "[email protected]", "Supersecret1");

const idToken = await auth.currentUser.getIdToken();

Expand Down
76 changes: 32 additions & 44 deletions frontend/app/screens/PatientRegistration.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,40 +239,22 @@ const PatientRegistration = ({ route, navigation }) => {
language: "",
});

const ethnicityRef = useRef();
const birthplaceRef = useRef();
const languageRef = useRef();

const [pickerVisible, setPickerVisible] = useState(false);

const renderPickerSelect = (selectedValue, onValueChange, items, pickerRef) => (
const renderPickerSelect = (selectedValue, onValueChange, items) => (
<View style={styles.inputContainer}>
{pickerVisible && (
<Picker
selectedValue={selectedValue}
onValueChange={(itemValue, itemIndex) => {
onValueChange(itemValue);
setPickerVisible(false);
}}
style={styles.pickerSelectStyles}
>
<Picker.Item label="Select" value={null} />
{items.map((item) => (
<Picker.Item key={item} label={item} value={item} />
))}
</Picker>
)}
{!pickerVisible && (
<TouchableOpacity style={styles.pickerPlaceholderContainer} onPress={() => setPickerVisible(true)}>
<Text style={styles.pickerPlaceholderText}>
{selectedValue || "Select"}
</Text>
</TouchableOpacity>
)}
<Picker
selectedValue={selectedValue}
onValueChange={(itemValue, itemIndex) => {
onValueChange(itemValue);
}}
style={styles.pickerSelectStyles}
>
<Picker.Item label="Select" value={null} />
{items.map((item) => (
<Picker.Item key={item} label={item} value={item} />
))}
</Picker>
</View>
);


);

const [datePickerModalActive, setDatePickerModalActive] = useState(false);

Expand Down Expand Up @@ -349,28 +331,26 @@ const PatientRegistration = ({ route, navigation }) => {
{renderPickerSelect(
formData.ethnicity,
(value) => handleChange(value, "ethnicity"),
ethnicities,
ethnicityRef
ethnicities
)}
</View>

<View style={styles.inputContainer}>
{renderPickerSelect(
formData.birthplace,
(value) => handleChange(value, "birthplace"),
countries,
birthplaceRef
countries
)}
</View>

<View style={styles.inputContainer}>
{renderPickerSelect(
formData.language,
(value) => handleChange(value, "language"),
languages,
languageRef
languages
)}
</View>

<StyledButton
text="Next"
onPress={handleSubmit}
Expand Down Expand Up @@ -424,6 +404,9 @@ const styles = StyleSheet.create({
width: 250,
height: 50,
marginBottom: 10,
// center
justifyContent: "center",
// alignItems: "center",
},
input: {
flex: 1,
Expand All @@ -435,12 +418,17 @@ const styles = StyleSheet.create({
},
pickerSelectStyles: {
textAlign: "center",
marginTop: 13,
inputIOS: {
color: colours.primaryText,
textAlign: "center",
marginTop: 13,
}
marginTop: 4,
// inputIOS: {
// color: colours.primaryText,
// textAlign: "center",
// marginTop: 13,
// },
// inputAndroid: {
// color: colours.primaryText,
// textAlign: "center",
// marginTop: 13,
// }
},
pickerPlaceholderContainer: {
flex: 1,
Expand Down
Loading

0 comments on commit 8183647

Please sign in to comment.