Selaa lähdekoodia

fix: enable emoji input on mobile via dragConfig cancel

- Use react-grid-layout v2 dragConfig.cancel API to prevent .no-drag
  elements from triggering grid item dragging
- Add no-drag class to emoji input/button wrapper div
- This tells react-draggable to ignore touch events on those elements

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
rriecc 9 kuukautta sitten
vanhempi
sitoutus
63713115ac
3 muutettua tiedostoa jossa 3 lisäystä ja 5 poistoa
  1. 1 5
      components/animated-emoji.tsx
  2. 1 0
      components/home-client.tsx
  3. 1 0
      components/home.tsx

+ 1 - 5
components/animated-emoji.tsx

@@ -24,11 +24,7 @@ const AnimatedEmoji = () => {
       ) : (
         <Image alt="Animated Emoji" height={150} src={emoji.url} width={150} />
       )}
-      <div
-        className="w-full space-y-3 flex flex-col items-center justify-center"
-        onMouseDown={(e) => e.stopPropagation()}
-        onTouchStart={(e) => e.stopPropagation()}
-      >
+      <div className="no-drag w-full space-y-3 flex flex-col items-center justify-center">
         <Input
           className="w-[95%]"
           classNames={{

+ 1 - 0
components/home-client.tsx

@@ -132,6 +132,7 @@ export default function HomeClient({
           settled ? "layout-settled" : "layout-initializing",
         )}
         cols={{ lg: 4, md: 4, sm: 2, xs: 2, xxs: 2 }}
+        dragConfig={{ cancel: ".no-drag" }}
         layouts={layouts[tabSelected]}
         margin={[15, 15]}
         width={width}

+ 1 - 0
components/home.tsx

@@ -89,6 +89,7 @@ const Home = ({
         breakpoints={{ lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 }}
         className="layout w-full h-full"
         cols={{ lg: 4, md: 4, sm: 2, xs: 2, xxs: 2 }}
+        dragConfig={{ cancel: ".no-drag" }}
         layouts={layouts[tabSelected]}
         margin={[15, 15]}
         width={width}