Skip to content

Commit

Permalink
fix: android menu placement (#2345)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnylqm authored Jan 4, 2023
1 parent aa16bfa commit df68fe0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function LayoutHeaderDesktop() {
<HStack space={2} alignItems="center">
<NetworkAccountSelectorTriggerDesktop />
<Box>
<HomeMoreMenu placement="bottom right">
<HomeMoreMenu>
<IconButton
name="EllipsisVerticalOutline"
size="lg"
Expand Down
5 changes: 4 additions & 1 deletion packages/components/src/Layout/Header/LayoutHeaderMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ import { HStack, IconButton } from '@onekeyhq/components';
import { NetworkAccountSelectorTriggerMobile } from '@onekeyhq/kit/src/components/NetworkAccountSelector';
import WalletSelectorTrigger from '@onekeyhq/kit/src/components/WalletSelector/WalletSelectorTrigger/WalletSelectorTrigger';
import HomeMoreMenu from '@onekeyhq/kit/src/views/Overlay/HomeMoreMenu';
import platformEnv from '@onekeyhq/shared/src/platformEnv';

const headerLeft = () => <WalletSelectorTrigger />;
const headerRight = () => (
<HStack space={3} alignItems="center">
<NetworkAccountSelectorTriggerMobile />
<HomeMoreMenu placement="bottom right">
<HomeMoreMenu
offset={platformEnv.isNativeAndroid ? 25 : 0}
>
<IconButton
name="EllipsisVerticalOutline"
type="plain"
Expand Down
8 changes: 7 additions & 1 deletion packages/kit/src/views/Overlay/BaseMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,17 @@ interface IBaseMenu extends IMenu {
options: IMenuOptions;
}

const BaseMenu: FC<IBaseMenu> = ({ options, children, ...rest }) => {
const BaseMenu: FC<IBaseMenu> = ({
options,
children,
placement = 'bottom right',
...rest
}) => {
const intl = useIntl();
return (
<Menu
w={190}
placement={placement}
trigger={(triggerProps) =>
cloneElement(Children.only(children as ReactElement), triggerProps)
}
Expand Down
3 changes: 2 additions & 1 deletion packages/kit/src/views/Wallet/AccountInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
TabRoutes,
} from '@onekeyhq/kit/src/routes/types';
import type { SendRoutesParams } from '@onekeyhq/kit/src/views/Send/types';
import platformEnv from '@onekeyhq/shared/src/platformEnv';

import backgroundApiProxy from '../../../background/instance/backgroundApiProxy';
import { useNavigationActions } from '../../../hooks';
Expand Down Expand Up @@ -308,7 +309,7 @@ const AccountOption: FC<AccountOptionProps> = ({ isSmallView }) => {
</Box>

<Box flex={{ base: 1, sm: 0 }} mx={3} minW="56px" alignItems="center">
<AccountMoreMenu offset={30} placement="bottom right">
<AccountMoreMenu offset={platformEnv.isNativeAndroid ? 55 : 30}>
<IconButton
circle
size={isSmallView ? 'xl' : 'lg'}
Expand Down

0 comments on commit df68fe0

Please sign in to comment.