Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): stabilize thread composer and interactions #5986

Mergedjuliusmarmingemerged 47 commits intomain fromrefs/pull/5986/headmerged by juliusmarminge View on GitHub

Showing 37 changed files with 27 additions and 49 deletions (loading 33).

x
0 of 37 viewed, 37 left
26 additions and 1 deletionapps/mobile/src/components/ControlPill.tsxModified
View file
@@ -6,6 +6,7 @@
type ComponentProps,
type ReactElement,
type ReactNode,
+ useRef,
} from "react";
import { Platform, Pressable, useColorScheme, View } from "react-native";
import { useThemeColor } from "../lib/useThemeColor";
@@ -21,10 +22,31 @@
readonly label?: string;
readonly accessibilityLabel?: string;
readonly onPress?: () => void;
+ readonly activateOnPressIn?: boolean;
readonly variant?: "circle" | "pill" | "primary" | "danger";
readonly disabled?: boolean;
+ readonly className?: string;
}) {
const variant = props.variant ?? "circle";
+ const activatedOnPressInRef = useRef(false);
+​
+ const handlePressIn = () => {
+ activatedOnPressInRef.current = true;
+ props.onPress?.();
+ };
+ const handlePressOut = () => {
+ // Pressability invokes onPressOut immediately before onPress on release.
+ // Defer the reset so onPress can identify the same physical gesture.
+ setTimeout(() => {
+ activatedOnPressInRef.current = false;