From 9014d5a0d3851711f18d81e92e3bc388d71857cd Mon Sep 17 00:00:00 2001 From: Oleksii Bulenok Date: Mon, 13 Jul 2026 14:02:50 +0200 Subject: [PATCH] Fix pills are not scrollable horizontally in Suggested Accounts --- src/components/InterestTabs.tsx | 85 ++++++++++--------- .../modules/ExploreSuggestedAccounts.tsx | 39 ++++----- 2 files changed, 63 insertions(+), 61 deletions(-) diff --git a/src/components/InterestTabs.tsx b/src/components/InterestTabs.tsx index b015572f47..966cc98614 100644 --- a/src/components/InterestTabs.tsx +++ b/src/components/InterestTabs.tsx @@ -10,6 +10,7 @@ import {useLingui} from '@lingui/react' import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' import {DraggableScrollView} from '#/view/com/pager/DraggableScrollView' +import {BlockDrawerGesture} from '#/view/shell/BlockDrawerGesture' import {atoms as a, tokens, useTheme, web} from '#/alf' import {transparentifyColor} from '#/alf/util/colorGeneration' import {Button, ButtonIcon} from '#/components/Button' @@ -199,46 +200,50 @@ export function InterestTabs({ }, []) return ( - // `collapsable={false}` keeps this as a real host view on the new arch so - // that a wrapping GestureDetector (e.g. BlockDrawerGesture) can attach to - // it - otherwise this layout-only view gets flattened away. - - !!o).length === interests.length - ? tabOffsets.map(o => o.x - tokens.space.xl) - : undefined - } - onLayout={evt => setTotalWidth(evt.nativeEvent.layout.width)} - onContentSizeChange={width => setContentWidth(width)} - onScroll={evt => { - const newScrollX = evt.nativeEvent.contentOffset.x - setScrollX(newScrollX) - }} - scrollEventThrottle={16}> - {interests.map((interest, i) => { - const active = interest === selectedInterest && !disabled - return ( - - ) - })} - + + {/* + * BlockDrawerGesture must wrap the ScrollView directly - Gesture.Native() + * only works when attached to the natively scrollable view. On the new + * arch (Android), attaching it to a wrapper view breaks scrolling. + */} + + !!o).length === interests.length + ? tabOffsets.map(o => o.x - tokens.space.xl) + : undefined + } + onLayout={evt => setTotalWidth(evt.nativeEvent.layout.width)} + onContentSizeChange={width => setContentWidth(width)} + onScroll={evt => { + const newScrollX = evt.nativeEvent.contentOffset.x + setScrollX(newScrollX) + }} + scrollEventThrottle={16}> + {interests.map((interest, i) => { + const active = interest === selectedInterest && !disabled + return ( + + ) + })} + + {IS_WEB && canScrollLeft && ( - { - ax.metric('explore:suggestedAccounts:tabPressed', {tab: tab}) - onSelectInterest(tab === 'all' ? null : tab) - }} - interestsDisplayNames={ - hideDefaultTab - ? interestsDisplayNames - : { - all: defaultTabLabel || _(msg`For You`), - ...interestsDisplayNames, - } - } - /> - + { + ax.metric('explore:suggestedAccounts:tabPressed', {tab: tab}) + onSelectInterest(tab === 'all' ? null : tab) + }} + interestsDisplayNames={ + hideDefaultTab + ? interestsDisplayNames + : { + all: defaultTabLabel || _(msg`For You`), + ...interestsDisplayNames, + } + } + /> ) }