From 02dbcc134ef9f9870c4f6eab2da93773b8310d67 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 10 Jan 2025 00:32:08 +0000 Subject: Fix trending swipe gesture (#7417) --- src/components/interstitials/Trending.tsx | 164 ++++++++++++++++-------------- 1 file changed, 87 insertions(+), 77 deletions(-) (limited to 'src/components/interstitials/Trending.tsx') diff --git a/src/components/interstitials/Trending.tsx b/src/components/interstitials/Trending.tsx index 9a5feb2b6..3e0308e43 100644 --- a/src/components/interstitials/Trending.tsx +++ b/src/components/interstitials/Trending.tsx @@ -1,6 +1,6 @@ -import React from 'react' -import {View} from 'react-native' -import {ScrollView} from 'react-native-gesture-handler' +import React, {useContext} from 'react' +import {ScrollView, View} from 'react-native' +import {GestureDetector} from 'react-native-gesture-handler' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' @@ -12,6 +12,7 @@ import { import {useTrendingTopics} from '#/state/queries/trending/useTrendingTopics' import {useTrendingConfig} from '#/state/trending-config' import {LoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder' +import {TrendingGestureContext} from '#/view/shell/TrendingGestureContext' import {atoms as a, useGutters, useTheme} from '#/alf' import {Button, ButtonIcon} from '#/components/Button' import {TimesLarge_Stroke2_Corner0_Rounded as X} from '#/components/icons/Times' @@ -40,83 +41,92 @@ export function Inner() { setTrendingDisabled(true) }, [setTrendingDisabled]) + // This is coordinated to take precedence over the drawer pan gesture. + const trendingScrollGesture = useContext(TrendingGestureContext) + return error || noTopics ? null : ( - - - - - - {isLoading ? ( - - - - - - - - {' '} - + + + + + - ) : !trending?.topics ? null : ( - <> - {trending.topics.map(topic => ( - { - logEvent('trendingTopic:click', {context: 'interstitial'}) - }}> - - - {topic.topic} - - - - ))} - - - )} - - + {isLoading ? ( + + + + + + + + {' '} + + + ) : !trending?.topics ? null : ( + <> + {trending.topics.map(topic => ( + { + logEvent('trendingTopic:click', {context: 'interstitial'}) + }}> + + + {topic.topic} + + + + ))} + + + )} + + +