Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix icon and text color in header #1770

Merged
merged 5 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/components/RestaurantSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ const styles = StyleSheet.create({
borderRadius: 4,
paddingVertical: 8,
paddingHorizontal: 12,
paddingRight: 4,
flexDirection: 'row',
alignItems: 'center',
gap: 8,
},
text: {
flex: 1,
},
});

const IconPin = ({ color }) => (
Expand Down Expand Up @@ -74,7 +78,11 @@ function RestaurantSearch(props) {
}}>
<View style={[styles.input, { borderColor }]}>
<IconPin color={fill} />
<Text fontSize={'md'} numberOfLines={1}>
<Text
style={styles.text}
fontSize={'md'}
numberOfLines={1}
ellipsizeMode="trail">
{props.defaultValue?.streetAddress}
</Text>
</View>
Expand Down
28 changes: 20 additions & 8 deletions src/navigation/navigators/CheckoutNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
TransitionPresets,
createStackNavigator,
} from '@react-navigation/stack';
import { Icon, Text } from 'native-base';
import { Icon, Text, useColorModeValue } from 'native-base';
import React from 'react';
import { TouchableOpacity } from 'react-native';
import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
Expand All @@ -22,6 +22,18 @@ import AskAddress from '../home/AskAddress';
import { stackNavigatorScreenOptions } from '../styles';
import AccountNavigator from './AccountNavigator';

const MyOrderButton = ({ navigation }) => {
const color = useColorModeValue('black', 'white');

return (
<TouchableOpacity
style={{ paddingHorizontal: 10 }}
onPress={() => navigation()}>
<Text style={{ color }}>{i18n.t('MY_ORDERS')}</Text>
</TouchableOpacity>
);
};

function getNestedOptions(navigation, route) {
const routeName = getFocusedRouteNameFromRoute(route) ?? 'Feed';

Expand All @@ -36,13 +48,13 @@ function getNestedOptions(navigation, route) {
headerRight: () => {
if (selectIsAuthenticated(store.getState())) {
return (
<TouchableOpacity
style={{ paddingHorizontal: 10 }}
onPress={() => {
navigation.navigate('AccountOrders');
}}>
<Text style={{ color: 'white' }}>{i18n.t('MY_ORDERS')}</Text>
</TouchableOpacity>
<>
<MyOrderButton
navigation={() => {
navigation.navigate('AccountOrders');
}}
/>
</>
);
}
},
Expand Down
29 changes: 16 additions & 13 deletions src/navigation/navigators/CourierNavigator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { createStackNavigator } from '@react-navigation/stack';
import { Icon } from 'native-base';
import { Icon, useColorModeValue } from 'native-base';
import React from 'react';
import { StyleSheet, TouchableOpacity, View } from 'react-native';
import FontAwesome from 'react-native-vector-icons/FontAwesome';
Expand Down Expand Up @@ -58,15 +58,28 @@ const styles = StyleSheet.create({
});

const ButtonWithIcon = ({ name, onPress }) => {
const color = useColorModeValue('black', 'white');
return (
<TouchableOpacity onPress={onPress} style={styles.button}>
<Icon as={Ionicons} name={name} style={{ color: 'white' }} />
<Icon as={Ionicons} name={name} style={{ color }} />
</TouchableOpacity>
);
};

const MainStack = createStackNavigator();

const headerButtons = nav => (
<View style={styles.buttonBar}>
<ButtonWithIcon
name="settings"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd call it icon

onPress={() => nav.navigate('CourierSettings')}
/>
<TouchableOpacity style={styles.button}>
<TrackingIcon />
</TouchableOpacity>
</View>
);

const MainNavigator = () => (
<MainStack.Navigator screenOptions={stackNavigatorScreenOptions}>
<MainStack.Screen
Expand All @@ -75,17 +88,7 @@ const MainNavigator = () => (
options={({ navigation }) => ({
title: i18n.t('COURIER'),
headerLeft: headerLeft(navigation, 'menuBtnCourier'),
headerRight: () => (
<View style={styles.buttonBar}>
<ButtonWithIcon
name="settings"
onPress={() => navigation.navigate('CourierSettings')}
/>
<TouchableOpacity style={styles.button}>
<TrackingIcon />
</TouchableOpacity>
</View>
),
headerRight: () => headerButtons(navigation),
})}
/>
<MainStack.Screen
Expand Down
Loading