Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 52 additions & 45 deletions apps/mobile/src/features/home/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
type NativeSyntheticEvent,
} from "react-native";
import { ScrollViewMarker } from "react-native-screens";
import { GestureDetector, useNativeGesture } from "react-native-gesture-handler";
import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";
import { useSafeAreaInsets } from "react-native-safe-area-context";

Expand Down Expand Up @@ -280,6 +281,8 @@ export function HomeScreen(props: HomeScreenProps) {
const fullSwipeWidth = primaryColumn && columnMetrics ? columnMetrics.width - 20 : undefined;
const queuedThreadKeys = useQueuedThreadKeys();
const openSwipeableRef = useRef<SwipeableMethods | null>(null);
// Let trackpad scrolling coexist with each row's horizontal swipe gesture.
const homeScrollGesture = useNativeGesture();
const insets = useSafeAreaInsets();
const { fabClearance } = useAndroidControlSizing();
const screenMetrics = useNativeLayoutMetrics();
Expand Down Expand Up @@ -807,6 +810,7 @@ export function HomeScreen(props: HomeScreenProps) {
onMoveThread={handleMoveThread}
onSwipeableClose={handleSwipeableClose}
onSwipeableWillOpen={handleSwipeableWillOpen}
simultaneousSwipeGesture={homeScrollGesture}
activationKey={item.key}
/>
);
Expand All @@ -826,6 +830,7 @@ export function HomeScreen(props: HomeScreenProps) {
handleSwipeableWillOpen,
handleUnsettleThread,
handleSetThreadAutoSettle,
homeScrollGesture,
autoSettleOptOutEnvironmentIds,
pinningEnvironmentIds,
autoSettleOptOutEnvironmentIds,
Expand Down Expand Up @@ -1012,51 +1017,53 @@ export function HomeScreen(props: HomeScreenProps) {
rebuilds and `itemsAreEqual` keeps a minute tick (or an unrelated
shell update) from re-rendering untouched rows. */}
<SwipeableScrollGateProvider enabled={swipeEnabled} activation={swipeRowActivation}>
<LegendList
ref={listRef}
onLoad={() => activateVisibleRows(threadListV2Items)}
onTouchStart={(event) => trackListTouches(event, true)}
onTouchEnd={(event) => trackListTouches(event, false)}
onTouchCancel={(event) => trackListTouches(event, false)}
renderScrollComponent={Platform.OS === "ios" ? renderHomeScrollView : undefined}
data={threadListV2Items}
renderItem={renderV2Item}
keyExtractor={v2KeyExtractor}
getItemType={(item) => item.type}
itemsAreEqual={threadListV2ListItemsAreEqual}
estimatedItemSize={ESTIMATED_THREAD_LIST_V2_ROW_HEIGHT}
drawDistance={THREAD_LIST_V2_DRAW_DISTANCE}
recycleItems
extraData={v2ExtraData}
ListHeaderComponent={v2ListHeader}
ListFooterComponent={
settledShelfExpanded && threadListV2Layout.hiddenSettledCount > 0 ? (
<ThreadListV2ShowMoreRow
hiddenCount={threadListV2Layout.hiddenSettledCount}
onPress={showMoreSettled}
/>
) : null
}
ListEmptyComponent={v2ListEmpty}
style={{ flex: 1 }}
automaticallyAdjustsScrollIndicatorInsets={Platform.OS === "ios"}
contentInsetAdjustmentBehavior="never"
contentInset={Platform.OS === "ios" ? { top: insets.top } : undefined}
contentInsetStartAdjustment={Platform.OS === "ios" ? insets.top : 0}
showsVerticalScrollIndicator={false}
keyboardDismissMode="on-drag"
keyboardShouldPersistTaps="handled"
{...scrollGateHandlers}
scrollEventThrottle={16}
contentContainerStyle={{
paddingLeft: (contentSideInsets?.left ?? 0) + (primaryColumn ? 8 : 0),
paddingRight: (contentSideInsets?.right ?? 0) + (primaryColumn ? 8 : 0),
paddingBottom:
Platform.OS === "ios"
? iosBottomClearance
: Math.max(insets.bottom, 16) + (Platform.OS === "android" ? fabClearance : 88),
}}
/>
<GestureDetector gesture={homeScrollGesture}>
<LegendList
ref={listRef}
onLoad={() => activateVisibleRows(threadListV2Items)}
onTouchStart={(event) => trackListTouches(event, true)}
onTouchEnd={(event) => trackListTouches(event, false)}
onTouchCancel={(event) => trackListTouches(event, false)}
renderScrollComponent={Platform.OS === "ios" ? renderHomeScrollView : undefined}
data={threadListV2Items}
renderItem={renderV2Item}
keyExtractor={v2KeyExtractor}
getItemType={(item) => item.type}
itemsAreEqual={threadListV2ListItemsAreEqual}
estimatedItemSize={ESTIMATED_THREAD_LIST_V2_ROW_HEIGHT}
drawDistance={THREAD_LIST_V2_DRAW_DISTANCE}
recycleItems
extraData={v2ExtraData}
ListHeaderComponent={v2ListHeader}
ListFooterComponent={
settledShelfExpanded && threadListV2Layout.hiddenSettledCount > 0 ? (
<ThreadListV2ShowMoreRow
hiddenCount={threadListV2Layout.hiddenSettledCount}
onPress={showMoreSettled}
/>
) : null
}
ListEmptyComponent={v2ListEmpty}
style={{ flex: 1 }}
automaticallyAdjustsScrollIndicatorInsets={Platform.OS === "ios"}
contentInsetAdjustmentBehavior="never"
contentInset={Platform.OS === "ios" ? { top: insets.top } : undefined}
contentInsetStartAdjustment={Platform.OS === "ios" ? insets.top : 0}
showsVerticalScrollIndicator={false}
keyboardDismissMode="on-drag"
keyboardShouldPersistTaps="handled"
{...scrollGateHandlers}
scrollEventThrottle={16}
contentContainerStyle={{
paddingLeft: (contentSideInsets?.left ?? 0) + (primaryColumn ? 8 : 0),
paddingRight: (contentSideInsets?.right ?? 0) + (primaryColumn ? 8 : 0),
paddingBottom:
Platform.OS === "ios"
? iosBottomClearance
: Math.max(insets.bottom, 16) + (Platform.OS === "android" ? fabClearance : 88),
}}
/>
</GestureDetector>
</SwipeableScrollGateProvider>
</View>
</View>
Expand Down
Loading