Skip to content

Commit

Permalink
Drawerのタッチイベントを削除
Browse files Browse the repository at this point in the history
  • Loading branch information
Jun-Murakami committed Mar 4, 2024
1 parent fd40034 commit 3e3e467
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/components/ResponsiveDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export function ResponsiveDrawer({
const [drawerState, setDrawerState] = useState(false);
const [isMenuVisible, setIsMenuVisible] = useState(false);
const [isSwipe, setIsSwipe] = useState(false);
const [startTouch, setStartTouch] = useState<Touch | null>(null);

const darkMode = useAppStateStore((state) => state.darkMode);
const hideDoneItems = useAppStateStore((state) => state.hideDoneItems);
Expand Down Expand Up @@ -108,18 +107,6 @@ export function ResponsiveDrawer({
</>
);

const handleTouchStart = (event: React.TouchEvent) => {
setStartTouch(event.touches[0] as Touch | null);
};

const handleTouchEnd = (event: React.TouchEvent) => {
const endTouch = event.changedTouches[0];
// スクロールを検出する簡単な方法
if (startTouch && Math.abs(startTouch.pageY - endTouch.pageY) < 10) {
toggleDrawer(true);
}
};

return (
<>
{!currentTree && treesList.length === 0 && (
Expand All @@ -141,16 +128,15 @@ export function ResponsiveDrawer({
aria-label='open drawer'
edge='start'
onClick={toggleDrawer(true)}
onTouchStart={handleTouchStart}
onTouchEnd={handleTouchEnd}
onTouchStart={() => toggleDrawer(true)}
size='large'
sx={{
border: `1px solid ${theme.palette.divider}`,
display: { sm: 'none' },
position: 'fixed',
bottom: 15,
right: 30,
zIndex: 1000,
zIndex: 1200,
backgroundColor: theme.palette.background.default,
opacity: 1,
}}
Expand Down

0 comments on commit 3e3e467

Please sign in to comment.