From db3b634e6233b3ef8ba20d17d939aed60b7ce51f Mon Sep 17 00:00:00 2001 From: GyDi Date: Tue, 29 Mar 2022 01:39:54 +0800 Subject: [PATCH] fix: macOS transition flickers close #47 --- src/components/profile/profile-item.tsx | 6 ++++++ src/components/profile/profile-more.tsx | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/components/profile/profile-item.tsx b/src/components/profile/profile-item.tsx index 8e29d76..6d46f74 100644 --- a/src/components/profile/profile-item.tsx +++ b/src/components/profile/profile-item.tsx @@ -20,6 +20,7 @@ import { CmdType } from "../../services/types"; import { atomLoadingCache } from "../../services/states"; import { updateProfile, deleteProfile, viewProfile } from "../../services/cmds"; import parseTraffic from "../../utils/parse-traffic"; +import getSystem from "../../utils/get-system"; import ProfileEdit from "./profile-edit"; import FileEditor from "./file-editor"; import Notice from "../base/base-notice"; @@ -40,6 +41,8 @@ const round = keyframes` to { transform: rotate(360deg); } `; +const OS = getSystem(); + interface Props { selected: boolean; itemData: CmdType.ProfileItem; @@ -267,6 +270,9 @@ const ProfileItem = (props: Props) => { anchorPosition={position} anchorReference="anchorPosition" transitionDuration={225} + TransitionProps={ + OS === "macos" ? { style: { transitionDuration: "225ms" } } : {} + } onContextMenu={(e) => { setAnchorEl(null); e.preventDefault(); diff --git a/src/components/profile/profile-more.tsx b/src/components/profile/profile-more.tsx index 57a9c07..ed14028 100644 --- a/src/components/profile/profile-more.tsx +++ b/src/components/profile/profile-more.tsx @@ -13,6 +13,7 @@ import { } from "@mui/material"; import { CmdType } from "../../services/types"; import { viewProfile } from "../../services/cmds"; +import getSystem from "../../utils/get-system"; import enhance from "../../services/enhance"; import ProfileEdit from "./profile-edit"; import FileEditor from "./file-editor"; @@ -29,6 +30,8 @@ const Wrapper = styled(Box)(({ theme }) => ({ boxSizing: "border-box", })); +const OS = getSystem(); + interface Props { selected: boolean; itemData: CmdType.ProfileItem; @@ -219,6 +222,9 @@ const ProfileMore = (props: Props) => { anchorPosition={position} anchorReference="anchorPosition" transitionDuration={225} + TransitionProps={ + OS === "macos" ? { style: { transitionDuration: "225ms" } } : {} + } onContextMenu={(e) => { setAnchorEl(null); e.preventDefault();