Split diff horizontal scroll into platform-specific components

Use Metro .web.tsx resolution to separate native gesture arbitration
(RNGH ScrollView, waitFor, closeGestureRef) from web (plain RN ScrollView),
fixing text selection drag on desktop web.
This commit is contained in:
Mohamed Boudra
2026-03-21 23:32:38 +07:00
parent c80c3e0256
commit 59f3f4737a
3 changed files with 119 additions and 54 deletions
@@ -0,0 +1,29 @@
import { ScrollView, type LayoutChangeEvent, type StyleProp, type ViewStyle } from "react-native";
interface DiffScrollProps {
children: React.ReactNode;
scrollViewWidth: number;
onScrollViewWidthChange: (width: number) => void;
style?: StyleProp<ViewStyle>;
contentContainerStyle?: StyleProp<ViewStyle>;
}
export function DiffScroll({
children,
onScrollViewWidthChange,
style,
contentContainerStyle,
}: DiffScrollProps) {
return (
<ScrollView
horizontal
nestedScrollEnabled
showsHorizontalScrollIndicator
style={style}
contentContainerStyle={contentContainerStyle}
onLayout={(e: LayoutChangeEvent) => onScrollViewWidthChange(e.nativeEvent.layout.width)}
>
{children}
</ScrollView>
);
}