diff options
author | dan <dan.abramov@gmail.com> | 2025-01-17 01:17:13 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-17 01:17:13 +0000 |
commit | 9e3f2f43745eed9c71cb985e48135b7363d91aa9 (patch) | |
tree | 4c6a8579598131182ecf28907b2f5ef82fb89de4 /src/components/interstitials/Trending.tsx | |
parent | 39ed104935254fd30709d319a341d5c4b2bec0d2 (diff) | |
download | voidsky-9e3f2f43745eed9c71cb985e48135b7363d91aa9.tar.zst |
Prevent Drawer gesture conflicting with Suggestions scroll (#7468)
* Extract BlockDrawerGeesture * Block drawer when scrolling interstitials
Diffstat (limited to 'src/components/interstitials/Trending.tsx')
-rw-r--r-- | src/components/interstitials/Trending.tsx | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/components/interstitials/Trending.tsx b/src/components/interstitials/Trending.tsx index a9d7778a9..7412c6f0a 100644 --- a/src/components/interstitials/Trending.tsx +++ b/src/components/interstitials/Trending.tsx @@ -1,7 +1,5 @@ -import React, {useContext} from 'react' +import React from 'react' import {ScrollView, View} from 'react-native' -import {DrawerGestureContext} from 'react-native-drawer-layout' -import {Gesture, GestureDetector} from 'react-native-gesture-handler' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' @@ -13,6 +11,7 @@ import { import {useTrendingTopics} from '#/state/queries/trending/useTrendingTopics' import {useTrendingConfig} from '#/state/trending-config' import {LoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder' +import {BlockDrawerGesture} from '#/view/shell/BlockDrawerGesture' 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' @@ -41,13 +40,9 @@ export function Inner() { setTrendingDisabled(true) }, [setTrendingDisabled]) - const drawerGesture = useContext(DrawerGestureContext) ?? Gesture.Native() // noop for web - const trendingScrollGesture = - Gesture.Native().blocksExternalGesture(drawerGesture) - return error || noTopics ? null : ( <View style={[t.atoms.border_contrast_low, a.border_t]}> - <GestureDetector gesture={trendingScrollGesture}> + <BlockDrawerGesture> <ScrollView horizontal showsHorizontalScrollIndicator={false} @@ -127,7 +122,7 @@ export function Inner() { )} </View> </ScrollView> - </GestureDetector> + </BlockDrawerGesture> <Prompt.Basic control={trendingPrompt} |