diff --git a/src/components/interstitials/Trending.tsx b/src/components/interstitials/Trending.tsx index 9a5feb2b66..3e0308e43c 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} + + + + ))} + + + )} + + + Gesture.Native()) return ( <> @@ -101,6 +104,10 @@ function ShellInner() { renderDrawerContent={renderDrawerContent} drawerStyle={{width: Math.min(400, winDim.width * 0.8)}} configureGestureHandler={handler => { + handler = handler.requireExternalGestureToFail( + trendingScrollGesture, + ) + if (swipeEnabled) { if (isDrawerOpen) { return handler.activeOffsetX([-1, 1]) @@ -138,7 +145,9 @@ function ShellInner() { dim: 'rgba(10, 13, 16, 0.8)', }), }}> - + + +