Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): threads open with less waiting, and the Threads tab remembers drafts #24750

Mergedjuliusmarmingemerged 2 commits intomain fromrefs/pull/24750/headmerged by juliusmarminge View on GitHub

Showing 9 changed files with 101 additions and 41 deletions (loading 6).

x
0 of 9 viewed, 9 left
77 additions and 40 deletionsapps/mobile/src/features/home/thread-swipe-actions.tsxModified
View file
@@ -121,6 +121,9 @@
​
/** Keep the scroll gate in context so scroll start cannot re-render every row and its subscriptions. */
const SwipeableScrollGateContext = createContext(true);
+// Swipeable rebuilds its native pan gesture whenever its config changes identity, so the props
+// that feed it stay stable across row re-renders such as selection.
+const FAIL_OFFSET_Y: [number, number] = [-10, 10];
​
export function SwipeableScrollGateProvider(props: {
readonly enabled: boolean;
@@ -402,11 +405,77 @@
[content],
- const handleWillOpen = () => {
- if (!props.dormant && !dismissalRef.current && swipeableRef.current) {
- props.onSwipeableWillOpen?.(swipeableRef.current);
+ const { dormant, onSwipeableWillOpen, backgroundColor, containerStyle } = props;
+ const handleWillOpen = useCallback(() => {
+ if (!dormant && !dismissalRef.current && swipeableRef.current) {
+ onSwipeableWillOpen?.(swipeableRef.current);
+ }, [dormant, onSwipeableWillOpen]);
+ const handleSwipeableClose = useCallback(() => {
+ if (swipeableRef.current) onSwipeableClose?.(swipeableRef.current);
+ }, [onSwipeableClose]);
+ const compactActions = props.compactActions === true;
+ const { secondaryAction, threadTitle } = props;
+ // Swipeable calls this on every render; returning the previous element while nothing it shows