The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { use } from "react"; |
| 2 | // oxlint-disable-next-line eslint/no-restricted-imports -- The wrapper every screen must use. |
| 3 | import { RefreshControl as NativeRefreshControl } from "react-native"; |
| 4 | import { View, type RefreshControlProps } from "react-native"; |
| 5 | |
| 6 | import { 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 | */ |
| 13 | export 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} />; |
| 22 | } |