Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed key error for settings page #230

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions client/app/screens/chat/ChatScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as Crypto from "expo-crypto";
import React, { useEffect } from "react";
import {
KeyboardAvoidingView,
Platform,
Expand All @@ -17,6 +16,7 @@ import { useSettings } from "../../contexts/SettingsContext";
import { useSocket } from "../../contexts/SocketContext";
import { AuthStore } from "../../services/AuthStore";
import { Message } from "../../types/Message";
import { useState, useEffect } from "react";

const ChatScreen = () => {
const settings = useSettings();
Expand All @@ -28,8 +28,9 @@ const ChatScreen = () => {
// Note: To prevent complexity, all user information is grabbed from different contexts and services. If we wanted most information inside of UserContext, we would have to import contexts within contexts and have state change as certain things mount, which could cause errors that are difficult to pinpoint.

// Message loading and sending logic
const [messages, setMessages] = React.useState<Message[]>([]);
const [messageContent, setMessageContent] = React.useState<string>("");
const [messages, setMessages] = useState<Message[]>([]);
const [messageContent, setMessageContent] = useState<string>("");


useEffect(() => {
if (socket === null) return; // This line might need to be changed
Expand Down
5 changes: 3 additions & 2 deletions client/app/screens/settings/SettingsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { SettingsItem } from "../../components/settings/SettingsItem";
// select type: arrow to the right to switch pages
const Sections = [
{
header: "Notications",
header: "Notifications",
items: [
{
id: "notifiyNewMessage",
Expand Down Expand Up @@ -46,13 +46,14 @@ const SettingsScreen: React.FC = () => {
<Text style={styles.headerText}>Settings</Text>
</View>
{Sections.map(({ header, items }) => (
<View style={styles.section} key={header}>
<View style={styles.section}>
<View style={styles.sectionHeader}>
<Text style={styles.sectionHeaderText}>{header}</Text>
</View>
<View style={styles.sectionContent}>
{items.map(({ id, title, type }) => (
<SettingsItem
key={id}
id={id}
title={title}
type={type}
Expand Down
Loading