Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

RefreshControl.android.tsx

22 lines852 Bytes

1import { use } from "react";
2// oxlint-disable-next-line eslint/no-restricted-imports -- The wrapper every screen must use.
3import { RefreshControl as NativeRefreshControl } from "react-native";
4import { View, type RefreshControlProps } from "react-native";
5​
6import { BottomSheetContext } from "./BottomSheetContext";
7​
8/**
9 * A bottom sheet takes the pull at the top, and Material reads the swipe-refresh layout as unable
10 * to scroll up, so the sheet collapses instead of scrolling back. Sheets get a plain wrapper that
11 * keeps the layout style the scroll view hands its refresh control.
12 */
13export function RefreshControl(props: RefreshControlProps) {
14 if (use(BottomSheetContext)) {
15 return (
16 <View collapsable={false} style={props.style}>
17 {props.children}
18 </View>
19 );
20 }
21 return <NativeRefreshControl {...props} />;