The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { createContext, use, type ComponentProps } from "react"; |
| 2 | import { Platform } from "react-native"; |
| 3 | import { cn } from "../../lib/cn"; |
| 4 | import { NativeScrollView as ScrollView } from "../../native/NativeScrollViewMarker"; |
| 5 | |
| 6 | export const ScreenScrollViewBottomInset = createContext(0); |
| 7 | /** |
| 8 | * The screen's surface class. UIKit's scroll-edge material under the header takes the scroll |
| 9 | * view's own color; a clear scroll view gets the system's near-white bar over the screen's surface. |
| 10 | */ |
| 11 | export const ScreenScrollViewSurface = createContext<string | undefined>(undefined); |
| 12 | |
| 13 | export function ScreenScrollView(props: ComponentProps<typeof ScrollView>) { |
| 14 | const bottomInset = use(ScreenScrollViewBottomInset); |
| 15 | const surface = use(ScreenScrollViewSurface); |
| 16 | return ( |
| 17 | <ScrollView |
| 18 | {...props} |
| 19 | className={Platform.OS === "ios" && surface ? cn(surface, props.className) : props.className} |
| 20 | contentInset={ |
| 21 | Platform.OS === "ios" && bottomInset > 0 |
| 22 | ? { ...props.contentInset, bottom: (props.contentInset?.bottom ?? 0) + bottomInset } |
| 23 | : props.contentInset |
| 24 | } |
| 25 | contentContainerStyle={[ |
| 26 | props.contentContainerStyle, |
| 27 | Platform.OS === "android" && { |
| 28 | width: "100%", |
| 29 | maxWidth: 720, |
| 30 | alignSelf: "center", |
| 31 | }, |
| 32 | ]} |
| 33 | /> |
| 34 | ); |
| 35 | } |