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

Change the buy tab label to "Deposit" for GB IPs #5200

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- added: Add disableSurveyModal option
- changed: Disable Home scene swap and FIO cards if configured
- changed: Allow some chains to be disabled in env.json
- changed: "Buy" tab shows "Deposit" for UK users
- fixed: FIO OBT data not showing in received transaction memos

## 4.11.0
Expand Down
16 changes: 15 additions & 1 deletion src/components/themed/MenuTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context'
import Ionicon from 'react-native-vector-icons/Ionicons'
import SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons'

import { getCountryCodeByIp } from '../../actions/AccountReferralActions'
import { writeDefaultScreen } from '../../actions/DeviceSettingsActions'
import { Fontello } from '../../assets/vector/index'
import { ENV } from '../../env'
import { useAsyncEffect } from '../../hooks/useAsyncEffect'
import { useHandler } from '../../hooks/useHandler'
import { LocaleStringKey } from '../../locales/en_US'
import { lstrings } from '../../locales/strings'
Expand Down Expand Up @@ -44,6 +46,7 @@ const title: { readonly [key: string]: string } = {
homeTab: lstrings.title_home,
walletsTab: lstrings.title_assets,
buyTab: lstrings.title_buy,
buyTabAlt: lstrings.loan_fragment_deposit,
sellTab: lstrings.title_sell,
swapTab: lstrings.title_exchange,
extraTab: lstrings[extraTabString],
Expand Down Expand Up @@ -187,6 +190,17 @@ const Tab = ({
const theme = useTheme()
const insets = useSafeAreaInsets()
const color = isActive ? theme.tabBarIconHighlighted : theme.tabBarIcon
const [countryCode, setCountryCode] = React.useState<string | undefined>()

// Set countryCode once
useAsyncEffect(
async () => {
const countryCode = await getCountryCodeByIp().catch(() => '')
setCountryCode(countryCode)
},
[],
'countryCode'
)

const icon: { readonly [key: string]: JSX.Element } = {
homeTab: <SimpleLineIcons name="home" size={theme.rem(1.25)} color={color} />,
Expand Down Expand Up @@ -227,7 +241,7 @@ const Tab = ({
<TabContainer accessible={false} insetBottom={insets.bottom} key={route.key} onPress={handleOnPress}>
{icon[route.name]}
<Label accessible numberOfLines={1} adjustsFontSizeToFit minimumFontScale={0.65} isActive={isActive} openRatio={footerOpenRatio}>
{title[route.name]}
{route.name === 'buyTab' && countryCode === 'GB' ? title.buyTabAlt : title[route.name]}
</Label>
</TabContainer>
)
Expand Down
Loading