update(back-button-issue): added a circle style back button similar across all screens
This commit is contained in:
parent
358bb420a2
commit
045ed5fc49
|
|
@ -1,6 +1,7 @@
|
||||||
import React, { useCallback, useEffect, useMemo, useRef } from "react";
|
import React, { useCallback, useEffect, useMemo, useRef } from "react";
|
||||||
import {
|
import {
|
||||||
Platform,
|
Platform,
|
||||||
|
Pressable,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
Text,
|
Text,
|
||||||
|
|
@ -10,7 +11,7 @@ import {
|
||||||
import { SafeAreaView } from "react-native-safe-area-context";
|
import { SafeAreaView } from "react-native-safe-area-context";
|
||||||
import { router, useFocusEffect } from "expo-router";
|
import { router, useFocusEffect } from "expo-router";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import { moderateScale, verticalScale } from "react-native-size-matters";
|
import { moderateScale, scale, verticalScale } from "react-native-size-matters";
|
||||||
|
|
||||||
import { Colors } from "@/theme";
|
import { Colors } from "@/theme";
|
||||||
import { useAuthStore } from "@/store/auth.store";
|
import { useAuthStore } from "@/store/auth.store";
|
||||||
|
|
@ -152,14 +153,28 @@ export default function ModulesIndexScreen() {
|
||||||
<SafeAreaView style={styles.safeArea} edges={["top", "left", "right"]}>
|
<SafeAreaView style={styles.safeArea} edges={["top", "left", "right"]}>
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<View style={styles.header}>
|
<View style={styles.header}>
|
||||||
<TouchableOpacity
|
<Pressable
|
||||||
onPress={() => router.replace("/")}
|
|
||||||
style={styles.backButton}
|
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
accessibilityLabel="Go to home"
|
accessibilityLabel="Go back"
|
||||||
|
hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
|
||||||
|
onPress={() => {
|
||||||
|
if (router.canGoBack()) {
|
||||||
|
router.back();
|
||||||
|
} else {
|
||||||
|
router.replace("/");
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
style={({ pressed }) => [
|
||||||
|
styles.backButton,
|
||||||
|
pressed && styles.backButtonPressed,
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
<Ionicons name="chevron-back" size={24} color={Colors.textPrimary} />
|
<Ionicons
|
||||||
</TouchableOpacity>
|
name="chevron-back"
|
||||||
|
size={moderateScale(24)}
|
||||||
|
color={Colors.textPrimary}
|
||||||
|
/>
|
||||||
|
</Pressable>
|
||||||
<Text style={styles.headerTitle}>All Modules</Text>
|
<Text style={styles.headerTitle}>All Modules</Text>
|
||||||
<View style={styles.headerActions}>
|
<View style={styles.headerActions}>
|
||||||
{isPreviewAdmin ? (
|
{isPreviewAdmin ? (
|
||||||
|
|
@ -333,7 +348,15 @@ const styles = StyleSheet.create({
|
||||||
backgroundColor: "#FFFFFF",
|
backgroundColor: "#FFFFFF",
|
||||||
},
|
},
|
||||||
backButton: {
|
backButton: {
|
||||||
padding: 4,
|
width: scale(38),
|
||||||
|
height: scale(38),
|
||||||
|
borderRadius: scale(19),
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
backgroundColor: "#F1F5F9",
|
||||||
|
},
|
||||||
|
backButtonPressed: {
|
||||||
|
backgroundColor: "#E2E8F0",
|
||||||
},
|
},
|
||||||
headerTitle: {
|
headerTitle: {
|
||||||
fontSize: moderateScale(18),
|
fontSize: moderateScale(18),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue