From a666d09f4b8c5a0986a96538bb465e98694b2d3a Mon Sep 17 00:00:00 2001
From: Mewan Dimalsha <115539818+mewanDimalsha@users.noreply.github.com>
Date: Sun, 8 Sep 2024 17:56:28 +0530
Subject: [PATCH] initializing routes and developed settings page
---
app/(navbar)/settings.tsx | 31 +++++++++++++++++++++++++++++++
components/AppHeader.tsx | 25 +++++++++++++++----------
2 files changed, 46 insertions(+), 10 deletions(-)
create mode 100644 app/(navbar)/settings.tsx
diff --git a/app/(navbar)/settings.tsx b/app/(navbar)/settings.tsx
new file mode 100644
index 0000000..c473eff
--- /dev/null
+++ b/app/(navbar)/settings.tsx
@@ -0,0 +1,31 @@
+import React from "react";
+import { View, Text, Switch } from "react-native";
+import { List, Divider } from "react-native-paper";
+import AppHeader from "@/components/AppHeader";
+
+export default function Settings() {
+ const [isSwitchOn, setIsSwitchOn] = React.useState(false);
+
+ const onToggleSwitch = () => setIsSwitchOn(!isSwitchOn);
+
+ return (
+ <>
+
+
+
+ (
+
+ )}
+ />
+
+ } />
+
+
+
+
+
+ >
+ );
+}
diff --git a/components/AppHeader.tsx b/components/AppHeader.tsx
index b2e5a9f..4c7c63b 100644
--- a/components/AppHeader.tsx
+++ b/components/AppHeader.tsx
@@ -1,6 +1,7 @@
import { Appbar, Menu } from "react-native-paper";
import React, { useState, useRef } from "react";
import { View, findNodeHandle, UIManager } from "react-native";
+import { router } from "expo-router"; // Use expo-router for navigation
interface AppHeaderProps {
readonly title: string;
@@ -13,13 +14,16 @@ export default function AppHeader({ title }: AppHeaderProps) {
const openMenu = () => {
if (menuIconRef.current) {
- UIManager.measure(
- findNodeHandle(menuIconRef.current),
- (x, y, width, height, pageX, pageY) => {
- setMenuPosition({ x: pageX + 70, y: pageY + height + 10 });
- setMenuVisible(true);
- }
- );
+ const menuIconNode = findNodeHandle(menuIconRef.current);
+ if (menuIconNode) {
+ UIManager.measure(
+ menuIconNode,
+ (x, y, width, height, pageX, pageY) => {
+ setMenuPosition({ x: pageX + 70, y: pageY + height + 10 });
+ setMenuVisible(true);
+ }
+ );
+ }
}
};
@@ -29,7 +33,6 @@ export default function AppHeader({ title }: AppHeaderProps) {
- {/* {}} /> */}
{}} />
- {}} title="Account" />
+ {/* Navigate to Account */}
+ router.push("/(navbar)/account" )} title="Account" />
{}} title="Rank" />
- {}} title="Setting" />
+ {/* Navigate to Settings */}
+ router.push("/(navbar)/settings")} title="Setting" />
);