Sfoglia il codice sorgente

fix: mobile emoji input and theme switch performance

- Move touch/mouse stopPropagation to wrapper div so it reliably
  intercepts events before react-grid-layout's drag handler
- Scope grid item transitions to transform/width/height only,
  preventing background/border from animating on theme switch

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
rriecc 9 mesi fa
parent
commit
90065558cf
2 ha cambiato i file con 6 aggiunte e 14 eliminazioni
  1. 5 13
      components/animated-emoji.tsx
  2. 1 1
      styles/globals.css

+ 5 - 13
components/animated-emoji.tsx

@@ -24,7 +24,11 @@ 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">
+      <div
+        className="w-full space-y-3 flex flex-col items-center justify-center"
+        onMouseDown={(e) => e.stopPropagation()}
+        onTouchStart={(e) => e.stopPropagation()}
+      >
         <Input
           className="w-[95%]"
           classNames={{
@@ -34,12 +38,6 @@ const AnimatedEmoji = () => {
           label="Enter text, get emoji!"
           radius="lg"
           variant="underlined"
-          onMouseDown={(e) => {
-            e.stopPropagation();
-          }}
-          onTouchStart={(e) => {
-            e.stopPropagation();
-          }}
           onValueChange={(value) => {
             setPrompt(value);
           }}
@@ -48,12 +46,6 @@ const AnimatedEmoji = () => {
           className="w-full border-midnight dark:border-knight"
           radius="full"
           variant="bordered"
-          onMouseDown={(e) => {
-            e.stopPropagation();
-          }}
-          onTouchStart={(e) => {
-            e.stopPropagation();
-          }}
           onPress={async () => {
             setLoading(true);
             const response = await fetch("/api/emoji", {

+ 1 - 1
styles/globals.css

@@ -36,7 +36,7 @@
 }
 
 .react-grid-item {
-  transition-duration: 400ms;
+  transition: transform 400ms ease, width 400ms ease, height 400ms ease;
 }
 
 /* Disable grid item transitions during initial layout to prevent visible repositioning */