remove heart icon

This commit is contained in:
ShivaniKhaire 2026-10-23 13:00:22 +05:30
parent e7854ceb93
commit c1dc542975
1 changed files with 10 additions and 24 deletions

View File

@ -1,4 +1,4 @@
import React, { type PropsWithChildren, useState } from "react";
import React, { type PropsWithChildren } from "react";
import { Pressable, StyleSheet, View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { Ionicons } from "@expo/vector-icons";
@ -12,10 +12,10 @@ interface DetailPageShellProps extends PropsWithChildren {
title: string;
subtitle?: string;
onBack?: () => void;
rightAction?: React.ReactNode;
}
export function DetailPageShell({ children, onBack }: DetailPageShellProps) {
const [isFavorite, setIsFavorite] = useState(false);
export function DetailPageShell({ children, onBack, rightAction }: DetailPageShellProps) {
const { moduleCode } = useLocalSearchParams<{ moduleCode?: string }>();
const currentModuleCode = typeof moduleCode === "string" ? moduleCode : "";
const moduleDisplay = useModuleDisplayName(currentModuleCode);
@ -34,21 +34,12 @@ export function DetailPageShell({ children, onBack }: DetailPageShellProps) {
</Pressable>
) : null;
const favoriteAction = (
<Pressable
accessibilityRole="button"
accessibilityLabel={isFavorite ? "Remove from favorites" : "Add to favorites"}
hitSlop={10}
onPress={() => setIsFavorite((value) => !value)}
style={({ pressed }) => [styles.iconButton, pressed && styles.pressed]}
>
<Ionicons
name={isFavorite ? "heart" : "heart-outline"}
size={22}
color={isFavorite ? Colors.error : Colors.textPrimary}
/>
</Pressable>
);
const headerActions = searchAction || rightAction ? (
<View style={styles.actions}>
{searchAction}
{rightAction}
</View>
) : undefined;
return (
<SafeAreaView style={styles.screen} edges={["top", "left", "right"]}>
@ -64,12 +55,7 @@ export function DetailPageShell({ children, onBack }: DetailPageShellProps) {
currentModuleCode ? `Open ${moduleDisplay.name} home` : moduleDisplay.name
}
fallbackRoute={moduleDisplay.homeRoute}
right={
<View style={styles.actions}>
{searchAction}
{favoriteAction}
</View>
}
right={headerActions}
/>
<View style={styles.body}>{children}</View>
</SafeAreaView>