refactor(mobile): name the iOS nav bar height fallback (#6589)
Co-authored-by: Claude Fable 5 <[email protected]> Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
5 files changed
+18
-7
No files matched your search
@@ -8,6 +8,7 @@ import { AppText as Text } from "../../components/AppText";
|
||||
import { PierreEntryIcon } from "../../components/PierreEntryIcon";
|
||||
import { cn } from "../../lib/cn";
|
||||
import { useThemeColor } from "../../lib/useThemeColor";
|
||||
import { IOS_NAV_BAR_HEIGHT } from "../../lib/layoutMetrics";
|
||||
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
|
||||
import {
|
||||
buildFileTree,
|
||||
@@ -123,7 +124,7 @@ export function FileTreeBrowser(props: {
|
||||
const insets = useSafeAreaInsets();
|
||||
// Native transparent-header height ≈ safe-area top + nav bar (~44). Matches the
|
||||
// observed adjustedContentInset bottom (~102) seen in the native trace.
|
||||
const headerInset = NATIVE_LIQUID_GLASS_SUPPORTED ? insets.top + 44 : 0;
|
||||
const headerInset = NATIVE_LIQUID_GLASS_SUPPORTED ? insets.top + IOS_NAV_BAR_HEIGHT : 0;
|
||||
const iconColor = String(useThemeColor("--color-icon-muted"));
|
||||
const { onPreviewFile, onSelectFile, selectedPath: controlledSelectedPath } = props;
|
||||
const controlledSelectedPathRef = useRef(controlledSelectedPath);
|
||||
|
||||
@@ -39,6 +39,7 @@ import { environmentCatalog } from "../../connection/catalog";
|
||||
import { useEnvironmentPresentation } from "../../state/presentation";
|
||||
import { useAtomCommand } from "../../state/use-atom-command";
|
||||
import { useThemeColor } from "../../lib/useThemeColor";
|
||||
import { IOS_NAV_BAR_HEIGHT } from "../../lib/layoutMetrics";
|
||||
import { useThreadDraftForThread } from "../../state/use-thread-composer-state";
|
||||
import { EnvironmentConnectionNotice } from "../connection/EnvironmentConnectionNotice";
|
||||
import {
|
||||
@@ -277,9 +278,11 @@ function ReviewFileNavigator({
|
||||
// The nested native header is translucent; start the list below it so
|
||||
// the scroll-edge effect can sample the content (same treatment as
|
||||
// FileTreeBrowser in the Files pane).
|
||||
paddingTop: Platform.OS === "ios" ? insets.top + 44 + 8 : 8,
|
||||
paddingTop: Platform.OS === "ios" ? insets.top + IOS_NAV_BAR_HEIGHT + 8 : 8,
|
||||
}}
|
||||
scrollIndicatorInsets={Platform.OS === "ios" ? { top: insets.top + 44 } : undefined}
|
||||
scrollIndicatorInsets={
|
||||
Platform.OS === "ios" ? { top: insets.top + IOS_NAV_BAR_HEIGHT } : undefined
|
||||
}
|
||||
renderItem={renderFile}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -57,6 +57,7 @@ import type { ComposerEditorHandle } from "../../components/ComposerEditor";
|
||||
import type { StatusTone } from "../../components/StatusPill";
|
||||
import type { DraftComposerImageAttachment } from "../../lib/composerImages";
|
||||
import { CHAT_CONTENT_MAX_WIDTH, type LayoutVariant } from "../../lib/layout";
|
||||
import { IOS_NAV_BAR_HEIGHT } from "../../lib/layoutMetrics";
|
||||
import { scopedThreadKey } from "../../lib/scopedEntities";
|
||||
import type {
|
||||
PendingApproval,
|
||||
@@ -249,7 +250,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
|
||||
}
|
||||
}, []);
|
||||
const windowHeight = useWindowDimensions().height;
|
||||
const navigationHeaderHeight = useContext(HeaderHeightContext) || insets.top + 44;
|
||||
const navigationHeaderHeight = useContext(HeaderHeightContext) || insets.top + IOS_NAV_BAR_HEIGHT;
|
||||
const agentLabel = `${props.selectedThread.modelSelection.instanceId} agent`;
|
||||
const selectedThreadKey = scopedThreadKey(props.environmentId, props.selectedThread.id);
|
||||
const composerEditorRef = useRef<ComposerEditorHandle>(null);
|
||||
|
||||
@@ -47,6 +47,7 @@ import ImageViewing from "react-native-image-viewing";
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
import Animated, { FadeIn, FadeInUp, type SharedValue } from "react-native-reanimated";
|
||||
import { useThemeColor } from "../../lib/useThemeColor";
|
||||
import { IOS_NAV_BAR_HEIGHT } from "../../lib/layoutMetrics";
|
||||
import { useFontFamily } from "../../lib/useFontFamily";
|
||||
import { scopedThreadKey } from "../../lib/scopedEntities";
|
||||
import { copyTextWithHaptic } from "../../lib/copyTextWithHaptic";
|
||||
@@ -1396,7 +1397,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
|
||||
const userBubbleMaxWidth = contentWidth * 0.85;
|
||||
const reviewCommentBubbleWidth = Math.min(Math.max(280, contentWidth * 0.85), contentWidth);
|
||||
const insets = useSafeAreaInsets();
|
||||
const topContentInset = props.contentTopInset ?? insets.top + 44;
|
||||
const topContentInset = props.contentTopInset ?? insets.top + IOS_NAV_BAR_HEIGHT;
|
||||
const bottomContentInset = props.contentBottomInset ?? 18;
|
||||
const usesNativeAutomaticInsets =
|
||||
props.usesAutomaticContentInsets === true && Platform.OS === "ios";
|
||||
@@ -1409,7 +1410,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
|
||||
// header-providing screen) and fall back to the standard iOS bar height.
|
||||
const navigationHeaderHeight = useContext(HeaderHeightContext);
|
||||
const anchorTopInset = usesNativeAutomaticInsets
|
||||
? navigationHeaderHeight || insets.top + 44
|
||||
? navigationHeaderHeight || insets.top + IOS_NAV_BAR_HEIGHT
|
||||
: topContentInset;
|
||||
|
||||
const iconSubtleColor = useThemeColor("--color-icon-subtle");
|
||||
|
||||
@@ -5,7 +5,12 @@ export const HOME_HORIZONTAL_INSET = 20;
|
||||
export const IPAD_HOME_TITLE_OFFSET = 10;
|
||||
|
||||
/**
|
||||
* Height of the app's own header chrome below the safe-area inset, on every
|
||||
* Height of the native iOS navigation bar below the safe-area inset, used as
|
||||
* a fallback when the measured HeaderHeightContext is unavailable.
|
||||
*/
|
||||
export const IOS_NAV_BAR_HEIGHT = 44;
|
||||
|
||||
/* Height of the app's own header chrome below the safe-area inset, on every
|
||||
* platform (matches the `min-h-12` AndroidScreenHeader). Distinct from the
|
||||
* 44pt native iOS navigation bar.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user