diff --git a/client/app/components/settings/TextInputs.tsx b/client/app/components/settings/TextInputs.tsx
new file mode 100644
index 000000000..62d43c85e
--- /dev/null
+++ b/client/app/components/settings/TextInputs.tsx
@@ -0,0 +1,171 @@
+import React, {useState} from "react";
+import {
+ Button,
+ Modal,
+ SafeAreaView,
+ Text,
+ TextInput,
+ View,
+ StyleSheet,
+ Pressable,
+ TouchableWithoutFeedback
+} from "react-native";
+
+type GenericTextInputProps = {
+ defaultValue: string;
+ isVisible: boolean;
+ visibleSetter: Function;
+ outputSetter: Function;
+ headerText: string;
+ errorMessage: string;
+ maxLength: number;
+ inputValidator: Function;
+
+}
+
+const GenericTextInput = ({
+ defaultValue,
+ isVisible,
+ visibleSetter,
+ outputSetter,
+ headerText,
+ errorMessage,
+ maxLength,
+ inputValidator,
+}: GenericTextInputProps) => {
+ const[textInput, setTextInput] = useState('');
+ const[error, setError] = useState('');
+
+ return(
+ {
+ visibleSetter(false);
+ setError('');
+ }}
+ >
+ {
+ visibleSetter(false);
+ setError('');
+ }}>
+
+
+
+ {headerText}
+ {error}
+ {setTextInput(text); setError('');}}
+ />
+
+
+
+
+
+
+
+ )};
+
+type InputProps = {
+ defaultValue: string;
+ isVisible: boolean;
+ visibleSetter: Function;
+ outputSetter: Function;
+};
+
+export const DisplayNameInput = ({
+ defaultValue,
+ isVisible,
+ visibleSetter,
+ outputSetter,
+}: InputProps) => GenericTextInput({
+ defaultValue: defaultValue,
+ isVisible: isVisible,
+ visibleSetter: visibleSetter,
+ outputSetter: outputSetter,
+ headerText: "Edit Display Name",
+ errorMessage: "Please enter a display name.",
+ maxLength: 12,
+ inputValidator: (input: string) => input.length > 0,
+});
+
+export const ColorInput = ({
+ defaultValue,
+ isVisible,
+ visibleSetter,
+ outputSetter,
+}: InputProps) => GenericTextInput({
+ defaultValue: defaultValue,
+ isVisible: isVisible,
+ visibleSetter: visibleSetter,
+ outputSetter: outputSetter,
+ headerText: "Edit Profile Color",
+ errorMessage: "Please enter a valid hex code.",
+ maxLength: 7,
+ inputValidator: (input: string) => (/^#[0-9A-Fa-f]{6}|#[0-9A-Fa-f]{3}$/).exec(input),
+});
+
+const styles = StyleSheet.create({
+ inputHeader: {
+ fontSize: 14,
+ fontWeight: "600",
+ color: "#a7a7a7",
+ textTransform: "uppercase",
+ letterSpacing: 1.2,
+ },
+ centeredView: {
+ height: "100%",
+ justifyContent: "flex-start",
+ alignItems: "center",
+ backgroundColor: "rgba(54, 54, 54, 0.5)",
+ },
+ inputModal: {
+ alignItems: "center",
+ backgroundColor: "#cccccc",
+ marginTop: "50%",
+ width: "70%",
+ borderRadius: 20,
+ padding: "5%",
+ shadowColor: "black",
+ shadowOffset: {
+ width: 0,
+ height: 2,
+ },
+ shadowOpacity: 0.25,
+ shadowRadius: 4,
+ elevation: 5,
+ },
+ buttonContainer: {
+ paddingHorizontal: "5%",
+ flexDirection: 'row',
+ justifyContent: 'space-between',
+ width: "90%",
+ },
+ textInput: {
+ marginVertical: "5%",
+ width: "75%",
+ textAlign: "center",
+ borderBottomWidth: 2,
+ fontSize: 20,
+ },
+});
\ No newline at end of file
diff --git a/client/app/screens/settings/SettingsScreen.tsx b/client/app/screens/settings/SettingsScreen.tsx
index 4db3a2632..33fd90697 100644
--- a/client/app/screens/settings/SettingsScreen.tsx
+++ b/client/app/screens/settings/SettingsScreen.tsx
@@ -1,7 +1,20 @@
import React, { useState } from "react";
-import { SafeAreaView, Text, StyleSheet, View, ScrollView } from "react-native";
+import {
+ SafeAreaView,
+ Text,
+ StyleSheet,
+ View,
+ ScrollView,
+ Image,
+ Pressable,
+ Modal,
+ Button,
+ FlatList,
+ TouchableWithoutFeedback
+} from "react-native";
import { SettingsItem } from "../../components/settings/SettingsItem";
+import {ColorInput, DisplayNameInput} from "@app/components/settings/TextInputs";
// List of settings items
// toggle type: a switch
@@ -33,18 +46,122 @@ const Sections = [
const SettingsScreen: React.FC = () => {
// settings values (will be changed later to reflect the actual settings)
const [data, setData] = useState({
+ displayName: "Display Name",
+ profilePicIndex: 0, // index for icons array
+ profileColor: "#1199ff",
notifyNewMessage: true,
darkMode: false,
language: "English",
deleteMessages: false,
});
+ const[profileVisible, setProfileVisible] = useState(false);
+ const[inputVisible, setInputVisible] = useState({
+ displayName: false,
+ profileColor: false,
+ });
+
+
+ const iconStyle = [styles.icon, {backgroundColor: data.profileColor}]
+
+ const icons = [
+ require("../../../assets/icons/user/face_01.png"),
+ require("../../../assets/icons/user/face_02.png"),
+ require("../../../assets/icons/user/face_03.png"),
+ require("../../../assets/icons/user/face_04.png"),
+ require("../../../assets/icons/user/face_05.png"),
+ require("../../../assets/icons/user/face_06.png"),
+ require("../../../assets/icons/user/face_07.png"),
+ require("../../../assets/icons/user/fake_pfp.jpg"),
+ ];
+
return (
+
+ {/* User Settings Menu */}
+ setProfileVisible(false)}
+ >
+
+ setProfileVisible(false)}>
+
+
+
+
+ Hi {data.displayName}!
+
+ setProfileVisible(false)}>
+
+
+
+
+ setInputVisible({...inputVisible, ["displayName"]: value})}
+ outputSetter={(output: string) => setData({...data, ["displayName"]: output})}
+ />
+ setInputVisible({...inputVisible, ["profileColor"]: value})}
+ outputSetter={(output: string) => setData({...data, ["profileColor"]: output})}
+ />
+
+ {/* User Settings */}
+
+
+ Edit Profile
+
+
+ setInputVisible({...inputVisible, ["displayName"]: true})}
+ />
+ setInputVisible({...inputVisible, ["profileColor"]: true})}
+ />
+
+
+ Change profile picture
+
+
+ (
+ setData({ ...data, ["profilePicIndex"]: icon.index })}>
+
+
+ )}>
+
+
+
+
+
+
+
+
+
+ {/* Settings Screen */}
Settings
+ setProfileVisible(true)}>
+
+
+
{Sections.map(({ header, items }) => (
@@ -79,6 +196,8 @@ const styles = StyleSheet.create({
paddingVertical: 24,
},
header: {
+ flexDirection: "row",
+ justifyContent: "space-between",
paddingLeft: 24,
paddingRight: 24,
},
@@ -106,6 +225,23 @@ const styles = StyleSheet.create({
borderBottomWidth: 1,
borderColor: "#e3e3e3",
},
+ icon: {
+ width: 50,
+ height: 50,
+ borderRadius: 20,
+ },
+ selected: {
+ borderWidth: 3,
+ borderColor: "yellow",
+ margin: 5,
+ },
+ userModal: {
+ backgroundColor: "#d4d4d4",
+ borderRadius: 10,
+ paddingVertical: 24,
+ marginLeft: "auto",
+ height: "50%", // For some reason I can't get the view to auto fit height to children so just set to 50% for now
+ },
});
export default SettingsScreen;