FIX: Buttons are in wrong position when using RTL language #6758
This commit is contained in:
GLaDOS 2024-07-10 13:26:59 +00:00 committed by GitHub
commit aa712bd0b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,6 @@
import React, { useCallback, useMemo } from 'react';
import { NativeStackNavigationOptions } from '@react-navigation/native-stack';
import { I18nManager, View } from 'react-native';
import { View } from 'react-native';
import { isDesktop } from '../blue_modules/environment';
import HeaderRightButton from '../components/HeaderRightButton';
import navigationStyle, { CloseButtonPosition } from '../components/navigationStyle';
@ -78,27 +78,31 @@ const DetailViewStackScreensStack = () => {
navigation.navigate('AddWalletRoot');
}, [navigation]);
const useWalletListScreenOptions = useMemo<NativeStackNavigationOptions>(() => {
const RightBarButtons = (
const RightBarButtons = useMemo(
() => (
<>
<PlusIcon accessibilityRole="button" accessibilityLabel={loc.wallets.add_title} onPress={navigateToAddWallet} />
<View style={styles.width24} />
<SettingsButton />
</>
);
),
[navigateToAddWallet],
);
const useWalletListScreenOptions = useMemo<NativeStackNavigationOptions>(() => {
return {
title: loc.wallets.wallets,
navigationBarColor: theme.colors.navigationBarColor,
headerShown: !isDesktop,
headerLargeTitle: true,
headerShadowVisible: false,
headerLargeTitleShadowVisible: false,
headerStyle: {
backgroundColor: theme.colors.customHeader,
},
headerRight: I18nManager.isRTL ? undefined : () => RightBarButtons,
headerLeft: I18nManager.isRTL ? () => RightBarButtons : undefined,
headerRight: () => RightBarButtons,
};
}, [navigateToAddWallet, theme.colors.customHeader, theme.colors.navigationBarColor]);
}, [RightBarButtons, theme.colors.customHeader, theme.colors.navigationBarColor]);
const walletListScreenOptions = useWalletListScreenOptions;
return (