back arrow calls dedicated funtion.
This commit is contained in:
parent
a22373f0c1
commit
c8fba938d5
|
|
@ -2,13 +2,19 @@ import { StyleSheet, Text, View} from 'react-native';
|
||||||
import { AntDesign, Ionicons } from '@expo/vector-icons';
|
import { AntDesign, Ionicons } from '@expo/vector-icons';
|
||||||
import { Link } from "react-router-native";
|
import { Link } from "react-router-native";
|
||||||
|
|
||||||
export default function TitleBar({ title='', theme={} , showBack="", setShowBack, setTitle}:any){
|
export default function TitleBar({ title='', theme={} , showBack="", setShowBack, setTitle }:any){
|
||||||
const st = style(theme);
|
const st = style(theme);
|
||||||
|
|
||||||
|
const handleBack = () =>{
|
||||||
|
setTitle(showBack)
|
||||||
|
setShowBack("")
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={style(theme).container}>
|
<View style={style(theme).container}>
|
||||||
{showBack ? <Link onPress={()=>{setTitle(showBack);setShowBack("")}} to={`/${showBack}`}><Text style={st.back}><Ionicons name="chevron-back" size={16} />{showBack}</Text></Link> : null}
|
{showBack ? <Link onPress={handleBack} to={`/${showBack}`}><Text style={st.back}><Ionicons name="chevron-back" size={16} />{showBack}</Text></Link> : null}
|
||||||
<Text style={st.title}>{title}</Text>
|
<Text style={st.title}>{title}</Text>
|
||||||
{showBack ? <Link><Text style={{...st.back, ...st.hidden}}><Ionicons name="chevron-back" size={16} />{showBack}</Text></Link> : null}
|
{showBack ? <View><Text style={{...st.back, ...st.hidden}}><Ionicons name="chevron-back" size={16} />{showBack}</Text></View> : null}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue