From b508b290c6716acaa49fa459d04b11fdc76ec696 Mon Sep 17 00:00:00 2001 From: moist-webDev Date: Tue, 6 Jun 2023 00:16:28 -0400 Subject: [PATCH] added the ability to go back if in nested page --- components/TitleBar.tsx | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/components/TitleBar.tsx b/components/TitleBar.tsx index a5d9ab4..d936cf8 100644 --- a/components/TitleBar.tsx +++ b/components/TitleBar.tsx @@ -1,9 +1,14 @@ import { StyleSheet, Text, View} from 'react-native'; +import { AntDesign, Ionicons } from '@expo/vector-icons'; +import { Link } from "react-router-native"; -export default function TitleBar({ title='', theme={} }:any){ +export default function TitleBar({ title='', theme={} , showBack="", setShowBack, setTitle}:any){ + const st = style(theme); return ( - {title} + {showBack ? {setTitle(showBack);setShowBack("")}} to={`/${showBack}`}>{showBack} : null} + {title} + {showBack ? {showBack} : null} ) } @@ -22,11 +27,29 @@ const style = (theme:any) => { shadowOpacity: 0.2, shadowRadius: 3, elevation: 20, + flexDirection: 'row', }, - text: { + title: { color: theme.text, fontWeight: 'bold', fontSize: 20, + textAlign: 'center', + flex: 1, + textTransform: 'capitalize', + }, + back: { + marginTop: 6, + color: theme.text, + fontSize: 16, + fontWeight: '400', + textAlign: 'left', + marginLeft:0, + marginRight:0, + padding: 0, + flex: 1, + }, + hidden: { + opacity: 0, }, }); } \ No newline at end of file