0b2d65a4e9
Mobile app detects SSO per server, supports OAuth sign-in, and preserves saved sessions when adding accounts. Tab screens get proper chrome layout and tab-bar clearance with scrollable page headers. Co-authored-by: Cursor <cursoragent@cursor.com>
56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import { useScrollToTop } from "expo-router";
|
|
import { useRef, type ReactNode } from "react";
|
|
import { Platform, ScrollView, type ScrollViewProps, StyleSheet, View } from "react-native";
|
|
|
|
import { tabLayout } from "@/lib/tab-layout";
|
|
import { useTabScreenScrollPadding } from "@/lib/tab-bar-insets";
|
|
|
|
type TabScrollViewProps = ScrollViewProps & {
|
|
/** Rendered at the top of scroll content (scrolls with the page). */
|
|
header?: ReactNode;
|
|
children: ReactNode;
|
|
};
|
|
|
|
/**
|
|
* Tab screen scroll view. Top chrome (logo / account) is pinned in TabPage;
|
|
* the page header and body scroll together here.
|
|
*/
|
|
export function TabScrollView({
|
|
header,
|
|
children,
|
|
contentContainerStyle,
|
|
style,
|
|
...props
|
|
}: TabScrollViewProps) {
|
|
const scrollRef = useRef<ScrollView>(null);
|
|
const bottomPadding = useTabScreenScrollPadding();
|
|
|
|
useScrollToTop(scrollRef);
|
|
|
|
return (
|
|
<ScrollView
|
|
ref={scrollRef}
|
|
style={[styles.scroll, style]}
|
|
contentContainerStyle={[
|
|
tabLayout.scrollContent,
|
|
{ paddingBottom: bottomPadding },
|
|
contentContainerStyle,
|
|
]}
|
|
contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "never" : undefined}
|
|
scrollIndicatorInsets={{ bottom: bottomPadding }}
|
|
{...props}
|
|
>
|
|
{header}
|
|
<View style={tabLayout.scrollBody}>{children}</View>
|
|
</ScrollView>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
scroll: {
|
|
flex: 1,
|
|
minHeight: 0,
|
|
backgroundColor: "transparent",
|
|
},
|
|
});
|