I'm trying to see if I can switch between two values for my navigator: This works:
function getHeaderTitle(route) {
const routeName = route.state
? route.state.routes[route.state.index].name
: route.params?.screen || 'The Market';
switch (routeName) {
case 'Stands':
return 'The Market';
case 'Map':
return 'How to find the Market';
case 'Favorites':
return 'Favorites';
case 'Info':
return 'Info about the Market';
}
return routeName;
}
where I need I exec:
getHeaderTitle(route) // works
and I would like to add a value (color) to avoid to create a second one just for it:
function getHeaderTitle(route) {
const routeName = route.state
? route.state.routes[route.state.index].name
: route.params?.screen || 'The Market';
let color;
switch ((routeName, color)) {
case 'Stands':
return 'The Market', (color = Colors.MarketColor);
case 'Map':
return 'How to find the Market', (color = Colors.MapColor);
case 'Favorites':
return 'Favorites', (color = Colors.FavColor);
case 'Info':
return 'Info about the Market', (color = Colors.InfoColor);
}
return routeName, color;
}
But it doesn't work. Any idea? thanks