Open History to see the last commit
1import { createContext, use, type ComponentProps } from "react";
2import { Platform } from "react-native";
3import { NativeScrollView as ScrollView } from "../../native/NativeScrollViewMarker";
4
5export const ScreenScrollViewBottomInset = createContext(0);
6
7export function ScreenScrollView(props: ComponentProps<typeof ScrollView>) {
8 const bottomInset = use(ScreenScrollViewBottomInset);
9 return (
10 <ScrollView
11 {...props}
12 contentInset={
13 Platform.OS === "ios" && bottomInset > 0
14 ? { ...props.contentInset, bottom: (props.contentInset?.bottom ?? 0) + bottomInset }
15 : props.contentInset
16 }
17 contentContainerStyle={[
18 props.contentContainerStyle,
19 Platform.OS === "android" && {
20 width: "100%",
21 maxWidth: 720,
22 alignSelf: "center",
23 },
24 ]}
25 />
26 );
27}