Skip to content
TypeScript

design(mobile): unify Android Material layouts and native controls (#11841)

Alexe106fe95cc81
diff --git a/apps/mobile/modules/t3-markdown-text/android/src/main/java/expo/modules/t3markdowntext/T3MarkdownTextSelectionModule.kt b/apps/mobile/modules/t3-markdown-text/android/src/main/java/expo/modules/t3markdowntext/T3MarkdownTextSelectionModule.kt
index 26ceb202323..bca3c643030 100644
--- a/apps/mobile/modules/t3-markdown-text/android/src/main/java/expo/modules/t3markdowntext/T3MarkdownTextSelectionModule.kt
+++ b/apps/mobile/modules/t3-markdown-text/android/src/main/java/expo/modules/t3markdowntext/T3MarkdownTextSelectionModule.kt
@@ -8,6 +8,7 @@ import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.graphics.Typeface
+import android.os.Build
import android.text.Spannable
import android.text.SpannableStringBuilder
import android.text.Spanned
@@ -164,6 +165,17 @@ private class SanitizingSelectionActionModeCallback(
}
}
+internal fun applySelectionHandleColor(textView: TextView, color: Int) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) return
+ textView.textSelectHandle?.mutate()?.apply { setTint(color) }?.let(textView::setTextSelectHandle)
+ textView.textSelectHandleLeft?.mutate()?.apply {
+ setTint(color)
+ }?.let(textView::setTextSelectHandleLeft)
+ textView.textSelectHandleRight?.mutate()?.apply {
+ setTint(color)
+ }?.let(textView::setTextSelectHandleRight)
+}
+
class T3MarkdownTextSelectionModule : Module() {
private val chipImages = LruCache<String, Map<String, Any>>(128)
@@ -183,9 +195,23 @@ class T3MarkdownTextSelectionModule : Module() {
}
}.fontMetricsInt
+ private fun setSelectionHandleColor(reactTag: Int, color: Int) {
+ val reactContext = appContext.reactContext as? ReactContext ?: return
+ reactContext.runOnUiQueueThread {
+ val textView = runCatching {
+ UIManagerHelper.getUIManagerForReactTag(reactContext, reactTag)?.resolveView(reactTag)
+ }.getOrNull() as? TextView ?: return@runOnUiQueueThread
+ applySelectionHandleColor(textView, color)
+ }
+ }
+
override fun definition() = ModuleDefinition {
Name("T3MarkdownTextSelection")
+ Function("setSelectionHandleColor") { reactTag: Int, color: Int ->
+ setSelectionHandleColor(reactTag, color)
+ }
+
Function("renderContextChip") { payloadJson: String ->
val resources = appContext.reactContext?.resources ?: return@Function null
val metrics = resources.displayMetrics
diff --git a/apps/mobile/modules/t3-markdown-text/android/src/test/java/expo/modules/t3markdowntext/MarkdownSelectionColorTest.kt b/apps/mobile/modules/t3-markdown-text/android/src/test/java/expo/modules/t3markdowntext/MarkdownSelectionColorTest.kt
new file mode 100644
index 00000000000..81703090a3f
--- /dev/null
+++ b/apps/mobile/modules/t3-markdown-text/android/src/test/java/expo/modules/t3markdowntext/MarkdownSelectionColorTest.kt
@@ -0,0 +1,67 @@
+package expo.modules.t3markdowntext
+
+import android.graphics.Bitmap
+import android.graphics.Canvas
+import android.graphics.Color
+import android.graphics.drawable.ColorDrawable
+import android.graphics.drawable.Drawable
+import android.widget.TextView
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.robolectric.RobolectricTestRunner
+import org.robolectric.RuntimeEnvironment
+import org.robolectric.annotation.Config
+import org.robolectric.annotation.GraphicsMode
+
+@RunWith(RobolectricTestRunner::class)
+@Config(sdk = [36], manifest = Config.NONE)
+@GraphicsMode(GraphicsMode.Mode.NATIVE)
+class MarkdownSelectionColorTest {
+ private fun textView() = TextView(RuntimeEnvironment.getApplication()).apply {
+ setTextSelectHandle(ColorDrawable(Color.WHITE))
+ setTextSelectHandleLeft(ColorDrawable(Color.WHITE))
+ setTextSelectHandleRight(ColorDrawable(Color.WHITE))
+ }
+
+ private fun renderedColor(drawable: Drawable?): Int {
+ requireNotNull(drawable)
+ val bitmap = Bitmap.createBitmap(4, 4, Bitmap.Config.ARGB_8888)
+ drawable.setBounds(0, 0, 4, 4)
+ drawable.draw(Canvas(bitmap))
+ val color = bitmap.getPixel(2, 2)
+ bitmap.recycle()
+ return color
+ }
+
+ @Test
+ fun retintsAllHandlesWhenTheThemeChangesWithoutChangingTheHighlight() {
+ val text = textView()
+ val highlight = 0x52FF0088
+ text.highlightColor = highlight
+
+ for (color in listOf(Color.MAGENTA, Color.GREEN, Color.MAGENTA)) {
+ applySelectionHandleColor(text, color)
+ assertEquals(color, renderedColor(text.textSelectHandle))
+ assertEquals(color, renderedColor(text.textSelectHandleLeft))
+ assertEquals(color, renderedColor(text.textSelectHandleRight))
+ assertEquals(highlight, text.highlightColor)
+ }
+ }
+
+ @Test
+ fun doesNotTintOtherTextViewsSharingDrawableState() {
+ val original = ColorDrawable(Color.WHITE)
+ val first = textView().apply {
+ setTextSelectHandleLeft(original.constantState!!.newDrawable())
+ }
+ val second = textView().apply {
+ setTextSelectHandleLeft(original.constantState!!.newDrawable())
+ }
+
+ applySelectionHandleColor(first, Color.MAGENTA)
+
+ assertEquals(Color.MAGENTA, renderedColor(first.textSelectHandleLeft))
+ assertEquals(Color.WHITE, renderedColor(second.textSelectHandleLeft))
+ }
+}
diff --git a/apps/mobile/modules/t3-markdown-text/src/MarkdownTextPrimitive.tsx b/apps/mobile/modules/t3-markdown-text/src/MarkdownTextPrimitive.tsx
index c1e2df490e8..1e9394bd6ec 100644
--- a/apps/mobile/modules/t3-markdown-text/src/MarkdownTextPrimitive.tsx
+++ b/apps/mobile/modules/t3-markdown-text/src/MarkdownTextPrimitive.tsx
@@ -1,5 +1,15 @@
import React, { type Ref } from "react";
-import { Platform, StyleSheet, Text as RNText, type TextProps, type ViewStyle } from "react-native";
+import {
+ findNodeHandle,
+ Platform,
+ processColor,
+ StyleSheet,
+ Text as RNText,
+ type ColorValue,
+ type TextProps,
+ type ViewStyle,
+} from "react-native";
+import { setMarkdownSelectionHandleColor } from "./T3MarkdownTextSelectionModule";
import T3MarkdownTextRunNativeComponent from "./T3MarkdownTextRunNativeComponent";
import T3MarkdownTextNativeComponent from "./T3MarkdownTextNativeComponent";
import { flattenStyles } from "./util";
@@ -34,6 +44,7 @@ export type ContextMenuActionEvent = {
*/
export type MarkdownTextPrimitiveProps = Omit<TextProps, "onTextLayout"> & {
nativeTextRef?: Ref<RNText>;
+ selectionHandleColor?: ColorValue;
uiTextView?: boolean;
contextMenuConfig?: string;
contextClipboardConfig?: string;
@@ -116,7 +127,45 @@ function MarkdownTextPrimitiveInner({ nativeTextRef, ...props }: MarkdownTextPri
return <MarkdownTextPrimitiveChild {...props} />;
}
-export function MarkdownTextPrimitive(props: MarkdownTextPrimitiveProps) {
+function AndroidMarkdownText({
+ nativeTextRef,
+ selectionHandleColor,
+ onLayout,
+ contextClipboardConfig: _contextClipboardConfig,
+ ...props
+}: MarkdownTextPrimitiveProps) {
+ const textRef = React.useRef<RNText | null>(null);
+ React.useImperativeHandle<RNText | null, RNText | null>(nativeTextRef, () => textRef.current, []);
+ const color = processColor(selectionHandleColor);
+ const applyHandleColor = React.useCallback(() => {
+ if (!textRef.current || typeof color !== "number") return;
+ const reactTag = findNodeHandle(textRef.current);
+ if (reactTag !== null) setMarkdownSelectionHandleColor(reactTag, color);
+ }, [color]);
+
+ // RN's selectionColor only sets the highlight. Retint mounted handles when
+ // the theme changes, and after layout when the native view first exists.
+ React.useEffect(applyHandleColor, [applyHandleColor]);
+
+ return (
+ <RNText
+ ref={textRef}
+ {...props}
+ onLayout={(event) => {
+ applyHandleColor();
+ onLayout?.(event);
+ }}
+ />
+ );
+}
+
+export function MarkdownTextPrimitive({
+ selectionHandleColor,
+ ...props
+}: MarkdownTextPrimitiveProps) {
+ if (Platform.OS === "android" && selectionHandleColor !== undefined) {
+ return <AndroidMarkdownText {...props} selectionHandleColor={selectionHandleColor} />;
+ }
if (Platform.OS !== "ios") {
const { nativeTextRef, contextClipboardConfig: _contextClipboardConfig, ...textProps } = props;
return <RNText ref={nativeTextRef} {...textProps} />;
diff --git a/apps/mobile/modules/t3-markdown-text/src/NativeMarkdownBlock.tsx b/apps/mobile/modules/t3-markdown-text/src/NativeMarkdownBlock.tsx
index a4485ede470..b57a182dbc5 100644
--- a/apps/mobile/modules/t3-markdown-text/src/NativeMarkdownBlock.tsx
+++ b/apps/mobile/modules/t3-markdown-text/src/NativeMarkdownBlock.tsx
@@ -133,7 +133,13 @@ function HighlightedCodeText(props: {
}
}
return (
- <MarkdownTextPrimitive uiTextView selectable style={style}>
+ <MarkdownTextPrimitive
+ uiTextView
+ selectable
+ selectionColor={props.textStyle.selectionColor}
+ selectionHandleColor={props.textStyle.selectionHandleColor}
+ style={style}
+ >
{props.highlighted ? lines : props.content}
</MarkdownTextPrimitive>
);
@@ -174,8 +180,10 @@ function NativeCodeBlock(props: {
justifyContent: "space-between",
}}
>
- <Text
+ <MarkdownTextPrimitive
selectable
+ selectionColor={props.textStyle.selectionColor}
+ selectionHandleColor={props.textStyle.selectionHandleColor}
style={{
flex: 1,
color: props.textStyle.mutedColor,
@@ -184,7 +192,7 @@ function NativeCodeBlock(props: {
}}
>
{languageLabel}
- </Text>
+ </MarkdownTextPrimitive>
<CopyTextButton
accessibilityLabel={`Copy ${languageLabel.toLowerCase()} code`}
text={content}
@@ -332,8 +340,10 @@ function NativeMarkdownImage(props: {
}}
/>
{props.node.alt ? (
- <Text
+ <MarkdownTextPrimitive
selectable
+ selectionColor={props.textStyle.selectionColor}
+ selectionHandleColor={props.textStyle.selectionHandleColor}
style={{
color: props.textStyle.mutedColor,
fontFamily: props.textStyle.fontFamily,
@@ -342,7 +352,7 @@ function NativeMarkdownImage(props: {
}}
>
{props.node.alt}
- </Text>
+ </MarkdownTextPrimitive>
) : null}
</View>
);
diff --git a/apps/mobile/modules/t3-markdown-text/src/NativeMarkdownSelectableText.tsx b/apps/mobile/modules/t3-markdown-text/src/NativeMarkdownSelectableText.tsx
index 50a381bae28..1d9c2b93ede 100644
--- a/apps/mobile/modules/t3-markdown-text/src/NativeMarkdownSelectableText.tsx
+++ b/apps/mobile/modules/t3-markdown-text/src/NativeMarkdownSelectableText.tsx
@@ -338,6 +338,8 @@ export function NativeMarkdownSelectableText(props: {
}
uiTextView
selectable
+ selectionColor={props.textStyle.selectionColor}
+ selectionHandleColor={props.textStyle.selectionHandleColor}
style={{
flexShrink: 1,
minWidth: 0,
diff --git a/apps/mobile/modules/t3-markdown-text/src/SelectableMarkdownText.types.ts b/apps/mobile/modules/t3-markdown-text/src/SelectableMarkdownText.types.ts
index d67dcc5950d..adfa34365af 100644
--- a/apps/mobile/modules/t3-markdown-text/src/SelectableMarkdownText.types.ts
+++ b/apps/mobile/modules/t3-markdown-text/src/SelectableMarkdownText.types.ts
@@ -1,4 +1,6 @@
export interface NativeMarkdownTextStyle {
+ readonly selectionColor?: string;
+ readonly selectionHandleColor?: string;
readonly color: string;
readonly strongColor: string;
readonly mutedColor: string;
diff --git a/apps/mobile/modules/t3-markdown-text/src/T3MarkdownTextSelectionModule.ts b/apps/mobile/modules/t3-markdown-text/src/T3MarkdownTextSelectionModule.ts
index 9f1d676179a..56d8f6d4e0f 100644
--- a/apps/mobile/modules/t3-markdown-text/src/T3MarkdownTextSelectionModule.ts
+++ b/apps/mobile/modules/t3-markdown-text/src/T3MarkdownTextSelectionModule.ts
@@ -1,6 +1,7 @@
import { requireOptionalNativeModule } from "expo";
interface T3MarkdownTextSelectionNativeModule {
+ readonly setSelectionHandleColor?: (reactTag: number, color: number) => void;
readonly installCopySanitizer: (reactTag: number, contextClipboardConfig: string) => void;
readonly renderContextChip?: (payloadJson: string) => {
readonly uri: string;
@@ -20,6 +21,10 @@ export function installMarkdownCopySanitizer(reactTag: number, contextClipboardC
nativeModule?.installCopySanitizer(reactTag, contextClipboardConfig);
}
+export function setMarkdownSelectionHandleColor(reactTag: number, color: number): void {
+ nativeModule?.setSelectionHandleColor?.(reactTag, color);
+}
+
export function renderAndroidContextChip(payloadJson: string) {
return nativeModule?.renderContextChip?.(payloadJson) ?? null;
}
diff --git a/apps/mobile/modules/t3-native-controls/android/src/main/java/expo/modules/t3nativecontrols/T3NativeControlsModule.kt b/apps/mobile/modules/t3-native-controls/android/src/main/java/expo/modules/t3nativecontrols/T3NativeControlsModule.kt
index baea4a9590e..7a5e1131928 100644
--- a/apps/mobile/modules/t3-native-controls/android/src/main/java/expo/modules/t3nativecontrols/T3NativeControlsModule.kt
+++ b/apps/mobile/modules/t3-native-controls/android/src/main/java/expo/modules/t3nativecontrols/T3NativeControlsModule.kt
@@ -1,6 +1,7 @@
package expo.modules.t3nativecontrols
import android.content.Intent
+import android.text.format.DateFormat
import androidx.core.content.FileProvider
import expo.modules.kotlin.Promise
import expo.modules.kotlin.modules.Module
@@ -15,6 +16,11 @@ class T3NativeControlsModule : Module() {
override fun definition() = ModuleDefinition {
Name("T3NativeControls")
+ Function("is24HourFormat") {
+ val context = appContext.reactContext ?: error("The app is not active.")
+ DateFormat.is24HourFormat(context)
+ }
+
AsyncFunction("openFile") { uri: String, mimeType: String, promise: Promise ->
check(filePreviewPromise == null) { "A document viewer is already open." }
val activity = appContext.currentActivity ?: error("The app is not active.")
diff --git a/apps/mobile/src/App.tsx b/apps/mobile/src/App.tsx
index 7b2c0318f9f..34a742f8f11 100644
--- a/apps/mobile/src/App.tsx
+++ b/apps/mobile/src/App.tsx
@@ -1,8 +1,7 @@
-import { BlurTargetView } from "expo-blur";
import * as Linking from "expo-linking";
import * as SplashScreen from "expo-splash-screen";
import { useEffect } from "react";
-import { StatusBar } from "react-native";
+import { StatusBar, View } from "react-native";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { KeyboardProvider } from "react-native-keyboard-controller";
import { SafeAreaProvider } from "react-native-safe-area-context";
@@ -21,10 +20,8 @@ import {
import { RootStack } from "./Stack";
import { appAtomRegistry } from "./state/atom-registry";
import { OverlayPortalHost } from "./components/OverlayPortal";
-import { appBlurTargetRef } from "./lib/appBlurTarget";
import { shouldHandleAppLink } from "./lib/appLinking";
import { useMobileNavigationTheme } from "./lib/useMobileNavigationTheme";
-
import { SubscriptionUsageCoordinator } from "./widgets/SubscriptionUsageCoordinator";
import "../global.css";
@@ -88,14 +85,13 @@ function AppContent() {
this, React Navigation defaults to its light theme and every native
header (glass buttons, title, materials) is forced light even when
the system is in dark mode. */}
- {/* Blur target for Android dropdown backdrops — see appBlurTarget.ts. */}
- <BlurTargetView ref={appBlurTargetRef} style={{ flex: 1 }}>
+ <View style={{ flex: 1 }}>
<IncomingShareProvider>
<Navigation linking={appLinking} theme={navigationTheme} />
</IncomingShareProvider>
<ConfirmDialogHost />
<ThreadArrangementHost />
- </BlurTargetView>
+ </View>
{/* Anchored-menu overlays render here — in-window, so the
keyboard stays up while a dropdown is open. */}
<OverlayPortalHost />
diff --git a/apps/mobile/src/components/AndroidAnchoredMenu.tsx b/apps/mobile/src/components/AndroidAnchoredMenu.tsx
index 79ec95d0a01..dfa0dea8d05 100644
--- a/apps/mobile/src/components/AndroidAnchoredMenu.tsx
+++ b/apps/mobile/src/components/AndroidAnchoredMenu.tsx
@@ -6,12 +6,8 @@ import { BackHandler, Pressable, ScrollView, View } from "react-native";
import { useKeyboardState } from "react-native-keyboard-controller";
import Animated, { FadeIn } from "react-native-reanimated";
-import { appBlurTargetRef } from "../lib/appBlurTarget";
-import { cn } from "../lib/cn";
-import { type AppSymbolName, SymbolView } from "./AppSymbol";
-import { AppText as Text } from "./AppText";
import { OverlayPortal } from "./OverlayPortal";
-import { GlassBackdrop } from "./GlassBackdrop";
+import { MaterialMenuPopup } from "./MaterialMenuPopup";
const MENU_WIDTH = 250;
const SCREEN_MARGIN = 12;
@@ -27,6 +23,7 @@ type AnchorSnapshot = {
readonly y: number;
readonly width: number;
readonly height: number;
+ readonly keyboardWasVisible: boolean;
};
type OverlayFrame = {
@@ -53,13 +50,9 @@ export type AndroidAnchoredMenuProps = {
};
/**
- * Token-styled anchored dropdown for Android, drop-in for the subset of the
- * MenuView contract the app uses (actions with state/subtitle/image/
- * attributes, one level of subactions). The native AppCompat PopupMenu caps
- * out on theming — stock animation, item metrics, and submenu chrome — so
- * ControlPillMenu renders this instead on Android while iOS keeps the native
- * UIMenu. Styling follows the themed native popup (12dp radius, plain rows,
- * trailing check glyph); submenus drill in under a muted parent-title header.
+ * Adapts the app's MenuView actions to Material dropdowns on Android. Editor
+ * menus render native Material rows in-window to retain keyboard focus; other
+ * menus use the native popup for placement, animation and dismissal.
*/
export function AndroidAnchoredMenu(props: AndroidAnchoredMenuProps) {
const [anchor, setAnchor] = useState<AnchorSnapshot | null>(null);
@@ -89,9 +82,9 @@ export function AndroidAnchoredMenu(props: AndroidAnchoredMenuProps) {
const open = useCallback(() => {
anchorRef.current?.measureInWindow((x, y, width, height) => {
- setAnchor({ x, y, width, height });
+ setAnchor({ x, y, width, height, keyboardWasVisible: keyboardVisible });
});
- }, []);
+ }, [keyboardVisible]);
const measureOverlay = useCallback(() => {
overlayRef.current?.measureInWindow((x, y, width, height) => {
@@ -100,18 +93,11 @@ export function AndroidAnchoredMenu(props: AndroidAnchoredMenuProps) {
});
}, []);
- // The dropdown renders in-window (no Modal takes focus), so the hardware
- // back gesture needs explicit handling while it is open. Back steps out of
- // a drilled-in submenu one level at a time (mirroring the tappable parent
- // header) before closing the menu. Under predictive back
- // (enableOnBackInvokedCallback) this stays correct: back reaches JS
- // through always-registered OnBackPressedDispatcher callbacks (react-native
- // core on Android 16+, withAndroidPredictiveBackCompat on 13-15), which
- // also keeps the system from playing a "leave app" preview while the menu
- // merely closes.
+ // The native popup owns back dismissal. In-window menus need a handler;
+ // back returns to the parent submenu before closing the overlay.
const submenuDepth = path.length;
useEffect(() => {
- if (anchor === null) {
+ if (anchor === null || !anchor.keyboardWasVisible) {
return;
}
const subscription = BackHandler.addEventListener("hardwareBackPress", () => {
@@ -212,10 +198,20 @@ export function AndroidAnchoredMenu(props: AndroidAnchoredMenuProps) {
onLayout={measureOverlay}
>
<Pressable accessible={false} className="absolute inset-0" onPress={close} />
- {!placeable || local === null ? null : (
+ {!placeable || local === null ? null : !anchor.keyboardWasVisible ? (
+ <MaterialMenuPopup
+ anchor={local}
+ actions={levelActions}
+ title={props.title}
+ parent={parent}
+ onPress={onPressItem}
+ onBack={() => setPath((current) => current.slice(0, -1))}
+ onClose={close}
+ />
+ ) : (
<Animated.View
entering={FadeIn.duration(120)}
- className="absolute w-[250px] overflow-hidden rounded-[12px] border border-border shadow-2xl"
+ className="absolute w-[250px] overflow-hidden rounded-[4px] bg-card-alt shadow-md"
style={{
left,
maxHeight,
@@ -224,93 +220,28 @@ export function AndroidAnchoredMenu(props: AndroidAnchoredMenuProps) {
: { bottom: (rootHeight ?? 0) - local.y + ANCHOR_GAP }),
}}
>
- <GlassBackdrop blurTarget={appBlurTargetRef} />
+ {/* Compose DropdownMenu takes popup focus in the pinned Expo UI version.
+ Keep editor menus in-window so opening one preserves the keyboard. */}
+
{/* keyboardShouldPersistTaps: the menu often opens over an
active editor; the first item tap must act, not just
dismiss the keyboard. */}
<ScrollView
+ contentContainerClassName="py-2"
bounces={false}
keyboardShouldPersistTaps="always"
showsVerticalScrollIndicator={false}
>
- {parent !== null ? (
- // Muted parent title as the submenu header; tapping it
- // steps back, but it reads as a label, not a button.
- <Pressable
- className="px-3.5 pb-1 pt-2.5"
- onPress={() => setPath((current) => current.slice(0, -1))}
- >
- <Text className="text-xs font-t3-bold text-foreground-muted">
- {parent.title}
- </Text>
- </Pressable>
- ) : props.title ? (
- <>
- <View className="px-3.5 py-2">
- <Text className="text-center text-xs text-foreground-muted">
- {props.title}
- </Text>
- </View>
- <View className="h-px bg-border" />
- </>
- ) : null}
- {levelActions.map((action, index) => {
- const destructive = action.attributes?.destructive ?? false;
- const disabled = action.attributes?.disabled ?? false;
- const hasSubmenu = (action.subactions?.length ?? 0) > 0;
- return (
- <Pressable
- key={action.id ?? `${index}-${action.title}`}
- disabled={disabled}
- className={cn(
- "min-h-11 flex-row items-center gap-2.5 px-3.5 py-2.5 active:bg-subtle",
- disabled && "opacity-45",
- )}
- onPress={() => onPressItem(action)}
- >
- <View className="flex-1 gap-0.5">
- <Text
- className={cn(
- // Same face as the pill labels that open these menus.
- "text-sm font-t3-bold",
- destructive && "text-danger-foreground",
- )}
- >
- {action.title}
- </Text>
- {action.subtitle ? (
- <Text className="text-xs leading-snug text-foreground-muted">
- {action.subtitle}
- </Text>
- ) : null}
- </View>
- {hasSubmenu ? (
- <SymbolView
- name="chevron.right"
- size={13}
- tintColorClassName={"accent-icon-subtle"}
- type="monochrome"
- />
- ) : action.state === "on" ? (
- <SymbolView
- name="checkmark"
- size={15}
- tintColorClassName={"accent-icon"}
- type="monochrome"
- />
- ) : action.image ? (
- <SymbolView
- name={action.image as AppSymbolName}
- size={15}
- tintColorClassName={
- destructive ? "accent-danger-foreground" : "accent-icon"
- }
- type="monochrome"
- />
- ) : null}
- </Pressable>
- );
- })}
+ <MaterialMenuPopup
+ inline
+ anchor={local}
+ actions={levelActions}
+ title={props.title}
+ parent={parent}
+ onPress={onPressItem}
+ onBack={() => setPath((current) => current.slice(0, -1))}
+ onClose={close}
+ />
</ScrollView>
</Animated.View>
)}
diff --git a/apps/mobile/src/components/AndroidScreenHeader.tsx b/apps/mobile/src/components/AndroidScreenHeader.tsx
index f397c18a0a8..2695eee5f01 100644
--- a/apps/mobile/src/components/AndroidScreenHeader.tsx
+++ b/apps/mobile/src/components/AndroidScreenHeader.tsx
@@ -1,16 +1,21 @@
-import type { ReactNode } from "react";
-import { Pressable, View } from "react-native";
+import { useState, type ReactNode } from "react";
+import { View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
-import { SymbolView, type AppSymbolName } from "./AppSymbol";
+import type { AppSymbolName } from "./AppSymbol";
import { AppText as Text } from "./AppText";
import { cn } from "../lib/cn";
+import { MaterialIconButton } from "./MaterialIconButton";
+import { AndroidAnchoredMenu } from "./AndroidAnchoredMenu";
+import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole";
+import { useMaterialToolbarHeight } from "./useMaterialToolbarHeight";
export interface AndroidHeaderAction {
readonly accessibilityLabel: string;
readonly icon: AppSymbolName;
readonly onPress: () => void;
readonly disabled?: boolean;
+ readonly selected?: boolean;
}
export function AndroidHeaderIconButton(props: {
@@ -18,73 +23,62 @@ export function AndroidHeaderIconButton(props: {
readonly icon: AppSymbolName;
readonly onPress?: () => void;
readonly disabled?: boolean;
+ readonly selected?: boolean;
}) {
- return (
- <Pressable
- accessibilityLabel={props.accessibilityLabel}
- accessibilityRole="button"
- disabled={props.disabled}
- hitSlop={8}
- onPress={props.onPress}
- className={cn(
- "size-11 items-center justify-center rounded-full bg-subtle",
- props.disabled && "opacity-55",
- )}
- >
- <SymbolView
- name={props.icon}
- size={20}
- tintColorClassName={props.disabled ? "accent-icon-subtle" : "accent-foreground"}
- type="monochrome"
- />
- </Pressable>
- );
+ return <MaterialIconButton {...props} variant={props.selected ? "tonal" : "standard"} />;
}
export function AndroidScreenHeader(props: {
readonly title: string;
readonly subtitle?: string | null;
readonly actions?: ReadonlyArray<AndroidHeaderAction>;
+ readonly leading?: ReactNode;
readonly trailing?: ReactNode;
readonly onBack?: () => void;
readonly embedded?: boolean;
readonly hideBottomBorder?: boolean;
}) {
const insets = useSafeAreaInsets();
+ const titleTypography = useScaledTextRole("title");
+ const subtitleTypography = useScaledTextRole("label");
+ const materialToolbarHeight = useMaterialToolbarHeight();
+ const [headerWidth, setHeaderWidth] = useState(0);
+ const actions = props.actions ?? [];
+ const directCount = actions.length > 2 ? (headerWidth >= 600 ? 3 : 1) : actions.length;
+ const visibleActions = actions.slice(0, directCount);
+ const overflowActions = actions.slice(directCount);
return (
<View
- className="border-b border-header-border bg-header px-3 pb-2.5"
+ onLayout={(event) => setHeaderWidth(event.nativeEvent.layout.width)}
+ className="border-b border-header-border bg-header px-2 pb-2"
style={{
paddingTop: props.embedded ? 8 : Math.max(insets.top, 12),
borderBottomWidth: props.hideBottomBorder ? 0 : undefined,
}}
>
- <View className="min-h-12 flex-row items-center gap-2">
+ <View
+ style={{ minHeight: materialToolbarHeight }}
+ className="min-h-14 flex-row items-center gap-1"
+ >
{props.onBack ? (
- <Pressable
+ <MaterialIconButton
accessibilityLabel="Navigate up"
- accessibilityRole="button"
- hitSlop={8}
+ icon="arrow.left"
onPress={props.onBack}
- className="-mr-2 size-11 items-center justify-center"
- >
- <SymbolView
- name="chevron.left"
- size={24}
- tintColorClassName={"accent-foreground"}
- type="monochrome"
- />
- </Pressable>
+ />
) : null}
+ {props.leading}
+
<View className={cn("min-w-0 flex-1", !props.onBack && "pl-1")}>
- <Text numberOfLines={1} className="text-lg font-t3-bold text-foreground">
+ <Text numberOfLines={1} style={titleTypography} className="text-foreground">
{props.title}
</Text>
{props.subtitle ? (
<Text
numberOfLines={1}
+ style={subtitleTypography}
className="mt-px text-[13px] font-t3-medium text-foreground-muted"
>
{props.subtitle}
@@ -92,15 +86,39 @@ export function AndroidScreenHeader(props: {
) : null}
</View>
- {props.actions?.map((action) => (
+ {visibleActions.map((action) => (
<AndroidHeaderIconButton
key={action.accessibilityLabel}
accessibilityLabel={action.accessibilityLabel}
disabled={action.disabled}
+ selected={action.selected}
icon={action.icon}
onPress={action.onPress}
/>
))}
+ {overflowActions.length > 0 ? (
+ <AndroidAnchoredMenu
+ actions={overflowActions.map((action, index) => ({
+ id: String(index),
+ title: action.accessibilityLabel,
+ attributes: {
+ disabled: Boolean(action.disabled),
+ state: action.selected ? "on" : undefined,
+ },
+ }))}
+ onPressAction={({ nativeEvent }) =>
+ overflowActions[Number(nativeEvent.event)]?.onPress()
+ }
+ >
+ {(open) => (
+ <MaterialIconButton
+ accessibilityLabel="More actions"
+ icon="ellipsis"
+ onPress={open}
+ />
+ )}
+ </AndroidAnchoredMenu>
+ ) : null}
{props.trailing}
</View>
</View>
diff --git a/apps/mobile/src/components/AppSymbol.tsx b/apps/mobile/src/components/AppSymbol.tsx
index e5d0137ee40..f3ad961ce84 100644
--- a/apps/mobile/src/components/AppSymbol.tsx
+++ b/apps/mobile/src/components/AppSymbol.tsx
@@ -9,6 +9,7 @@ import IconAlertTriangle from "@tabler/icons-react-native/IconAlertTriangle";
import IconApps from "@tabler/icons-react-native/IconApps";
import IconArchive from "@tabler/icons-react-native/IconArchive";
import IconArrowBackUp from "@tabler/icons-react-native/IconArrowBackUp";
+import IconArrowLeft from "@tabler/icons-react-native/IconArrowLeft";
import IconArrowDownCircle from "@tabler/icons-react-native/IconArrowDownCircle";
import IconArrowRightCircle from "@tabler/icons-react-native/IconArrowRightCircle";
import IconArrowUp from "@tabler/icons-react-native/IconArrowUp";
@@ -36,8 +37,10 @@ import IconClock from "@tabler/icons-react-native/IconClock";
import IconCode from "@tabler/icons-react-native/IconCode";
import IconCopy from "@tabler/icons-react-native/IconCopy";
import IconDeviceDesktop from "@tabler/icons-react-native/IconDeviceDesktop";
+import IconDatabase from "@tabler/icons-react-native/IconDatabase";
import IconDeviceLaptop from "@tabler/icons-react-native/IconDeviceLaptop";
import IconDots from "@tabler/icons-react-native/IconDots";
+import IconDotsVertical from "@tabler/icons-react-native/IconDotsVertical";
import IconDotsCircleHorizontal from "@tabler/icons-react-native/IconDotsCircleHorizontal";
import IconEdit from "@tabler/icons-react-native/IconEdit";
import IconExternalLink from "@tabler/icons-react-native/IconExternalLink";
@@ -97,6 +100,7 @@ import { withUniwind } from "uniwind";
const ANDROID_ICON_BY_SF_SYMBOL: Partial<Record<SFSymbol, Icon>> = {
"arrow.branch": IconGitBranch,
+ "arrow.left": IconArrowLeft,
"arrow.clockwise": IconRefresh,
"arrow.down.circle": IconArrowDownCircle,
"arrow.right.circle": IconArrowRightCircle,
@@ -142,7 +146,10 @@ const ANDROID_ICON_BY_SF_SYMBOL: Partial<Record<SFSymbol, Icon>> = {
"folder.badge.plus": IconFolderPlus,
"folder.fill": IconFolder,
gearshape: IconSettings,
+ hammer: IconHammer,
"info.circle": IconInfoCircle,
+ internaldrive: IconDatabase,
+ keyboard: IconKeyboard,
laptopcomputer: IconDeviceLaptop,
link: IconLink,
"line.3.horizontal": IconMenu2,
@@ -160,6 +167,7 @@ const ANDROID_ICON_BY_SF_SYMBOL: Partial<Record<SFSymbol, Icon>> = {
"pin.slash": IconPinnedOff,
play: IconPlayerPlay,
plus: IconPlus,
+ minus: IconMinus,
"qrcode.viewfinder": IconQrcode,
"point.3.connected.trianglepath.dotted": IconNetwork,
"point.topleft.down.curvedto.point.bottomright.up": IconGitMerge,
@@ -209,6 +217,7 @@ const ANDROID_ICON_BY_MATERIAL_NAME: Record<string, Icon> = {
keyboard_arrow_down: IconChevronDown,
keyboard_arrow_up: IconChevronUp,
keyboard_hide: IconKeyboardHide,
+ more_vert: IconDotsVertical,
public: IconWorld,
remove: IconMinus,
terminal: IconTerminal2,
diff --git a/apps/mobile/src/components/AppText.tsx b/apps/mobile/src/components/AppText.tsx
index 6501d204408..805cdb66a3b 100644
--- a/apps/mobile/src/components/AppText.tsx
+++ b/apps/mobile/src/components/AppText.tsx
@@ -1,4 +1,5 @@
import {
+ Platform,
Text as RNText,
TextInput as RNTextInput,
type TextInputProps as RNTextInputProps,
@@ -14,7 +15,13 @@ export type AppTextProps = RNTextProps & { readonly className?: string };
* Uses Uniwind className — no manual style parsing.
*/
export function AppText({ className, ...props }: AppTextProps) {
- return <RNText className={cn("font-sans text-foreground", className)} {...props} />;
+ return (
+ <RNText
+ className={cn("font-sans text-foreground", className)}
+ selectionColorClassName={Platform.OS === "android" ? "accent-primary/32" : undefined}
+ {...props}
+ />
+ );
}
export type AppTextInputProps = Omit<RNTextInputProps, "placeholderTextColor"> & {
@@ -35,8 +42,13 @@ export function AppTextInput({ className, ref, ...props }: AppTextInputProps) {
className,
)}
placeholderTextColorClassName="accent-placeholder"
- selectionColorClassName="accent-foreground-secondary"
- cursorColorClassName="accent-foreground-secondary"
+ selectionColorClassName={
+ Platform.OS === "android" ? "accent-primary/32" : "accent-foreground-secondary"
+ }
+ cursorColorClassName={
+ Platform.OS === "android" ? "accent-primary" : "accent-foreground-secondary"
+ }
+ selectionHandleColorClassName={Platform.OS === "android" ? "accent-primary" : undefined}
{...props}
/>
);
diff --git a/apps/mobile/src/components/ConfirmDialogHost.tsx b/apps/mobile/src/components/ConfirmDialogHost.tsx
index d7db39d39ae..aa1653055b5 100644
--- a/apps/mobile/src/components/ConfirmDialogHost.tsx
+++ b/apps/mobile/src/components/ConfirmDialogHost.tsx
@@ -1,8 +1,9 @@
import { useCallback, useEffect, useState } from "react";
-import { Modal, Pressable, TextInput, View } from "react-native";
+import { Platform, Modal, Pressable, TextInput, View } from "react-native";
import { cn } from "../lib/cn";
import { AppText } from "./AppText";
+import { MaterialConfirmDialog } from "./MaterialConfirmDialog";
export type ConfirmDialogRequest = {
readonly title: string;
@@ -67,17 +68,35 @@ export function ConfirmDialogHost() {
setPresented(null);
}, [presented]);
- const handleConfirm = useCallback(() => {
- if (presented?.kind === "confirm") {
- presented.request.onConfirm();
- } else if (presented?.kind === "text-input") {
- presented.request.onConfirm(inputValue);
- }
- setPresented(null);
- }, [inputValue, presented]);
+ const handleConfirm = useCallback(
+ (nativeInputValue?: string) => {
+ if (presented?.kind === "confirm") {
+ presented.request.onConfirm();
+ } else if (presented?.kind === "text-input") {
+ presented.request.onConfirm(nativeInputValue ?? inputValue);
+ }
+ setPresented(null);
+ },
+ [inputValue, presented],
+ );
const confirmDisabled = presented?.kind === "text-input" && inputValue.trim().length === 0;
+ if (Platform.OS === "android")
+ return presented ? (
+ <MaterialConfirmDialog
+ key={`${presented.kind}:${presented.request.title}:${presented.kind === "text-input" ? presented.request.initialValue : ""}`}
+ request={presented.request}
+ inputInitialValue={
+ presented.kind === "text-input" ? presented.request.initialValue : undefined
+ }
+ onInputChange={setInputValue}
+ confirmDisabled={confirmDisabled}
+ onCancel={handleCancel}
+ onConfirm={handleConfirm}
+ />
+ ) : null;
+
return (
<Modal
visible={presented !== null}
@@ -102,7 +121,7 @@ export function ConfirmDialogHost() {
autoFocus
className="mt-4 rounded-xl border border-border bg-screen px-3 py-2.5 text-base text-foreground"
onChangeText={setInputValue}
- onSubmitEditing={confirmDisabled ? undefined : handleConfirm}
+ onSubmitEditing={confirmDisabled ? undefined : () => handleConfirm()}
returnKeyType="done"
selectTextOnFocus
value={inputValue}
@@ -125,7 +144,7 @@ export function ConfirmDialogHost() {
accessibilityRole="button"
disabled={confirmDisabled}
className="min-h-10 items-center justify-center px-4 active:bg-subtle"
- onPress={handleConfirm}
+ onPress={() => handleConfirm()}
>
<AppText
className={cn(
diff --git a/apps/mobile/src/components/ControlPill.tsx b/apps/mobile/src/components/ControlPill.tsx
index e0936c57180..ba75beeeb55 100644
--- a/apps/mobile/src/components/ControlPill.tsx
+++ b/apps/mobile/src/components/ControlPill.tsx
@@ -19,12 +19,13 @@ import {
} from "react-native";
import { withUniwind } from "uniwind";
import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
-
import { cn } from "../lib/cn";
import { withMenuActionIconColors } from "../lib/menu-action-colors";
import { AndroidAnchoredMenu } from "./AndroidAnchoredMenu";
import { SymbolView } from "./AppSymbol";
import { AppText as Text } from "./AppText";
+import { MaterialIconButton } from "./MaterialIconButton";
+import { MaterialButton } from "./MaterialButton";
const ThemedMenuView = withUniwind(
function NativeMenuView({
@@ -121,6 +122,47 @@ export function ControlPill(props: {
: "",
);
+ if (
+ Platform.OS === "android" &&
+ (variant === "pill" || variant === "primary") &&
+ props.label &&
+ props.onPress &&
+ !props.icon &&
+ !props.iconNode &&
+ !props.className &&
+ !props.activateOnPressIn &&
+ (!props.accessibilityLabel || props.accessibilityLabel === props.label)
+ ) {
+ return (
+ <MaterialButton
+ label={props.label}
+ onPress={props.onPress}
+ disabled={props.disabled}
+ tone={variant === "primary" ? "primary" : "secondary"}
+ />
+ );
+ }
+
+ if (
+ Platform.OS === "android" &&
+ props.accessibilityLabel &&
+ props.icon &&
+ !props.iconNode &&
+ !props.label &&
+ !props.className &&
+ !props.activateOnPressIn
+ ) {
+ return (
+ <MaterialIconButton
+ accessibilityLabel={props.accessibilityLabel}
+ icon={props.icon}
+ onPress={props.onPress}
+ disabled={props.disabled}
+ variant={variant === "primary" ? "primary" : variant === "danger" ? "danger" : "tonal"}
+ />
+ );
+ }
+
return (
<Pressable
accessibilityLabel={props.accessibilityLabel ?? props.label}
@@ -146,10 +188,8 @@ export function ControlPill(props: {
);
}
-// iOS renders the native UIMenu (standard checkmark for `state: "on"`);
-// Android renders the token-styled AndroidAnchoredMenu, since the native
-// AppCompat popup can't be themed past its stock animation, metrics, and
-// submenu chrome.
+// iOS renders UIMenu; AndroidAnchoredMenu adapts the same actions to the
+// selected Android appearance and keeps editor menus above the keyboard.
export function ControlPillMenu(
props: Omit<ComponentProps<typeof MenuView>, "children" | "themeVariant"> &
Pick<AccessibilityProps, "accessible" | "accessibilityLabel" | "accessibilityRole"> & {
diff --git a/apps/mobile/src/components/EmptyState.tsx b/apps/mobile/src/components/EmptyState.tsx
index ce068bc4613..5fb4ce08f2f 100644
--- a/apps/mobile/src/components/EmptyState.tsx
+++ b/apps/mobile/src/components/EmptyState.tsx
@@ -1,4 +1,5 @@
import { Pressable, View } from "react-native";
+import type { ReactNode } from "react";
import { AppText as Text } from "./AppText";
@@ -7,6 +8,7 @@ export function EmptyState(props: {
readonly detail: string;
readonly actionLabel?: string;
readonly onAction?: () => void;
+ readonly action?: ReactNode;
readonly variant?: "card" | "plain";
}) {
if (props.variant === "plain") {
@@ -16,7 +18,9 @@ export function EmptyState(props: {
<Text className="mt-2 text-center font-sans text-base leading-normal text-foreground-muted">
{props.detail}
</Text>
- {props.actionLabel && props.onAction ? (
+ {props.action ? (
+ <View className="mt-5">{props.action}</View>
+ ) : props.actionLabel && props.onAction ? (
<Pressable
className="mt-5 rounded-full bg-primary px-5 py-3 active:opacity-70"
onPress={props.onAction}
@@ -36,7 +40,9 @@ export function EmptyState(props: {
<Text className="mt-2 font-sans text-sm leading-relaxed text-foreground-muted">
{props.detail}
</Text>
- {props.actionLabel && props.onAction ? (
+ {props.action ? (
+ <View className="mt-4 self-start">{props.action}</View>
+ ) : props.actionLabel && props.onAction ? (
<Pressable
className="mt-4 self-start rounded-full bg-primary px-4 py-2.5 active:opacity-70"
onPress={props.onAction}
diff --git a/apps/mobile/src/components/GlassBackdrop.tsx b/apps/mobile/src/components/GlassBackdrop.tsx
index f18ee7908db..27104f535dc 100644
--- a/apps/mobile/src/components/GlassBackdrop.tsx
+++ b/apps/mobile/src/components/GlassBackdrop.tsx
@@ -1,22 +1,13 @@
import { BlurView } from "expo-blur";
-import { useContext, type RefObject } from "react";
import { Platform, StyleSheet, View, type ColorValue } from "react-native";
import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
-import { GlassBlurTargetContext } from "../lib/glassBlurTarget";
import { themeColorWithAlpha } from "../lib/mobileTheme";
/** Frosted backdrop for containers that clip their children to their shape. */
-export function GlassBackdrop(props: {
- readonly fallbackColor?: ColorValue;
- readonly blurTarget?: RefObject<View | null>;
-}) {
+export function GlassBackdrop(props: { readonly fallbackColor?: ColorValue }) {
const { themeAppearance } = useAppearancePreferences();
- const inheritedBlurTarget = useContext(GlassBlurTargetContext);
- const target = props.blurTarget ?? inheritedBlurTarget;
- const supportsBlur =
- Platform.OS === "ios" ||
- (Platform.OS === "android" && Platform.Version >= 31 && target !== undefined);
+ const supportsBlur = Platform.OS === "ios";
const colorStyle =
props.fallbackColor === undefined
? undefined
@@ -24,17 +15,9 @@ export function GlassBackdrop(props: {
return (
<>
- {/* Android samples a separate target. An opaque backing prevents any
- transparent pixels in that sample from exposing the unblurred feed.
- iOS samples its actual backdrop, so a backing there would hide it. */}
- {Platform.OS === "android" ? (
- <View pointerEvents="none" className="absolute inset-0 bg-card" style={colorStyle} />
- ) : null}
{supportsBlur ? (
<BlurView
pointerEvents="none"
- blurTarget={target}
- blurMethod="dimezisBlurViewSdk31Plus"
intensity={80}
tint={themeAppearance === "dark" ? "dark" : "default"}
style={StyleSheet.absoluteFill}
diff --git a/apps/mobile/src/components/GlassSurface.tsx b/apps/mobile/src/components/GlassSurface.tsx
index 014a760588a..bfbfff2c66c 100644
--- a/apps/mobile/src/components/GlassSurface.tsx
+++ b/apps/mobile/src/components/GlassSurface.tsx
@@ -1,5 +1,5 @@
import { GlassView, isGlassEffectAPIAvailable } from "expo-glass-effect";
-import type { ReactNode, Ref, RefObject } from "react";
+import type { ReactNode, Ref } from "react";
import {
Platform,
useColorScheme,
@@ -28,7 +28,6 @@ interface GlassSurfaceProps extends ViewProps {
readonly chrome?: "default" | "none";
/** Base color for the frosted tint, or solid fill when blur is unavailable. */
readonly fallbackColor?: ColorValue;
- readonly blurTarget?: RefObject<View | null>;
/** Uniwind styling used only when native Liquid Glass is unavailable. */
readonly fallbackClassName?: string;
}
@@ -41,7 +40,6 @@ export function GlassSurface({
tintColor,
tintColorClassName,
fallbackColor,
- blurTarget,
fallbackClassName,
className,
style,
@@ -49,23 +47,15 @@ export function GlassSurface({
}: GlassSurfaceProps) {
const isDarkMode = useColorScheme() === "dark";
const supportsGlass = Platform.OS === "ios" && isGlassEffectAPIAvailable();
+ const hasShadow = chrome !== "none" && Platform.OS !== "android";
const surfaceStyle: ViewStyle = {
borderRadius: 32,
overflow: "hidden",
- shadowColor: chrome === "none" ? "transparent" : "#000000",
- shadowOpacity: chrome === "none" ? 0 : isDarkMode ? 0.22 : 0.08,
- shadowRadius: chrome === "none" ? 0 : 28,
- shadowOffset:
- chrome === "none"
- ? {
- width: 0,
- height: 0,
- }
- : {
- width: 0,
- height: 14,
- },
- elevation: chrome === "none" ? 0 : 12,
+ shadowColor: hasShadow ? "#000000" : "transparent",
+ shadowOpacity: hasShadow ? (isDarkMode ? 0.22 : 0.08) : 0,
+ shadowRadius: hasShadow ? 28 : 0,
+ shadowOffset: { width: 0, height: hasShadow ? 14 : 0 },
+ elevation: hasShadow ? 12 : 0,
};
if (supportsGlass) {
@@ -103,7 +93,7 @@ export function GlassSurface({
)}
style={[surfaceStyle, style]}
>
- <GlassBackdrop blurTarget={blurTarget} fallbackColor={fallbackColor} />
+ <GlassBackdrop fallbackColor={fallbackColor} />
{children}
</View>
);
diff --git a/apps/mobile/src/components/MaterialButton.android.tsx b/apps/mobile/src/components/MaterialButton.android.tsx
new file mode 100644
index 00000000000..b5a8417fc79
--- /dev/null
+++ b/apps/mobile/src/components/MaterialButton.android.tsx
@@ -0,0 +1,94 @@
+import {
+ Box,
+ Button,
+ CircularProgressIndicator,
+ FilledTonalButton,
+ Host,
+ Row,
+ Text,
+ TextButton,
+} from "@expo/ui/jetpack-compose";
+import { defaultMinSize, fillMaxWidth, size } from "@expo/ui/jetpack-compose/modifiers";
+import { View } from "react-native";
+
+import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
+import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole";
+import type { MaterialButtonProps } from "./MaterialButton";
+
+export function MaterialButton(props: MaterialButtonProps) {
+ const { themeAppearance, themeVariables: colors } = useAppearancePreferences();
+ const typography = useScaledTextRole("footnote");
+ const tone = props.tone ?? "secondary";
+ const Component =
+ tone === "text" ? TextButton : tone === "secondary" ? FilledTonalButton : Button;
+ const containerColor =
+ tone === "primary"
+ ? colors["--color-primary"]
+ : tone === "danger"
+ ? colors["--color-danger"]
+ : tone === "text"
+ ? "#00000000"
+ : colors["--color-secondary"];
+ const contentColor =
+ tone === "primary"
+ ? colors["--color-primary-foreground"]
+ : tone === "danger"
+ ? colors["--color-danger-foreground"]
+ : tone === "text"
+ ? colors["--color-primary"]
+ : colors["--color-secondary-foreground"];
+ return (
+ <View
+ accessible
+ accessibilityRole="button"
+ accessibilityLabel={props.label}
+ accessibilityState={{
+ disabled: Boolean(props.disabled || props.loading),
+ busy: Boolean(props.loading),
+ }}
+ accessibilityActions={[{ name: "activate" }]}
+ onAccessibilityAction={() => {
+ if (!props.disabled && !props.loading) props.onPress();
+ }}
+ style={props.fullWidth ? { width: "100%" } : { alignSelf: "flex-start" }}
+ >
+ <View importantForAccessibility="no-hide-descendants">
+ <Host
+ matchContents={props.fullWidth ? { vertical: true } : true}
+ colorScheme={themeAppearance}
+ ignoreSafeAreaKeyboardInsets
+ style={props.fullWidth ? { width: "100%" } : { alignSelf: "flex-start" }}
+ >
+ <Component
+ enabled={!props.disabled && !props.loading}
+ onClick={props.onPress}
+ modifiers={[
+ defaultMinSize({ minHeight: 48 }),
+ ...(props.fullWidth ? [fillMaxWidth()] : []),
+ ]}
+ colors={{
+ containerColor,
+ contentColor,
+ disabledContainerColor: colors["--color-subtle-strong"],
+ disabledContentColor: colors["--color-foreground-muted"],
+ }}
+ >
+ <Row verticalAlignment="center">
+ {props.loading ? (
+ <>
+ <CircularProgressIndicator
+ modifiers={[size(18, 18)]}
+ strokeWidth={2}
+ color={colors["--color-foreground-muted"]}
+ />
+ <Box modifiers={[size(8, 1)]} />
+ </>
+ ) : null}
+ <Text style={{ ...typography, fontWeight: "500" }}>{props.label}</Text>
+ </Row>
+ </Component>
+ </Host>
+ </View>
+ </View>
+ );
+}
diff --git a/apps/mobile/src/components/MaterialButton.tsx b/apps/mobile/src/components/MaterialButton.tsx
new file mode 100644
index 00000000000..f0ad4cb8f55
--- /dev/null
+++ b/apps/mobile/src/components/MaterialButton.tsx
@@ -0,0 +1,24 @@
+import { Pressable } from "react-native";
+import { AppText } from "./AppText";
+
+export interface MaterialButtonProps {
+ readonly label: string;
+ readonly onPress: () => void;
+ readonly disabled?: boolean;
+ readonly loading?: boolean;
+ readonly tone?: "primary" | "secondary" | "danger" | "text";
+ readonly fullWidth?: boolean;
+}
+
+export function MaterialButton(props: MaterialButtonProps) {
+ return (
+ <Pressable
+ accessibilityRole="button"
+ disabled={props.disabled}
+ onPress={props.onPress}
+ className="min-h-12 justify-center rounded-full bg-secondary px-6"
+ >
+ <AppText>{props.label}</AppText>
+ </Pressable>
+ );
+}
diff --git a/apps/mobile/src/components/MaterialConfirmDialog.android.tsx b/apps/mobile/src/components/MaterialConfirmDialog.android.tsx
new file mode 100644
index 00000000000..3e65d7185ec
--- /dev/null
+++ b/apps/mobile/src/components/MaterialConfirmDialog.android.tsx
@@ -0,0 +1,96 @@
+import {
+ AlertDialog,
+ Host,
+ OutlinedTextField,
+ Text,
+ TextButton,
+ useNativeState,
+} from "@expo/ui/jetpack-compose";
+
+import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
+import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole";
+import type { MaterialConfirmDialogProps } from "./MaterialConfirmDialog";
+
+export function MaterialConfirmDialog(props: MaterialConfirmDialogProps) {
+ const { themeAppearance, themeVariables: colors } = useAppearancePreferences();
+ const titleTypography = useScaledTextRole("title");
+ const bodyTypography = useScaledTextRole("footnote");
+ const inputTypography = useScaledTextRole("body");
+ const inputState = useNativeState(props.inputInitialValue ?? "");
+ const inputSelection = useNativeState({ start: 0, end: props.inputInitialValue?.length ?? 0 });
+ const confirm = () => {
+ if (props.confirmDisabled) return;
+ const value = props.inputInitialValue === undefined ? undefined : inputState.get();
+ if (value !== undefined && !value.trim()) return;
+ props.onConfirm(value);
+ };
+ return (
+ <Host
+ colorScheme={themeAppearance}
+ ignoreSafeAreaKeyboardInsets
+ style={{ height: 0, width: 0 }}
+ >
+ <AlertDialog
+ onDismissRequest={props.onCancel}
+ tonalElevation={0}
+ colors={{
+ containerColor: colors["--color-card-alt"],
+ titleContentColor: colors["--color-foreground"],
+ textContentColor: colors["--color-foreground-secondary"],
+ }}
+ >
+ <AlertDialog.Title>
+ <Text style={titleTypography}>{props.request.title}</Text>
+ </AlertDialog.Title>
+ {props.inputInitialValue !== undefined ? (
+ <AlertDialog.Text>
+ <OutlinedTextField
+ autoFocus
+ singleLine
+ value={inputState}
+ selection={inputSelection}
+ onValueChange={props.onInputChange}
+ textStyle={inputTypography}
+ keyboardOptions={{ imeAction: "done" }}
+ keyboardActions={{
+ onDone: confirm,
+ }}
+ colors={{
+ focusedTextColor: colors["--color-foreground"],
+ unfocusedTextColor: colors["--color-foreground"],
+ focusedIndicatorColor: colors["--color-primary"],
+ unfocusedIndicatorColor: colors["--color-border"],
+ cursorColor: colors["--color-primary"],
+ }}
+ >
+ <OutlinedTextField.Label>
+ <Text style={bodyTypography}>{props.request.title}</Text>
+ </OutlinedTextField.Label>
+ </OutlinedTextField>
+ </AlertDialog.Text>
+ ) : props.request.message ? (
+ <AlertDialog.Text>
+ <Text style={bodyTypography}>{props.request.message}</Text>
+ </AlertDialog.Text>
+ ) : null}
+ <AlertDialog.DismissButton>
+ <TextButton onClick={props.onCancel} colors={{ contentColor: colors["--color-primary"] }}>
+ <Text style={bodyTypography}>{props.request.cancelText ?? "Cancel"}</Text>
+ </TextButton>
+ </AlertDialog.DismissButton>
+ <AlertDialog.ConfirmButton>
+ <TextButton
+ onClick={confirm}
+ enabled={!props.confirmDisabled}
+ colors={{
+ contentColor:
+ colors[props.request.destructive ? "--color-danger" : "--color-primary"],
+ }}
+ >
+ <Text style={bodyTypography}>{props.request.confirmText}</Text>
+ </TextButton>
+ </AlertDialog.ConfirmButton>
+ </AlertDialog>
+ </Host>
+ );
+}
diff --git a/apps/mobile/src/components/MaterialConfirmDialog.tsx b/apps/mobile/src/components/MaterialConfirmDialog.tsx
new file mode 100644
index 00000000000..c21ad042c39
--- /dev/null
+++ b/apps/mobile/src/components/MaterialConfirmDialog.tsx
@@ -0,0 +1,17 @@
+import type { ConfirmDialogRequest } from "./ConfirmDialogHost";
+
+export interface MaterialConfirmDialogProps {
+ readonly request: Pick<
+ ConfirmDialogRequest,
+ "title" | "message" | "cancelText" | "confirmText" | "destructive"
+ >;
+ readonly inputInitialValue?: string;
+ readonly onInputChange?: (value: string) => void;
+ readonly confirmDisabled?: boolean;
+ readonly onCancel: () => void;
+ readonly onConfirm: (inputValue?: string) => void;
+}
+
+export function MaterialConfirmDialog(_props: MaterialConfirmDialogProps) {
+ return null;
+}
diff --git a/apps/mobile/src/components/MaterialFloatingActionButton.android.tsx b/apps/mobile/src/components/MaterialFloatingActionButton.android.tsx
new file mode 100644
index 00000000000..3978712683c
--- /dev/null
+++ b/apps/mobile/src/components/MaterialFloatingActionButton.android.tsx
@@ -0,0 +1,86 @@
+import {
+ Box,
+ ExtendedFloatingActionButton,
+ FloatingActionButton,
+ Host,
+ LargeFloatingActionButton,
+ Text,
+} from "@expo/ui/jetpack-compose";
+import { size } from "@expo/ui/jetpack-compose/modifiers";
+import { View, type StyleProp, type ViewStyle } from "react-native";
+import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
+import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole";
+import { SymbolView, type AppSymbolName } from "./AppSymbol";
+
+export function MaterialFloatingActionButton(props: {
+ readonly onPress: () => void;
+ readonly label: string;
+ readonly icon: AppSymbolName;
+ readonly variant?: "extended" | "large";
+ readonly expanded?: boolean;
+ readonly tone?: "primary" | "secondary";
+ readonly className?: string;
+ readonly style?: StyleProp<ViewStyle>;
+}) {
+ const { themeAppearance, themeVariables: colors } = useAppearancePreferences();
+ const typography = useScaledTextRole("footnote");
+ const primary = props.tone === "primary";
+ const containerColor = colors[primary ? "--color-primary" : "--color-thread-selected"];
+ const contentColor =
+ colors[primary ? "--color-primary-foreground" : "--color-thread-selected-foreground"];
+ const Component =
+ props.variant === "extended"
+ ? ExtendedFloatingActionButton
+ : props.variant === "large"
+ ? LargeFloatingActionButton
+ : FloatingActionButton;
+ const iconSize = props.variant === "large" ? 36 : 24;
+ return (
+ <View
+ accessible
+ accessibilityRole="button"
+ accessibilityLabel={props.label}
+ accessibilityActions={[{ name: "activate" }]}
+ onAccessibilityAction={props.onPress}
+ className={props.className}
+ style={props.style}
+ >
+ <View importantForAccessibility="no-hide-descendants">
+ <Host matchContents colorScheme={themeAppearance} ignoreSafeAreaKeyboardInsets>
+ <Component
+ containerColor={containerColor}
+ onClick={props.onPress}
+ expanded={props.expanded}
+ >
+ <Component.Icon>
+ <Box modifiers={[size(iconSize, iconSize)]} />
+ </Component.Icon>
+ {props.variant === "extended" ? (
+ <ExtendedFloatingActionButton.Text>
+ <Text color={contentColor} style={{ ...typography, fontWeight: "500" }}>
+ {props.label}
+ </Text>
+ </ExtendedFloatingActionButton.Text>
+ ) : null}
+ </Component>
+ </Host>
+ </View>
+ {/* The RN icon stays outside Compose so it cannot intercept native button taps. */}
+ <View
+ pointerEvents="none"
+ className="absolute inset-y-0 justify-center"
+ style={
+ props.variant === "extended" ? { left: 16 } : { left: 0, right: 0, alignItems: "center" }
+ }
+ >
+ <SymbolView
+ name={props.icon}
+ size={iconSize}
+ tintColorClassName={
+ primary ? "accent-primary-foreground" : "accent-thread-selected-foreground"
+ }
+ />
+ </View>
+ </View>
+ );
+}
diff --git a/apps/mobile/src/components/MaterialFloatingActionButton.tsx b/apps/mobile/src/components/MaterialFloatingActionButton.tsx
new file mode 100644
index 00000000000..eeed5fd1d13
--- /dev/null
+++ b/apps/mobile/src/components/MaterialFloatingActionButton.tsx
@@ -0,0 +1,46 @@
+import type { ComponentProps } from "react";
+import { Pressable } from "react-native";
+import type { MaterialFloatingActionButton as AndroidMaterialFloatingActionButton } from "./MaterialFloatingActionButton.android";
+import { AppText } from "./AppText";
+import { SymbolView } from "./AppSymbol";
+import { cn } from "../lib/cn";
+
+export function MaterialFloatingActionButton(
+ props: ComponentProps<typeof AndroidMaterialFloatingActionButton>,
+) {
+ return (
+ <Pressable
+ accessibilityRole="button"
+ accessibilityLabel={props.label}
+ onPress={props.onPress}
+ className={cn(
+ "min-h-14 min-w-14 flex-row items-center justify-center gap-2 rounded-2xl px-4",
+ props.tone === "primary" ? "bg-primary" : "bg-thread-selected",
+ props.className,
+ )}
+ style={props.style}
+ >
+ <SymbolView
+ name={props.icon}
+ size={24}
+ tintColorClassName={
+ props.tone === "primary"
+ ? "accent-primary-foreground"
+ : "accent-thread-selected-foreground"
+ }
+ />
+ {props.variant === "extended" && props.expanded !== false ? (
+ <AppText
+ className={cn(
+ "text-sm",
+ props.tone === "primary"
+ ? "text-primary-foreground"
+ : "text-thread-selected-foreground",
+ )}
+ >
+ {props.label}
+ </AppText>
+ ) : null}
+ </Pressable>
+ );
+}
diff --git a/apps/mobile/src/components/MaterialIconButton.android.tsx b/apps/mobile/src/components/MaterialIconButton.android.tsx
new file mode 100644
index 00000000000..9cc6f5dc6ce
--- /dev/null
+++ b/apps/mobile/src/components/MaterialIconButton.android.tsx
@@ -0,0 +1,87 @@
+import {
+ FilledIconButton,
+ FilledTonalIconButton,
+ Host,
+ IconButton,
+} from "@expo/ui/jetpack-compose";
+import { size } from "@expo/ui/jetpack-compose/modifiers";
+import { View } from "react-native";
+
+import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
+import { SymbolView, type AppSymbolName } from "./AppSymbol";
+
+export function MaterialIconButton(props: {
+ readonly accessibilityLabel: string;
+ readonly icon: AppSymbolName;
+ readonly onPress?: () => void;
+ readonly disabled?: boolean;
+ readonly selected?: boolean;
+ readonly variant?: "standard" | "primary" | "tonal" | "danger";
+}) {
+ const { themeAppearance, themeVariables: colors } = useAppearancePreferences();
+ const variant = props.variant ?? "standard";
+ const Component =
+ variant === "standard"
+ ? IconButton
+ : variant === "tonal"
+ ? FilledTonalIconButton
+ : FilledIconButton;
+ const containerColor =
+ variant === "primary"
+ ? colors["--color-primary"]
+ : variant === "danger"
+ ? colors["--color-danger"]
+ : colors["--color-secondary"];
+ const iconTint = props.disabled
+ ? "accent-icon-subtle"
+ : variant === "primary"
+ ? "accent-primary-foreground"
+ : variant === "danger"
+ ? "accent-danger-foreground"
+ : variant === "tonal"
+ ? "accent-secondary-foreground"
+ : "accent-foreground";
+ return (
+ <View
+ accessible
+ accessibilityLabel={props.accessibilityLabel}
+ accessibilityRole="button"
+ accessibilityState={{ disabled: Boolean(props.disabled), selected: props.selected }}
+ accessibilityActions={[{ name: "activate" }]}
+ onAccessibilityAction={() => {
+ if (!props.disabled) props.onPress?.();
+ }}
+ style={{ width: 48, height: 48 }}
+ >
+ <View importantForAccessibility="no-hide-descendants">
+ <Host
+ colorScheme={themeAppearance}
+ ignoreSafeAreaKeyboardInsets
+ style={{ width: 48, height: 48 }}
+ >
+ <Component
+ onClick={props.onPress}
+ enabled={!props.disabled}
+ modifiers={[size(48, 48)]}
+ colors={
+ variant === "standard"
+ ? undefined
+ : { containerColor, disabledContainerColor: colors["--color-subtle-strong"] }
+ }
+ >
+ {null}
+ </Component>
+ </Host>
+ </View>
+ {/* Keep RN SVG measurement outside Compose; the native button owns touch and ripple. */}
+ <View pointerEvents="none" className="absolute inset-0 items-center justify-center">
+ <SymbolView
+ name={props.icon === "ellipsis" ? { ios: "ellipsis", android: "more_vert" } : props.icon}
+ size={24}
+ tintColorClassName={iconTint}
+ type="monochrome"
+ />
+ </View>
+ </View>
+ );
+}
diff --git a/apps/mobile/src/components/MaterialIconButton.tsx b/apps/mobile/src/components/MaterialIconButton.tsx
new file mode 100644
index 00000000000..852889140ad
--- /dev/null
+++ b/apps/mobile/src/components/MaterialIconButton.tsx
@@ -0,0 +1,23 @@
+import { Pressable } from "react-native";
+
+import { SymbolView, type AppSymbolName } from "./AppSymbol";
+
+export function MaterialIconButton(props: {
+ readonly accessibilityLabel: string;
+ readonly icon: AppSymbolName;
+ readonly onPress?: () => void;
+ readonly disabled?: boolean;
+ readonly selected?: boolean;
+ readonly variant?: "standard" | "primary" | "tonal" | "danger";
+}) {
+ return (
+ <Pressable
+ {...props}
+ accessibilityRole="button"
+ accessibilityState={{ disabled: Boolean(props.disabled), selected: props.selected }}
+ className="size-12 items-center justify-center"
+ >
+ <SymbolView name={props.icon} size={24} tintColorClassName="accent-foreground" />
+ </Pressable>
+ );
+}
diff --git a/apps/mobile/src/components/MaterialListRow.tsx b/apps/mobile/src/components/MaterialListRow.tsx
new file mode 100644
index 00000000000..31d6f7a6ffd
--- /dev/null
+++ b/apps/mobile/src/components/MaterialListRow.tsx
@@ -0,0 +1,57 @@
+import type { ComponentProps, ReactNode } from "react";
+import { Platform, Pressable, View } from "react-native";
+
+import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
+import { cn } from "../lib/cn";
+import { AppText } from "./AppText";
+import { SymbolView } from "./AppSymbol";
+
+/** Shared geometry for Material navigation and selection lists. Group rows in one card. */
+export function MaterialListRow({
+ title,
+ subtitle,
+ leading,
+ trailing,
+ className,
+ ...props
+}: Omit<ComponentProps<typeof Pressable>, "children"> & {
+ readonly title: string;
+ readonly subtitle?: string | null;
+ readonly leading?: ReactNode;
+ readonly trailing?: ReactNode;
+}) {
+ const { themeVariables } = useAppearancePreferences();
+ return (
+ <Pressable
+ accessibilityRole="button"
+ accessibilityLabel={[title, subtitle].filter(Boolean).join(", ")}
+ android_ripple={{ color: themeVariables["--color-subtle-strong"] }}
+ // Give the scroll view time to claim drags before starting the ripple.
+ unstable_pressDelay={Platform.OS === "android" ? 50 : undefined}
+ {...props}
+ className={cn(
+ "flex-row items-center gap-4 overflow-hidden bg-card px-4 py-3",
+ subtitle ? "min-h-18" : "min-h-14",
+ props.disabled && "opacity-45",
+ className,
+ )}
+ >
+ {leading ? <View className="size-6 items-center justify-center">{leading}</View> : null}
+ <View className="min-w-0 flex-1 gap-1">
+ <AppText className="text-base text-foreground" numberOfLines={2}>
+ {title}
+ </AppText>
+ {subtitle ? (
+ <AppText className="text-sm text-foreground-muted" numberOfLines={2}>
+ {subtitle}
+ </AppText>
+ ) : null}
+ </View>
+ {trailing !== undefined ? (
+ trailing
+ ) : !props.disabled ? (
+ <SymbolView name="chevron.right" size={16} tintColorClassName="accent-chevron" />
+ ) : null}
+ </Pressable>
+ );
+}
diff --git a/apps/mobile/src/components/MaterialMenuPopup.android.tsx b/apps/mobile/src/components/MaterialMenuPopup.android.tsx
new file mode 100644
index 00000000000..87b467af967
--- /dev/null
+++ b/apps/mobile/src/components/MaterialMenuPopup.android.tsx
@@ -0,0 +1,153 @@
+import {
+ Box,
+ Column,
+ DropdownMenu,
+ DropdownMenuItem,
+ Host,
+ RNHostView,
+ Text,
+} from "@expo/ui/jetpack-compose";
+import { padding, size, width } from "@expo/ui/jetpack-compose/modifiers";
+import { View } from "react-native";
+
+import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
+import type { MaterialMenuPopupProps } from "./MaterialMenuPopup";
+import { SymbolView, type AppSymbolName } from "./AppSymbol";
+
+function MenuIcon(props: {
+ readonly name: AppSymbolName;
+ readonly destructive?: boolean;
+ readonly disabled?: boolean;
+}) {
+ return (
+ <RNHostView matchContents modifiers={[size(24, 24)]}>
+ <View style={{ width: 24, height: 24 }} importantForAccessibility="no-hide-descendants">
+ <SymbolView
+ name={props.name}
+ size={24}
+ type="monochrome"
+ tintColorClassName={
+ props.disabled
+ ? "accent-icon-subtle"
+ : props.destructive
+ ? "accent-danger-foreground"
+ : "accent-foreground"
+ }
+ />
+ </View>
+ </RNHostView>
+ );
+}
+
+/** Native popup positioned at the original trigger, outside virtualized rows. */
+export function MaterialMenuPopup(props: MaterialMenuPopupProps) {
+ const { themeAppearance, themeVariables: colors } = useAppearancePreferences();
+ const foreground = colors["--color-foreground"];
+ const muted = colors["--color-foreground-muted"];
+ const items = (
+ <>
+ {props.parent ? (
+ <DropdownMenuItem onClick={props.onBack} modifiers={[width(250)]}>
+ <DropdownMenuItem.LeadingIcon>
+ <MenuIcon name="arrow.left" />
+ </DropdownMenuItem.LeadingIcon>
+ <DropdownMenuItem.Text>
+ <Text color={foreground} style={{ typography: "bodyLarge" }}>
+ {props.parent.title}
+ </Text>
+ </DropdownMenuItem.Text>
+ </DropdownMenuItem>
+ ) : props.title ? (
+ <Text color={muted} style={{ typography: "bodySmall" }} modifiers={[padding(16, 8, 16, 8)]}>
+ {props.title}
+ </Text>
+ ) : null}
+ {props.actions.map((action, index) => (
+ <DropdownMenuItem
+ key={action.id ?? `${index}-${action.title}`}
+ enabled={!action.attributes?.disabled}
+ modifiers={[width(250)]}
+ elementColors={{
+ textColor: action.attributes?.destructive
+ ? colors["--color-danger-foreground"]
+ : foreground,
+ disabledTextColor: muted,
+ }}
+ onClick={() => props.onPress(action)}
+ >
+ <DropdownMenuItem.Text>
+ <Column>
+ <Text
+ style={{ typography: "bodyLarge" }}
+ color={
+ action.attributes?.disabled
+ ? muted
+ : action.attributes?.destructive
+ ? colors["--color-danger-foreground"]
+ : foreground
+ }
+ >
+ {action.title}
+ </Text>
+ {action.subtitle ? (
+ <Text color={muted} style={{ typography: "bodySmall" }}>
+ {action.subtitle}
+ </Text>
+ ) : null}
+ </Column>
+ </DropdownMenuItem.Text>
+ {action.image ? (
+ <DropdownMenuItem.LeadingIcon>
+ <MenuIcon
+ name={action.image as AppSymbolName}
+ destructive={action.attributes?.destructive}
+ disabled={action.attributes?.disabled}
+ />
+ </DropdownMenuItem.LeadingIcon>
+ ) : null}
+ {(action.subactions?.length ?? 0) > 0 ? (
+ <DropdownMenuItem.TrailingIcon>
+ <MenuIcon name="chevron.right" disabled={action.attributes?.disabled} />
+ </DropdownMenuItem.TrailingIcon>
+ ) : action.state === "on" ? (
+ <DropdownMenuItem.TrailingIcon>
+ <MenuIcon name="checkmark" disabled={action.attributes?.disabled} />
+ </DropdownMenuItem.TrailingIcon>
+ ) : null}
+ </DropdownMenuItem>
+ ))}
+ </>
+ );
+ if (props.inline) {
+ return (
+ <Host
+ colorScheme={themeAppearance}
+ ignoreSafeAreaKeyboardInsets
+ matchContents
+ style={{ width: 250 }}
+ >
+ <Column>{items}</Column>
+ </Host>
+ );
+ }
+ return (
+ <Host
+ colorScheme={themeAppearance}
+ ignoreSafeAreaKeyboardInsets
+ style={{
+ position: "absolute",
+ left: props.anchor.x,
+ top: props.anchor.y,
+ width: props.anchor.width,
+ height: props.anchor.height,
+ }}
+ >
+ <DropdownMenu expanded onDismissRequest={props.onClose} color={colors["--color-card-alt"]}>
+ <DropdownMenu.Trigger>
+ <Box modifiers={[size(props.anchor.width, props.anchor.height)]} />
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Items>{items}</DropdownMenu.Items>
+ </DropdownMenu>
+ </Host>
+ );
+}
diff --git a/apps/mobile/src/components/MaterialMenuPopup.tsx b/apps/mobile/src/components/MaterialMenuPopup.tsx
new file mode 100644
index 00000000000..3a23e5de7ab
--- /dev/null
+++ b/apps/mobile/src/components/MaterialMenuPopup.tsx
@@ -0,0 +1,22 @@
+import type { MenuAction } from "@react-native-menu/menu";
+
+export interface MaterialMenuPopupProps {
+ readonly anchor: {
+ readonly x: number;
+ readonly y: number;
+ readonly width: number;
+ readonly height: number;
+ };
+ readonly actions: readonly MenuAction[];
+ readonly title?: string;
+ readonly parent: MenuAction | null;
+ readonly onPress: (action: MenuAction) => void;
+ readonly onBack: () => void;
+ readonly onClose: () => void;
+ /** Keep the editor's window focus and keyboard while showing native menu rows. */
+ readonly inline?: boolean;
+}
+
+export function MaterialMenuPopup(_props: MaterialMenuPopupProps) {
+ return null;
+}
diff --git a/apps/mobile/src/components/MaterialNewThreadButton.android.tsx b/apps/mobile/src/components/MaterialNewThreadButton.android.tsx
new file mode 100644
index 00000000000..8d2caf704f4
--- /dev/null
+++ b/apps/mobile/src/components/MaterialNewThreadButton.android.tsx
@@ -0,0 +1,17 @@
+import type { ComponentProps } from "react";
+import { MaterialFloatingActionButton } from "./MaterialFloatingActionButton.android";
+import type { MaterialNewThreadButton as SharedMaterialNewThreadButton } from "./MaterialNewThreadButton.shared";
+
+export function MaterialNewThreadButton(
+ props: ComponentProps<typeof SharedMaterialNewThreadButton>,
+) {
+ return (
+ <MaterialFloatingActionButton
+ {...props}
+ icon="square.and.pencil"
+ label="New thread"
+ tone="primary"
+ variant={props.extended ? "extended" : "large"}
+ />
+ );
+}
diff --git a/apps/mobile/src/components/MaterialNewThreadButton.shared.tsx b/apps/mobile/src/components/MaterialNewThreadButton.shared.tsx
new file mode 100644
index 00000000000..2c887ce78a7
--- /dev/null
+++ b/apps/mobile/src/components/MaterialNewThreadButton.shared.tsx
@@ -0,0 +1,40 @@
+import { Pressable, type StyleProp, type ViewStyle } from "react-native";
+
+import { cn } from "../lib/cn";
+import { AppText } from "./AppText";
+import { SymbolView } from "./AppSymbol";
+
+/** Shared compose action for the floating button and empty workspace. */
+export function MaterialNewThreadButton(props: {
+ readonly onPress: () => void;
+ readonly extended?: boolean;
+ readonly expanded?: boolean;
+ readonly className?: string;
+ readonly style?: StyleProp<ViewStyle>;
+}) {
+ return (
+ <Pressable
+ accessibilityLabel="New thread"
+ accessibilityRole="button"
+ onPress={props.onPress}
+ className={cn(
+ "items-center justify-center bg-primary shadow-lg active:opacity-70",
+ props.extended
+ ? "h-[56px] flex-row gap-[8px] rounded-[16px] px-[16px]"
+ : "size-[80px] rounded-[20px]",
+ props.className,
+ )}
+ style={props.style}
+ >
+ <SymbolView
+ name="square.and.pencil"
+ size={props.extended ? 24 : 28}
+ tintColorClassName="accent-primary-foreground"
+ type="monochrome"
+ />
+ {props.extended && props.expanded !== false ? (
+ <AppText className="text-[16px] font-t3-medium text-primary-foreground">New thread</AppText>
+ ) : null}
+ </Pressable>
+ );
+}
diff --git a/apps/mobile/src/components/MaterialNewThreadButton.tsx b/apps/mobile/src/components/MaterialNewThreadButton.tsx
new file mode 100644
index 00000000000..d197cf97d62
--- /dev/null
+++ b/apps/mobile/src/components/MaterialNewThreadButton.tsx
@@ -0,0 +1 @@
+export { MaterialNewThreadButton } from "./MaterialNewThreadButton.shared";
diff --git a/apps/mobile/src/components/MaterialRadioIndicator.android.tsx b/apps/mobile/src/components/MaterialRadioIndicator.android.tsx
new file mode 100644
index 00000000000..2484dc4536b
--- /dev/null
+++ b/apps/mobile/src/components/MaterialRadioIndicator.android.tsx
@@ -0,0 +1,55 @@
+import { Host, RadioButton } from "@expo/ui/jetpack-compose";
+import { size } from "@expo/ui/jetpack-compose/modifiers";
+import { View } from "react-native";
+
+import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
+
+/** The enclosing radio row owns selection, touch and accessibility. */
+export function MaterialRadioIndicator({ selected }: { readonly selected: boolean }) {
+ const { themeAppearance, themeVariables, systemColorsActive } = useAppearancePreferences();
+ // Expo's radio button cannot override colors in the pinned SDK. Custom
+ // themes need their exact accent rather than a generated Material palette.
+ if (!systemColorsActive) {
+ return (
+ <View
+ pointerEvents="none"
+ importantForAccessibility="no-hide-descendants"
+ style={{ width: 24, height: 24, alignItems: "center", justifyContent: "center" }}
+ >
+ <View
+ style={{
+ width: 20,
+ height: 20,
+ borderRadius: 10,
+ borderWidth: 2,
+ borderColor: themeVariables[selected ? "--color-primary" : "--color-foreground-muted"],
+ alignItems: "center",
+ justifyContent: "center",
+ }}
+ >
+ {selected ? (
+ <View
+ style={{
+ width: 10,
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: themeVariables["--color-primary"],
+ }}
+ />
+ ) : null}
+ </View>
+ </View>
+ );
+ }
+ return (
+ <View pointerEvents="none" importantForAccessibility="no-hide-descendants">
+ <Host
+ colorScheme={themeAppearance}
+ ignoreSafeAreaKeyboardInsets
+ style={{ width: 24, height: 24 }}
+ >
+ <RadioButton selected={selected} modifiers={[size(24, 24)]} />
+ </Host>
+ </View>
+ );
+}
diff --git a/apps/mobile/src/components/MaterialRadioIndicator.tsx b/apps/mobile/src/components/MaterialRadioIndicator.tsx
new file mode 100644
index 00000000000..fb70e90b343
--- /dev/null
+++ b/apps/mobile/src/components/MaterialRadioIndicator.tsx
@@ -0,0 +1,8 @@
+import { SymbolView } from "./AppSymbol";
+
+/** The enclosing radio row owns selection, touch and accessibility. */
+export function MaterialRadioIndicator({ selected }: { readonly selected: boolean }) {
+ return selected ? (
+ <SymbolView name="checkmark" size={16} tintColorClassName="accent-icon" />
+ ) : null;
+}
diff --git a/apps/mobile/src/components/MaterialScreenContent.tsx b/apps/mobile/src/components/MaterialScreenContent.tsx
new file mode 100644
index 00000000000..44d4cc093b6
--- /dev/null
+++ b/apps/mobile/src/components/MaterialScreenContent.tsx
@@ -0,0 +1,33 @@
+import type { ReactNode } from "react";
+import { Platform, View } from "react-native";
+
+/** Keeps the header surface visible behind rounded Android content corners. */
+export function MaterialScreenContent({
+ children,
+ insetHorizontal = false,
+ fitToContents = false,
+}: {
+ readonly children: ReactNode;
+ /** Match the master-list gutters for secondary panes, not full-width content. */
+ readonly insetHorizontal?: boolean;
+ /** Allow native form sheets to measure their content instead of filling a fixed detent. */
+ readonly fitToContents?: boolean;
+}) {
+ if (Platform.OS !== "android") return children;
+
+ return (
+ <View className={fitToContents ? "shrink bg-header" : "flex-1 bg-header"}>
+ <View
+ className="overflow-hidden rounded-t-[28px] bg-sheet-solid"
+ style={{
+ flexShrink: 1,
+ flexGrow: fitToContents ? 0 : 1,
+ flexBasis: fitToContents ? "auto" : 0,
+ marginHorizontal: insetHorizontal ? 4 : 0,
+ }}
+ >
+ {children}
+ </View>
+ </View>
+ );
+}
diff --git a/apps/mobile/src/components/MaterialSegmentedButtons.android.tsx b/apps/mobile/src/components/MaterialSegmentedButtons.android.tsx
new file mode 100644
index 00000000000..ceea91b2444
--- /dev/null
+++ b/apps/mobile/src/components/MaterialSegmentedButtons.android.tsx
@@ -0,0 +1,37 @@
+import { SegmentedButton, SingleChoiceSegmentedButtonRow, Text } from "@expo/ui/jetpack-compose";
+import { defaultMinSize, fillMaxWidth } from "@expo/ui/jetpack-compose/modifiers";
+import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
+import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole";
+import type { SegmentedControlProps } from "./SegmentedControl";
+
+/** Compose content shared by screen controls and native dialogs, inside their existing Host. */
+export function MaterialSegmentedButtons<Value extends number | string>(
+ props: SegmentedControlProps<Value>,
+) {
+ const { themeVariables: colors } = useAppearancePreferences();
+ const typography = useScaledTextRole("footnote");
+ return (
+ <SingleChoiceSegmentedButtonRow modifiers={[fillMaxWidth()]}>
+ {props.options.map((option) => (
+ <SegmentedButton
+ key={String(option.value)}
+ selected={option.value === props.selected}
+ onClick={() => props.onSelect(option.value)}
+ modifiers={[defaultMinSize({ minHeight: 48 })]}
+ colors={{
+ activeContainerColor: colors["--color-secondary"],
+ activeContentColor: colors["--color-secondary-foreground"],
+ inactiveContainerColor: "transparent",
+ inactiveContentColor: colors["--color-foreground"],
+ activeBorderColor: colors["--color-border"],
+ inactiveBorderColor: colors["--color-border"],
+ }}
+ >
+ <SegmentedButton.Label>
+ <Text style={typography}>{option.label}</Text>
+ </SegmentedButton.Label>
+ </SegmentedButton>
+ ))}
+ </SingleChoiceSegmentedButtonRow>
+ );
+}
diff --git a/apps/mobile/src/components/MaterialSegmentedControl.android.tsx b/apps/mobile/src/components/MaterialSegmentedControl.android.tsx
new file mode 100644
index 00000000000..16ec879821e
--- /dev/null
+++ b/apps/mobile/src/components/MaterialSegmentedControl.android.tsx
@@ -0,0 +1,40 @@
+import { Host } from "@expo/ui/jetpack-compose";
+import { MaterialSegmentedButtons } from "./MaterialSegmentedButtons.android";
+import { View } from "react-native";
+
+import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
+import type { SegmentedControlProps } from "./SegmentedControl";
+
+export function MaterialSegmentedControl<Value extends number | string>(
+ props: SegmentedControlProps<Value>,
+) {
+ const { themeAppearance } = useAppearancePreferences();
+ return (
+ <View className={props.className}>
+ <View importantForAccessibility="no-hide-descendants">
+ <Host
+ matchContents={{ vertical: true }}
+ colorScheme={themeAppearance}
+ ignoreSafeAreaKeyboardInsets
+ style={{ width: "100%" }}
+ >
+ <MaterialSegmentedButtons {...props} />
+ </Host>
+ </View>
+ <View pointerEvents="none" className="absolute inset-0 flex-row">
+ {props.options.map((option) => (
+ <View
+ key={String(option.value)}
+ accessible
+ accessibilityRole={props.role ?? "button"}
+ accessibilityLabel={option.accessibilityLabel ?? option.label}
+ accessibilityState={{ selected: option.value === props.selected }}
+ accessibilityActions={[{ name: "activate" }]}
+ onAccessibilityAction={() => props.onSelect(option.value)}
+ className="flex-1"
+ />
+ ))}
+ </View>
+ </View>
+ );
+}
diff --git a/apps/mobile/src/components/MaterialSegmentedControl.tsx b/apps/mobile/src/components/MaterialSegmentedControl.tsx
new file mode 100644
index 00000000000..eca51d2d3f2
--- /dev/null
+++ b/apps/mobile/src/components/MaterialSegmentedControl.tsx
@@ -0,0 +1,7 @@
+import type { SegmentedControlProps } from "./SegmentedControl";
+
+export function MaterialSegmentedControl<Value extends number | string>(
+ _props: SegmentedControlProps<Value>,
+) {
+ return null;
+}
diff --git a/apps/mobile/src/components/MaterialSwitch.android.tsx b/apps/mobile/src/components/MaterialSwitch.android.tsx
new file mode 100644
index 00000000000..2bc9d11130d
--- /dev/null
+++ b/apps/mobile/src/components/MaterialSwitch.android.tsx
@@ -0,0 +1,49 @@
+import { Host, Switch as ComposeSwitch } from "@expo/ui/jetpack-compose";
+import { View } from "react-native";
+import type { ThemedSwitchProps } from "./ThemedSwitch";
+
+import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
+
+/** Material's native switch, with the same palette and accessibility contract as our RN controls. */
+export function MaterialSwitch(props: ThemedSwitchProps) {
+ const { themeAppearance, themeVariables: colors } = useAppearancePreferences();
+ const toggle = () => {
+ if (!props.disabled) props.onValueChange?.(!props.value);
+ };
+
+ return (
+ <View
+ accessible
+ accessibilityLabel={props.accessibilityLabel}
+ accessibilityHint={props.accessibilityHint}
+ accessibilityRole="switch"
+ accessibilityState={{ checked: Boolean(props.value), disabled: Boolean(props.disabled) }}
+ accessibilityActions={[{ name: "activate", label: "Toggle" }]}
+ onAccessibilityAction={toggle}
+ style={props.style}
+ testID={props.testID}
+ >
+ <View importantForAccessibility="no-hide-descendants">
+ <Host
+ colorScheme={themeAppearance}
+ ignoreSafeAreaKeyboardInsets
+ style={{ width: 52, height: 48 }}
+ >
+ <ComposeSwitch
+ value={Boolean(props.value)}
+ enabled={!props.disabled}
+ onCheckedChange={props.onValueChange ?? undefined}
+ colors={{
+ checkedTrackColor: colors["--color-switch-active-track"],
+ checkedThumbColor: colors["--color-switch-active-thumb"],
+ checkedBorderColor: colors["--color-switch-active-track"],
+ uncheckedTrackColor: colors["--color-switch-inactive-track"],
+ uncheckedThumbColor: colors["--color-switch-inactive-thumb"],
+ uncheckedBorderColor: colors["--color-switch-inactive-thumb"],
+ }}
+ />
+ </Host>
+ </View>
+ </View>
+ );
+}
diff --git a/apps/mobile/src/components/MaterialSwitch.tsx b/apps/mobile/src/components/MaterialSwitch.tsx
new file mode 100644
index 00000000000..b0e8346ced5
--- /dev/null
+++ b/apps/mobile/src/components/MaterialSwitch.tsx
@@ -0,0 +1 @@
+export { Switch as MaterialSwitch } from "react-native";
diff --git a/apps/mobile/src/components/ScreenScrollView.tsx b/apps/mobile/src/components/ScreenScrollView.tsx
new file mode 100644
index 00000000000..509feeb3972
--- /dev/null
+++ b/apps/mobile/src/components/ScreenScrollView.tsx
@@ -0,0 +1,19 @@
+import type { ComponentProps } from "react";
+import { Platform, ScrollView } from "react-native";
+
+/** Keeps forms and settings readable inside a wide pane while its surface fills the screen. */
+export function ScreenScrollView(props: ComponentProps<typeof ScrollView>) {
+ return (
+ <ScrollView
+ {...props}
+ contentContainerStyle={[
+ props.contentContainerStyle,
+ Platform.OS === "android" && {
+ width: "100%",
+ maxWidth: 720,
+ alignSelf: "center",
+ },
+ ]}
+ />
+ );
+}
diff --git a/apps/mobile/src/components/SegmentedControl.tsx b/apps/mobile/src/components/SegmentedControl.tsx
index 04a562956c4..607062e0579 100644
--- a/apps/mobile/src/components/SegmentedControl.tsx
+++ b/apps/mobile/src/components/SegmentedControl.tsx
@@ -2,8 +2,9 @@ import { Platform, Pressable, View } from "react-native";
import Animated, { Easing, LinearTransition, ReduceMotion } from "react-native-reanimated";
import { AppText as Text } from "./AppText";
import { cn } from "../lib/cn";
+import { MaterialSegmentedControl } from "./MaterialSegmentedControl";
-export function SegmentedControl<Value extends number | string>(props: {
+export interface SegmentedControlProps<Value extends number | string> {
readonly options: readonly {
readonly value: Value;
readonly label: string;
@@ -11,18 +12,26 @@ export function SegmentedControl<Value extends number | string>(props: {
}[];
readonly selected: Value;
readonly onSelect: (value: Value) => void;
- /** The tab bar is full height; filters under it are shorter so it stays primary. */
+ /** Compact sizing applies to the non-Material control. */
readonly size?: "default" | "compact";
/** "tab" for the view switcher; filters stay plain buttons. */
readonly role?: "tab" | "button";
readonly className?: string;
-}) {
+}
+
+export function SegmentedControl<Value extends number | string>(
+ props: SegmentedControlProps<Value>,
+) {
const compact = props.size === "compact";
+ if (Platform.OS === "android") {
+ return <MaterialSegmentedControl {...props} />;
+ }
return (
<View
accessible={false}
className={cn(
- "flex-row overflow-hidden rounded-full border-continuous bg-card",
+ "flex-row overflow-hidden",
+ "rounded-full border-continuous bg-card",
props.className,
)}
>
@@ -31,7 +40,7 @@ export function SegmentedControl<Value extends number | string>(props: {
layout={LinearTransition.duration(200)
.easing(Easing.out(Easing.cubic))
.reduceMotion(ReduceMotion.System)}
- className="absolute bottom-0 top-0 rounded-full bg-subtle-strong"
+ className="absolute inset-y-0 rounded-full bg-subtle-strong"
style={{
width: `${100 / props.options.length}%`,
start: `${
diff --git a/apps/mobile/src/components/ThemedSwitch.tsx b/apps/mobile/src/components/ThemedSwitch.tsx
index 08cef56f3ec..f0cf8701e50 100644
--- a/apps/mobile/src/components/ThemedSwitch.tsx
+++ b/apps/mobile/src/components/ThemedSwitch.tsx
@@ -1,63 +1,27 @@
-import { Platform, Pressable, Switch, View, type SwitchProps } from "react-native";
+import { Platform, Switch, type SwitchProps } from "react-native";
-import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
-import { SymbolView } from "./AppSymbol";
+import { MaterialSwitch } from "./MaterialSwitch";
-export function ThemedSwitch(props: SwitchProps) {
- const { materialYouStyleLayoutActive } = useAppearancePreferences();
- if (materialYouStyleLayoutActive) {
- return (
- <Pressable
- accessibilityHint={props.accessibilityHint}
- accessibilityLabel={props.accessibilityLabel}
- accessibilityRole="switch"
- accessibilityState={{ checked: Boolean(props.value), disabled: props.disabled }}
- disabled={props.disabled}
- hitSlop={8}
- onPress={() => props.onValueChange?.(!props.value)}
- style={props.style}
- testID={props.testID}
- className={props.disabled ? "opacity-40" : "active:opacity-70"}
- >
- <View
- className={
- props.value
- ? "h-8 w-[52px] items-end justify-center rounded-full border-2 border-switch-active-track bg-switch-active-track px-0.5"
- : "h-8 w-[52px] items-start justify-center rounded-full border-2 border-switch-inactive-thumb bg-switch-inactive-track px-0.5"
- }
- >
- <View
- className={
- props.value
- ? "size-6 items-center justify-center rounded-full bg-switch-active-thumb"
- : "size-6 items-center justify-center rounded-full bg-switch-inactive-thumb"
- }
- >
- <SymbolView
- name={props.value ? "checkmark" : "xmark"}
- size={13}
- tintColorClassName={
- props.value ? "accent-switch-active-track" : "accent-switch-inactive-track"
- }
- type="monochrome"
- />
- </View>
- </View>
- </Pressable>
- );
+export type ThemedSwitchProps = Pick<
+ SwitchProps,
+ | "accessibilityHint"
+ | "accessibilityLabel"
+ | "disabled"
+ | "onValueChange"
+ | "style"
+ | "testID"
+ | "value"
+>;
+
+export function ThemedSwitch(props: ThemedSwitchProps) {
+ if (Platform.OS === "android") {
+ return <MaterialSwitch {...props} />;
}
return (
<Switch
{...props}
ios_backgroundColorClassName="accent-switch-inactive-track"
- thumbColorClassName={
- Platform.OS === "android"
- ? props.value
- ? "accent-switch-active-thumb"
- : "accent-switch-inactive-thumb"
- : undefined
- }
trackColorOffClassName="accent-switch-inactive-track"
trackColorOnClassName="accent-switch-active-track"
/>
diff --git a/apps/mobile/src/components/useMaterialToolbarHeight.ts b/apps/mobile/src/components/useMaterialToolbarHeight.ts
new file mode 100644
index 00000000000..26e8510a82f
--- /dev/null
+++ b/apps/mobile/src/components/useMaterialToolbarHeight.ts
@@ -0,0 +1,11 @@
+import { useWindowDimensions } from "react-native";
+
+import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole";
+
+/** Reserve the same title/subtitle space in every pane, including icon-only and search headers. */
+export function useMaterialToolbarHeight() {
+ const title = useScaledTextRole("title");
+ const subtitle = useScaledTextRole("label");
+ const { fontScale } = useWindowDimensions();
+ return Math.ceil(Math.max(56, (title.lineHeight + subtitle.lineHeight) * fontScale + 1));
+}
diff --git a/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx b/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx
index 97f9c5b69d0..78b3b62a3c1 100644
--- a/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx
+++ b/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx
@@ -40,6 +40,7 @@ import {
NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED,
} from "../layout/native-mail-search-toolbar";
import type { ArchivedThreadGroup, ArchivedThreadSortOrder } from "./archivedThreadList";
+import { SettingsScreenContent } from "../settings/components/SettingsScreen";
export interface ArchivedThreadsHeaderEnvironment {
readonly environmentId: EnvironmentId;
@@ -146,6 +147,7 @@ function ArchivedThreadsHeader(props: {
className="border-b border-header-border bg-header px-3 pb-2.5"
style={{
paddingTop: Math.max(insets.top, 12),
+ borderBottomWidth: 0,
}}
>
<View className="min-h-12 flex-row items-center gap-2">
@@ -159,7 +161,7 @@ function ArchivedThreadsHeader(props: {
<SymbolView
name="chevron.left"
size={24}
- tintColorClassName={"accent-foreground"}
+ tintColorClassName="accent-foreground"
type="monochrome"
/>
</Pressable>
@@ -167,7 +169,7 @@ function ArchivedThreadsHeader(props: {
<SymbolView
name="magnifyingglass"
size={17}
- tintColorClassName={"accent-icon"}
+ tintColorClassName="accent-icon"
type="monochrome"
/>
<TextInput
@@ -197,7 +199,7 @@ function ArchivedThreadsHeader(props: {
: "line.3.horizontal.decrease.circle"
}
size={16}
- tintColorClassName={"accent-icon"}
+ tintColorClassName="accent-icon"
type="monochrome"
/>
</Pressable>
@@ -455,7 +457,7 @@ function ArchivedThreadRow(props: {
<SymbolView
name="archivebox.fill"
size={15}
- tintColorClassName={"accent-icon-subtle"}
+ tintColorClassName="accent-icon-subtle"
type="monochrome"
/>
</View>
@@ -477,7 +479,7 @@ function ArchivedThreadRow(props: {
<SymbolView
name="arrow.triangle.branch"
size={10}
- tintColorClassName={"accent-icon-subtle"}
+ tintColorClassName="accent-icon-subtle"
type="monochrome"
/>
<Text
@@ -615,7 +617,7 @@ export function ArchivedThreadsScreen(props: {
if (isInitialLoad) {
return (
<View className="items-center py-16">
- <ActivityIndicator colorClassName={"accent-icon"} />
+ <ActivityIndicator colorClassName="accent-icon" />
<Text className="mt-3 text-sm text-foreground-muted">Loading archive...</Text>
</View>
);
@@ -646,37 +648,39 @@ export function ArchivedThreadsScreen(props: {
sortOrder={props.sortOrder}
/>
- <GestureDetector gesture={archiveScrollGesture}>
- <LegendList
- className="flex-1"
- contentContainerStyle={{
- paddingBottom: 32,
- paddingHorizontal: 16,
- paddingTop: 4,
- }}
- contentInsetAdjustmentBehavior="automatic"
- data={listItems}
- estimatedItemSize={62}
- getItemType={(item) => item.kind}
- keyboardDismissMode="on-drag"
- keyboardShouldPersistTaps="handled"
- keyExtractor={(item) => item.key}
- ListEmptyComponent={listEmptyComponent}
- ListHeaderComponent={
- props.error ? <ArchiveError message={props.error} onRetry={props.onRefresh} /> : null
- }
- onScrollBeginDrag={() => openSwipeableRef.current?.close()}
- refreshControl={
- <RefreshControl
- onRefresh={props.onRefresh}
- refreshing={props.isLoading && !isInitialLoad}
- tintColorClassName={String("accent-icon")}
- />
- }
- renderItem={renderListItem}
- showsVerticalScrollIndicator={false}
- />
- </GestureDetector>
+ <SettingsScreenContent>
+ <GestureDetector gesture={archiveScrollGesture}>
+ <LegendList
+ className="flex-1"
+ contentContainerStyle={{
+ paddingBottom: 32,
+ paddingHorizontal: 16,
+ paddingTop: 4,
+ }}
+ contentInsetAdjustmentBehavior="automatic"
+ data={listItems}
+ estimatedItemSize={62}
+ getItemType={(item) => item.kind}
+ keyboardDismissMode="on-drag"
+ keyboardShouldPersistTaps="handled"
+ keyExtractor={(item) => item.key}
+ ListEmptyComponent={listEmptyComponent}
+ ListHeaderComponent={
+ props.error ? <ArchiveError message={props.error} onRetry={props.onRefresh} /> : null
+ }
+ onScrollBeginDrag={() => openSwipeableRef.current?.close()}
+ refreshControl={
+ <RefreshControl
+ onRefresh={props.onRefresh}
+ refreshing={props.isLoading && !isInitialLoad}
+ tintColorClassName={String("accent-icon")}
+ />
+ }
+ renderItem={renderListItem}
+ showsVerticalScrollIndicator={false}
+ />
+ </GestureDetector>
+ </SettingsScreenContent>
</View>
);
}
diff --git a/apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx b/apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx
index 8138d288957..df6f1983559 100644
--- a/apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx
+++ b/apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx
@@ -1,8 +1,9 @@
+import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
import { NativeHeaderToolbar } from "../../native/StackHeader";
import { useAuth } from "@clerk/expo";
import { StackActions, useNavigation } from "@react-navigation/native";
import { useCallback, useEffect, useState } from "react";
-import { Platform, Pressable, RefreshControl, ScrollView, View } from "react-native";
+import { Platform, Pressable, RefreshControl, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { reportAtomCommandResult, settlePromise } from "@t3tools/client-runtime/state/runtime";
diff --git a/apps/mobile/src/features/connection/ConnectionEnvironmentRow.tsx b/apps/mobile/src/features/connection/ConnectionEnvironmentRow.tsx
index 42d9cdddd0e..a42db147c17 100644
--- a/apps/mobile/src/features/connection/ConnectionEnvironmentRow.tsx
+++ b/apps/mobile/src/features/connection/ConnectionEnvironmentRow.tsx
@@ -6,11 +6,13 @@ import { useAtomValue } from "@effect/atom-react";
import * as Cause from "effect/Cause";
import { AsyncResult } from "effect/unstable/reactivity";
import { useCallback, useState } from "react";
-import { Alert, Pressable, View } from "react-native";
+import { Platform, Alert, Pressable, View } from "react-native";
import Animated, { FadeIn, FadeOut, LinearTransition } from "react-native-reanimated";
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
+import { MaterialButton } from "../../components/MaterialButton";
+import { MaterialIconButton } from "../../components/MaterialIconButton";
import { ThemedSwitch } from "../../components/ThemedSwitch";
import { cn } from "../../lib/cn";
import { copyTextWithHaptic } from "../../lib/copyTextWithHaptic";
@@ -142,7 +144,7 @@ export function ConnectionEnvironmentRow(props: {
<SymbolView
name="chevron.down"
size={12}
- tintColorClassName={"accent-icon-subtle"}
+ tintColorClassName="accent-icon-subtle"
type="monochrome"
style={{
transform: [{ rotate: props.expanded ? "180deg" : "0deg" }],
@@ -193,49 +195,79 @@ export function ConnectionEnvironmentRow(props: {
</>
)}
- <View className="flex-row justify-end gap-2">
- {props.environment.isRelayManaged ? null : (
+ {Platform.OS === "android" ? (
+ <View className="flex-row items-center justify-end gap-2">
+ {props.environment.isRelayManaged ? null : (
+ <View className="flex-1">
+ <MaterialButton
+ label="Save"
+ tone="primary"
+ fullWidth
+ onPress={() => {
+ void handleSave();
+ }}
+ />
+ </View>
+ )}
+ <MaterialIconButton
+ accessibilityLabel="Reconnect environment"
+ icon="arrow.clockwise"
+ variant="tonal"
+ disabled={!enabled}
+ onPress={() => props.onReconnect(props.environment.environmentId)}
+ />
+ <MaterialIconButton
+ accessibilityLabel="Remove environment"
+ icon="trash"
+ variant="danger"
+ onPress={() => props.onRemove(props.environment.environmentId)}
+ />
+ </View>
+ ) : (
+ <View className="flex-row justify-end gap-2">
+ {props.environment.isRelayManaged ? null : (
+ <Pressable
+ className="min-h-[42px] flex-1 flex-row items-center justify-center gap-1.5 rounded-[14px] bg-primary px-3.5 py-2.5 active:opacity-70"
+ onPress={handleSave}
+ >
+ <SymbolView
+ name="checkmark"
+ size={13}
+ tintColorClassName="accent-primary-foreground"
+ type="monochrome"
+ />
+ <Text className="text-xs font-t3-bold tracking-[0.8px] uppercase text-primary-foreground">
+ Save
+ </Text>
+ </Pressable>
+ )}
+
<Pressable
- className="min-h-[42px] flex-1 flex-row items-center justify-center gap-1.5 rounded-[14px] bg-primary px-3.5 py-2.5 active:opacity-70"
- onPress={handleSave}
+ className="h-[42px] w-[42px] items-center justify-center rounded-[14px] border border-input-border bg-input active:opacity-70 disabled:opacity-40"
+ disabled={!enabled}
+ onPress={() => props.onReconnect(props.environment.environmentId)}
>
<SymbolView
- name="checkmark"
- size={13}
- tintColorClassName={"accent-primary-foreground"}
+ name="arrow.clockwise"
+ size={14}
+ tintColorClassName="accent-icon-subtle"
type="monochrome"
/>
- <Text className="text-xs font-t3-bold tracking-[0.8px] uppercase text-primary-foreground">
- Save
- </Text>
</Pressable>
- )}
-
- <Pressable
- className="h-[42px] w-[42px] items-center justify-center rounded-[14px] border border-input-border bg-input active:opacity-70 disabled:opacity-40"
- disabled={!enabled}
- onPress={() => props.onReconnect(props.environment.environmentId)}
- >
- <SymbolView
- name="arrow.clockwise"
- size={14}
- tintColorClassName={"accent-icon-subtle"}
- type="monochrome"
- />
- </Pressable>
- <Pressable
- className="h-[42px] w-[42px] items-center justify-center rounded-[14px] border border-danger-border bg-danger active:opacity-70"
- onPress={() => props.onRemove(props.environment.environmentId)}
- >
- <SymbolView
- name="trash"
- size={14}
- tintColorClassName={"accent-danger-foreground"}
- type="monochrome"
- />
- </Pressable>
- </View>
+ <Pressable
+ className="h-[42px] w-[42px] items-center justify-center rounded-[14px] border border-danger-border bg-danger active:opacity-70"
+ onPress={() => props.onRemove(props.environment.environmentId)}
+ >
+ <SymbolView
+ name="trash"
+ size={14}
+ tintColorClassName="accent-danger-foreground"
+ type="monochrome"
+ />
+ </Pressable>
+ </View>
+ )}
</Animated.View>
) : null}
</Animated.View>
diff --git a/apps/mobile/src/features/connection/ConnectionSheetButton.tsx b/apps/mobile/src/features/connection/ConnectionSheetButton.tsx
index fe26c66a355..e9ac17b665a 100644
--- a/apps/mobile/src/features/connection/ConnectionSheetButton.tsx
+++ b/apps/mobile/src/features/connection/ConnectionSheetButton.tsx
@@ -3,6 +3,7 @@ import { Platform, Pressable } from "react-native";
import { AppText as Text } from "../../components/AppText";
import { cn } from "../../lib/cn";
+import { MaterialButton } from "../../components/MaterialButton";
const CARD_SHADOW = Platform.select({
ios: {
@@ -32,8 +33,19 @@ export function ConnectionSheetButton(props: {
readonly disabled?: boolean;
readonly tone?: "primary" | "secondary" | "danger";
readonly compact?: boolean;
+ readonly fullWidth?: boolean;
readonly onPress: () => void;
}) {
+ if (Platform.OS === "android")
+ return (
+ <MaterialButton
+ label={props.label}
+ disabled={props.disabled}
+ onPress={props.onPress}
+ tone={props.tone}
+ fullWidth={props.fullWidth}
+ />
+ );
const tone = props.tone ?? "secondary";
const textColorClassName =
diff --git a/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx b/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx
index 1645844d86b..ea4f1cf6971 100644
--- a/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx
+++ b/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx
@@ -1,13 +1,18 @@
+import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
import { CameraView, useCameraPermissions } from "expo-camera";
import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
-import { StackActions, useNavigation, type StaticScreenProps } from "@react-navigation/native";
+import {
+ StackActions,
+ useNavigation,
+ useRoute,
+ type StaticScreenProps,
+} from "@react-navigation/native";
import { AsyncResult } from "effect/unstable/reactivity";
import { useCallback, useEffect, useRef, useState } from "react";
-import { Alert, Linking, Platform, ScrollView, View } from "react-native";
+import { Alert, Linking, Platform, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { useUniwindTheme } from "../../lib/useUniwindTheme";
-
-import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
+import { SettingsScreen } from "../settings/components/SettingsScreen";
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
import { ErrorBanner } from "../../components/ErrorBanner";
import { ConnectionSheetButton } from "./ConnectionSheetButton";
@@ -30,6 +35,7 @@ export function ConnectionsNewRouteScreen({
pairingConnectionError,
} = useRemoteConnections();
const navigation = useNavigation();
+ const routeName = useRoute().name;
const params = route.params ?? {};
// Deep-link prefill exists for development automation only. A production
// link must not arrive with attacker-chosen host and token already filled.
@@ -181,33 +187,27 @@ export function ConnectionsNewRouteScreen({
}, [connectAndClose, routePairingUrl, shouldAutoConnect]);
return (
- <View collapsable={false} className="flex-1 bg-sheet">
+ <SettingsScreen
+ formSheet={routeName === "ConnectionsNew"}
+ title={showScanner ? "Scan QR Code" : "Add Environment"}
+ actions={[
+ {
+ accessibilityLabel: showScanner ? "Close scanner" : "Scan QR code",
+ icon: showScanner ? "xmark" : "camera",
+ onPress: () => {
+ if (showScanner) {
+ closeScanner();
+ } else {
+ void openScanner();
+ }
+ },
+ },
+ ]}
+ >
<NativeStackScreenOptions
- options={{
- // Android renders its own in-screen header below instead of the native bar.
- ...(Platform.OS === "android" ? { headerShown: false } : null),
- title: showScanner ? "Scan QR Code" : "Add Environment",
- }}
+ options={{ title: showScanner ? "Scan QR Code" : "Add Environment" }}
/>
- {Platform.OS === "android" ? (
- <AndroidScreenHeader
- title={showScanner ? "Scan QR Code" : "Add Environment"}
- onBack={() => navigation.goBack()}
- actions={[
- {
- accessibilityLabel: showScanner ? "Close scanner" : "Scan QR code",
- icon: showScanner ? "xmark" : "camera",
- onPress: () => {
- if (showScanner) {
- closeScanner();
- } else {
- void openScanner();
- }
- },
- },
- ]}
- />
- ) : (
+ {Platform.OS !== "android" ? (
<NativeHeaderToolbar placement="right">
<NativeHeaderToolbar.Button
icon={showScanner ? "xmark" : "qrcode.viewfinder"}
@@ -222,7 +222,7 @@ export function ConnectionsNewRouteScreen({
tintColor={headerIconColor}
/>
</NativeHeaderToolbar>
- )}
+ ) : null}
<ScrollView
contentInsetAdjustmentBehavior="automatic"
@@ -293,19 +293,21 @@ export function ConnectionsNewRouteScreen({
{pairingConnectionError ? <ErrorBanner message={pairingConnectionError} /> : null}
- <ConnectionSheetButton
- icon="plus"
- label={isSubmitting ? "Pairing..." : "Add environment"}
- disabled={connectDisabled}
- tone="primary"
- onPress={() => {
- void handleSubmit();
- }}
- />
+ <View className={Platform.OS === "android" ? "flex-row justify-end" : undefined}>
+ <ConnectionSheetButton
+ icon="plus"
+ label={isSubmitting ? "Pairing..." : "Add environment"}
+ disabled={connectDisabled}
+ tone="primary"
+ onPress={() => {
+ void handleSubmit();
+ }}
+ />
+ </View>
</View>
)}
</View>
</ScrollView>
- </View>
+ </SettingsScreen>
);
}
diff --git a/apps/mobile/src/features/connection/ConnectionsRouteScreen.tsx b/apps/mobile/src/features/connection/ConnectionsRouteScreen.tsx
index bfab389a3a6..28bb5327043 100644
--- a/apps/mobile/src/features/connection/ConnectionsRouteScreen.tsx
+++ b/apps/mobile/src/features/connection/ConnectionsRouteScreen.tsx
@@ -1,9 +1,10 @@
+import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
import { NativeHeaderToolbar } from "../../native/StackHeader";
import { useNavigation } from "@react-navigation/native";
import { SymbolView } from "../../components/AppSymbol";
import type { EnvironmentId } from "@t3tools/contracts";
import { useCallback, useState } from "react";
-import { Platform, ScrollView, View } from "react-native";
+import { Platform, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
diff --git a/apps/mobile/src/features/diagnostics/SettingsDiagnosticsRouteScreen.tsx b/apps/mobile/src/features/diagnostics/SettingsDiagnosticsRouteScreen.tsx
index a55bb8f859e..ff21a6c31a9 100644
--- a/apps/mobile/src/features/diagnostics/SettingsDiagnosticsRouteScreen.tsx
+++ b/apps/mobile/src/features/diagnostics/SettingsDiagnosticsRouteScreen.tsx
@@ -1,12 +1,14 @@
+import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
import Constants from "expo-constants";
import * as Updates from "expo-updates";
import { useEffect, useState } from "react";
-import { ActivityIndicator, Platform, Pressable, ScrollView, View } from "react-native";
+import { ActivityIndicator, Platform, Pressable, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { SymbolView } from "../../components/AppSymbol";
import { AppText as Text } from "../../components/AppText";
import { tryCopyTextWithHaptic } from "../../lib/copyTextWithHaptic";
+import { SettingsScreen } from "../settings/components/SettingsScreen";
import { SettingsSection } from "../settings/components/SettingsSection";
import {
formatStartupCrashReport,
@@ -71,7 +73,7 @@ export function SettingsDiagnosticsRouteScreen() {
};
return (
- <View collapsable={false} className="flex-1 bg-sheet">
+ <SettingsScreen title="Diagnostics">
<ScrollView
contentInsetAdjustmentBehavior="automatic"
contentInset={{ bottom: Math.max(insets.bottom, 18) }}
@@ -115,7 +117,7 @@ export function SettingsDiagnosticsRouteScreen() {
<SymbolView
name={copied ? "checkmark" : "doc.on.doc"}
size={22}
- tintColorClassName={"accent-icon"}
+ tintColorClassName="accent-icon"
type="monochrome"
weight="regular"
/>
@@ -131,7 +133,7 @@ export function SettingsDiagnosticsRouteScreen() {
</Text>
</View>
</ScrollView>
- </View>
+ </SettingsScreen>
);
}
@@ -145,7 +147,7 @@ function EmptyState(props: {
<SymbolView
name={props.icon}
size={28}
- tintColorClassName={"accent-icon"}
+ tintColorClassName="accent-icon"
type="monochrome"
weight="regular"
/>
diff --git a/apps/mobile/src/features/files/MaterialFilesHeader.tsx b/apps/mobile/src/features/files/MaterialFilesHeader.tsx
new file mode 100644
index 00000000000..2ce953569b6
--- /dev/null
+++ b/apps/mobile/src/features/files/MaterialFilesHeader.tsx
@@ -0,0 +1,122 @@
+import { useCallback, useEffect, useRef, useState, type ReactNode } from "react";
+import { BackHandler, Keyboard, Pressable, TextInput, View } from "react-native";
+import { useSafeAreaInsets } from "react-native-safe-area-context";
+
+import { AndroidHeaderIconButton, AndroidScreenHeader } from "../../components/AndroidScreenHeader";
+import { SymbolView } from "../../components/AppSymbol";
+
+/** Keep Files search in the same header row on compact and expanded layouts. */
+export function MaterialFilesHeader(props: {
+ readonly projectName: string;
+ readonly searchQuery: string;
+ readonly onSearchQueryChange: (query: string) => void;
+ readonly onRefresh: () => void;
+ readonly onBack?: () => void;
+ readonly leading?: ReactNode;
+}) {
+ const insets = useSafeAreaInsets();
+ const searchRef = useRef<TextInput>(null);
+ const [searchOpen, setSearchOpen] = useState(false);
+ const searching = searchOpen || props.searchQuery.length > 0;
+ const { onSearchQueryChange } = props;
+ const closeSearch = useCallback(() => {
+ onSearchQueryChange("");
+ setSearchOpen(false);
+ Keyboard.dismiss();
+ }, [onSearchQueryChange]);
+
+ useEffect(() => {
+ if (!searching) return;
+ const subscription = BackHandler.addEventListener("hardwareBackPress", () => {
+ closeSearch();
+ return true;
+ });
+ return () => subscription.remove();
+ }, [closeSearch, searching]);
+
+ return (
+ <View>
+ {/* Keep the title/subtitle's natural height, including larger text, while searching. */}
+ <View
+ pointerEvents={searching ? "none" : "auto"}
+ accessibilityElementsHidden={searching}
+ importantForAccessibility={searching ? "no-hide-descendants" : "auto"}
+ style={{ opacity: searching ? 0 : 1 }}
+ >
+ <AndroidScreenHeader
+ title="Files"
+ subtitle={props.projectName}
+ hideBottomBorder
+ onBack={props.onBack}
+ leading={props.leading}
+ actions={[
+ {
+ accessibilityLabel: "Search files",
+ icon: "magnifyingglass",
+ onPress: () => setSearchOpen(true),
+ },
+ {
+ accessibilityLabel: "Refresh files",
+ icon: "arrow.clockwise",
+ onPress: props.onRefresh,
+ },
+ ]}
+ />
+ </View>
+ {searching ? (
+ <View
+ className="absolute inset-0 bg-header px-2 pb-2"
+ style={{ paddingTop: Math.max(insets.top, 12) }}
+ >
+ <View className="min-h-14 flex-1 flex-row items-center gap-1">
+ <AndroidHeaderIconButton
+ accessibilityLabel="Close file search"
+ icon="arrow.left"
+ onPress={closeSearch}
+ />
+ <View className="h-12 min-w-0 flex-1 flex-row items-center gap-2 rounded-full border border-input-border bg-input px-3">
+ <SymbolView
+ name="magnifyingglass"
+ size={18}
+ tintColorClassName="accent-foreground-muted"
+ />
+ <TextInput
+ ref={searchRef}
+ accessibilityLabel="Search files"
+ autoFocus
+ autoCapitalize="none"
+ autoCorrect={false}
+ returnKeyType="search"
+ placeholder="Search files"
+ placeholderTextColorClassName="accent-placeholder"
+ selectionColorClassName="accent-primary/32"
+ cursorColorClassName="accent-primary"
+ selectionHandleColorClassName="accent-primary"
+ className="min-w-0 flex-1 py-2 font-sans text-base text-foreground"
+ value={props.searchQuery}
+ onChangeText={onSearchQueryChange}
+ />
+ {props.searchQuery.length > 0 ? (
+ <Pressable
+ accessibilityLabel="Clear file search"
+ accessibilityRole="button"
+ hitSlop={10}
+ onPress={() => {
+ onSearchQueryChange("");
+ searchRef.current?.focus();
+ }}
+ >
+ <SymbolView
+ name="xmark.circle.fill"
+ size={18}
+ tintColorClassName="accent-foreground-muted"
+ />
+ </Pressable>
+ ) : null}
+ </View>
+ </View>
+ </View>
+ ) : null}
+ </View>
+ );
+}
diff --git a/apps/mobile/src/features/files/SourceFileSurface.tsx b/apps/mobile/src/features/files/SourceFileSurface.tsx
index 82d69b28e84..76184972583 100644
--- a/apps/mobile/src/features/files/SourceFileSurface.tsx
+++ b/apps/mobile/src/features/files/SourceFileSurface.tsx
@@ -4,6 +4,7 @@ import type { ComponentType } from "react";
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
import {
FlatList,
+ Platform,
RefreshControl,
ScrollView,
Text as NativeText,
@@ -73,6 +74,7 @@ const HighlightedSourceLine = memo(function HighlightedSourceLine(props: {
</NativeText>
<NativeText
selectable
+ selectionColorClassName={Platform.OS === "android" ? "accent-primary/32" : undefined}
numberOfLines={props.wordBreak ? undefined : 1}
className="flex-1 font-normal text-foreground"
style={{
@@ -102,6 +104,9 @@ const HighlightedSourceLine = memo(function HighlightedSourceLine(props: {
<NativeText
key={`${start}:${token.content.length}:${token.color ?? ""}`}
selectable
+ selectionColorClassName={
+ Platform.OS === "android" ? "accent-primary/32" : undefined
+ }
style={{
color: token.color ?? undefined,
fontFamily: REVIEW_MONO_FONT_FAMILY,
@@ -274,6 +279,7 @@ function JavaScriptSourceFileSurface(props: SourceFileSurfaceProps) {
<MarkdownTextPrimitive
uiTextView
selectable
+ selectionColorClassName={Platform.OS === "android" ? "accent-primary/32" : undefined}
style={{
color: foreground,
fontFamily: REVIEW_MONO_FONT_FAMILY,
diff --git a/apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx b/apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx
index 624a214e43e..8e52bc9a10f 100644
--- a/apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx
+++ b/apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx
@@ -15,8 +15,8 @@ import {
import { mediaFileReference } from "@t3tools/client-runtime/media-reference";
import { AndroidHeaderIconButton, AndroidScreenHeader } from "../../components/AndroidScreenHeader";
-import { SymbolView } from "../../components/AppSymbol";
-import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
+import { MaterialScreenContent } from "../../components/MaterialScreenContent";
+import { AppText as Text } from "../../components/AppText";
import { AudioFilePreview } from "../../components/AudioFilePreview";
import { ControlPillMenu } from "../../components/ControlPill";
import { EmptyState } from "../../components/EmptyState";
@@ -43,7 +43,10 @@ import {
createNativeMailSearchToolbarItem,
NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED,
} from "../layout/native-mail-search-toolbar";
-import { WorkspaceSidebarToolbar } from "../layout/workspace-sidebar-toolbar";
+import {
+ AndroidWorkspaceSidebarButton,
+ WorkspaceSidebarToolbar,
+} from "../layout/workspace-sidebar-toolbar";
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import { ThreadRouteScreen } from "../threads/ThreadRouteScreen";
import { FileMarkdownPreview } from "./FileMarkdownPreview";
@@ -52,6 +55,7 @@ import { useFileTreeEntries } from "./useFileTreeEntries";
import { preloadWorkspaceFileContents } from "./preload-workspace-file";
import { SourceFileSurface } from "./SourceFileSurface";
import { ThreadFileNavigatorPane } from "./thread-file-navigator-pane";
+import { MaterialFilesHeader } from "./MaterialFilesHeader";
import { WorkspaceFileImagePreview } from "./WorkspaceFileImagePreview";
import { WorkspaceFilePreviewError } from "./WorkspaceFilePreviewError";
import { WorkspaceFileVideoPreview } from "./WorkspaceFileVideoPreview";
@@ -328,10 +332,9 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
useAdaptiveWorkspaceLayout();
const [searchQuery, setSearchQuery] = useState("");
const isAndroid = Platform.OS === "android";
- const { themeAppearance: highlightTheme, materialYouStyleLayoutActive } =
- useAppearancePreferences();
+ const { themeAppearance: highlightTheme } = useAppearancePreferences();
const theme = useUniwindTheme();
- const screenColor = theme["--color-screen"];
+ const headerColor = theme["--color-header"];
const sheetSurfaceColor = theme["--color-sheet-solid"];
const { cwd, environmentId, projectName, selectedThread, threadId } = useThreadFilesWorkspace(
props.route.params,
@@ -451,7 +454,7 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
<NativeStackScreenOptions
options={{
contentStyle: {
- backgroundColor: materialYouStyleLayoutActive ? screenColor : sheetSurfaceColor,
+ backgroundColor: Platform.OS === "android" ? headerColor : sheetSurfaceColor,
},
headerShown: !isAndroid,
unstable_headerSubtitle:
@@ -484,46 +487,16 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
/>
{isAndroid ? (
<>
- <AndroidScreenHeader
- title="Files"
- subtitle={projectName}
- onBack={handleReturnToThread}
- hideBottomBorder={materialYouStyleLayoutActive}
- actions={[
- {
- accessibilityLabel: "Refresh files",
- icon: "arrow.clockwise",
- onPress: entriesQuery.refresh,
- },
- ]}
- />
- <View
- className={
- materialYouStyleLayoutActive
- ? "mx-4 my-2 min-h-12 flex-row items-center gap-2 rounded-full border border-input-border bg-input px-3.5"
- : "flex-row items-center gap-2 border-b border-border px-3 py-2"
- }
- >
- <SymbolView
- name="magnifyingglass"
- size={17}
- tintColorClassName={"accent-icon-muted"}
- type="monochrome"
+ {
+ <MaterialFilesHeader
+ projectName={projectName}
+ leading={<AndroidWorkspaceSidebarButton />}
+ searchQuery={searchQuery}
+ onSearchQueryChange={setSearchQuery}
+ onRefresh={entriesQuery.refresh}
+ onBack={handleReturnToThread}
/>
- <TextInput
- accessibilityLabel="Search files"
- autoCapitalize="none"
- autoCorrect={false}
- className={
- materialYouStyleLayoutActive
- ? "min-h-10 flex-1 py-2 text-sm text-foreground"
- : "min-h-10 flex-1 rounded-xl py-2 text-sm"
- }
- placeholder="Search files"
- value={searchQuery}
- onChangeText={setSearchQuery}
- />
- </View>
+ }
</>
) : (
<>
@@ -548,26 +521,28 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
)}
</>
)}
- <FileTreeBrowser
- key={JSON.stringify([environmentId, cwd])}
- entries={entriesQuery.entries}
- loadedDirectories={entriesQuery.loadedDirectories}
- onLoadDirectory={entriesQuery.loadDirectory}
- error={entriesQuery.error}
- isPending={entriesQuery.isPending}
- searchQuery={searchQuery}
- searchTruncated={entriesQuery.searchTruncated}
- selectedPath={null}
- onPreviewFile={handlePreviewFile}
- onRefresh={entriesQuery.refresh}
- onSelectFile={handleSelectFile}
- />
- <FilesToolbarBottomFade />
+ <MaterialScreenContent insetHorizontal={layout.usesSplitView}>
+ <FileTreeBrowser
+ key={JSON.stringify([environmentId, cwd])}
+ entries={entriesQuery.entries}
+ loadedDirectories={entriesQuery.loadedDirectories}
+ onLoadDirectory={entriesQuery.loadDirectory}
+ error={entriesQuery.error}
+ isPending={entriesQuery.isPending}
+ searchQuery={searchQuery}
+ searchTruncated={entriesQuery.searchTruncated}
+ selectedPath={null}
+ onPreviewFile={handlePreviewFile}
+ onRefresh={entriesQuery.refresh}
+ onSelectFile={handleSelectFile}
+ />
+ <FilesToolbarBottomFade />
+ </MaterialScreenContent>
</>
);
- return materialYouStyleLayoutActive ? (
- <View className="flex-1" style={{ backgroundColor: screenColor }}>
+ return Platform.OS === "android" ? (
+ <View className="flex-1" style={{ backgroundColor: headerColor }}>
{content}
</View>
) : (
@@ -933,6 +908,8 @@ export function ThreadFileScreen(props: ThreadFileRouteScreenProps) {
<AndroidScreenHeader
title={basename(relativePath)}
subtitle={headerSubtitle}
+ leading={<AndroidWorkspaceSidebarButton />}
+ hideBottomBorder
onBack={handleBack}
trailing={
<>
@@ -942,6 +919,7 @@ export function ThreadFileScreen(props: ThreadFileRouteScreenProps) {
panes.auxiliaryPaneVisible ? "Hide file navigator" : "Show file navigator"
}
icon="sidebar.right"
+ selected={panes.auxiliaryPaneVisible}
onPress={toggleAuxiliaryPane}
/>
) : null}
@@ -1007,25 +985,27 @@ export function ThreadFileScreen(props: ThreadFileRouteScreenProps) {
))}
</NativeHeaderToolbar.Menu>
</NativeHeaderToolbar>
- <FileContent
- key={previewKey}
- activeMode={resolvedActiveMode}
- cwd={cwd}
- environmentId={environmentId}
- previewUri={previewUri}
- previewFailure={assetPreview._tag === "Failure" ? assetPreview.reason : null}
- onRetryPreview={handleRetryPreview}
- videoSource={videoSource}
- mediaSource={mediaSource}
- resolveVideoUri={assetPreview.refresh}
- fileContents={fileData?.contents ?? null}
- fileError={fileQuery.error}
- initialLine={targetLine}
- relativePath={relativePath}
- threadId={threadId}
- truncated={fileData?.truncated ?? false}
- onRefresh={() => fileQuery.refresh()}
- />
+ <MaterialScreenContent>
+ <FileContent
+ key={previewKey}
+ activeMode={resolvedActiveMode}
+ cwd={cwd}
+ environmentId={environmentId}
+ previewUri={previewUri}
+ previewFailure={assetPreview._tag === "Failure" ? assetPreview.reason : null}
+ onRetryPreview={handleRetryPreview}
+ videoSource={videoSource}
+ mediaSource={mediaSource}
+ resolveVideoUri={assetPreview.refresh}
+ fileContents={fileData?.contents ?? null}
+ fileError={fileQuery.error}
+ initialLine={targetLine}
+ relativePath={relativePath}
+ threadId={threadId}
+ truncated={fileData?.truncated ?? false}
+ onRefresh={() => fileQuery.refresh()}
+ />
+ </MaterialScreenContent>
<FilePreviewModal
source={fullScreenPreview}
onRequestClose={() => setFullScreenPreview(null)}
diff --git a/apps/mobile/src/features/files/thread-file-navigator-pane.tsx b/apps/mobile/src/features/files/thread-file-navigator-pane.tsx
index 4bb847dc546..f62ba6b7abb 100644
--- a/apps/mobile/src/features/files/thread-file-navigator-pane.tsx
+++ b/apps/mobile/src/features/files/thread-file-navigator-pane.tsx
@@ -1,5 +1,6 @@
import type { EnvironmentId } from "@t3tools/contracts";
import { SymbolView } from "../../components/AppSymbol";
+import { MaterialScreenContent } from "../../components/MaterialScreenContent";
import { useCallback, useMemo, useState, type ComponentProps } from "react";
import { Platform, Pressable, View, type NativeSyntheticEvent } from "react-native";
import {
@@ -11,6 +12,7 @@ import {
} from "react-native-screens";
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
+import { MaterialFilesHeader } from "./MaterialFilesHeader";
import { nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
import { useUniwindTheme } from "../../lib/useUniwindTheme";
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
@@ -149,59 +151,68 @@ export function ThreadFileNavigatorPane(props: {
}
return (
- <View className="flex-1 border-l border-border bg-sheet">
- <View className="border-b border-border" style={{ paddingTop: props.headerInset }}>
- <View className="h-12 flex-row items-center gap-2 px-3">
- <View className="min-w-0 flex-1">
- <Text className="text-sm font-t3-bold text-foreground">Files</Text>
- <Text className="text-xs text-foreground-muted" numberOfLines={1}>
- {props.projectName}
- </Text>
+ <View
+ className={
+ Platform.OS === "android" ? "flex-1 bg-header" : "flex-1 border-l border-border bg-sheet"
+ }
+ >
+ <View
+ className={Platform.OS === "android" ? "bg-header" : "border-b border-border"}
+ style={{ paddingTop: Platform.OS === "android" ? 0 : props.headerInset }}
+ >
+ {Platform.OS === "android" ? (
+ <MaterialFilesHeader
+ projectName={props.projectName}
+ searchQuery={searchQuery}
+ onSearchQueryChange={setSearchQuery}
+ onRefresh={entriesQuery.refresh}
+ />
+ ) : (
+ <View className="h-12 flex-row items-center gap-2 px-3">
+ <View className="min-w-0 flex-1">
+ <Text className="text-sm font-t3-bold text-foreground">Files</Text>
+ <Text className="text-xs text-foreground-muted" numberOfLines={1}>
+ {props.projectName}
+ </Text>
+ </View>
+ <Pressable
+ accessibilityRole="button"
+ accessibilityLabel="Refresh files"
+ hitSlop={8}
+ className="h-8 w-8 items-center justify-center rounded-full active:bg-subtle"
+ onPress={entriesQuery.refresh}
+ >
+ <SymbolView
+ name="arrow.clockwise"
+ size={14}
+ tintColorClassName="accent-icon-muted"
+ type="monochrome"
+ />
+ </Pressable>
</View>
- <Pressable
- accessibilityRole="button"
- accessibilityLabel="Refresh files"
- hitSlop={8}
- className="h-8 w-8 items-center justify-center rounded-full active:bg-subtle"
- onPress={entriesQuery.refresh}
- >
+ )}
+ {Platform.OS !== "android" ? (
+ <View className="flex-row items-center gap-2 border-t border-border px-3 py-2">
<SymbolView
- name="arrow.clockwise"
- size={14}
- tintColorClassName={"accent-icon-muted"}
+ name="magnifyingglass"
+ size={15}
+ tintColorClassName="accent-icon-muted"
type="monochrome"
/>
- </Pressable>
- <Pressable
- accessibilityRole="button"
- accessibilityLabel="Close files"
- hitSlop={8}
- className="h-8 w-8 items-center justify-center rounded-full active:bg-subtle"
- onPress={toggleAuxiliaryPane}
- >
- <SymbolView name="xmark" size={14} tintColorClassName="accent-icon-muted" />
- </Pressable>
- </View>
- <View className="flex-row items-center gap-2 border-t border-border px-3 py-2">
- <SymbolView
- name="magnifyingglass"
- size={15}
- tintColorClassName={"accent-icon-muted"}
- type="monochrome"
- />
- <TextInput
- accessibilityLabel="Search files"
- autoCapitalize="none"
- autoCorrect={false}
- clearButtonMode="while-editing"
- className="min-h-10 flex-1 rounded-xl py-2 text-sm"
- placeholder="Search files"
- value={searchQuery}
- onChangeText={setSearchQuery}
- />
- </View>
+ <TextInput
+ accessibilityLabel="Search files"
+ autoCapitalize="none"
+ autoCorrect={false}
+ clearButtonMode="while-editing"
+ className="min-h-10 flex-1 rounded-xl py-2 text-sm"
+ placeholder="Search files"
+ value={searchQuery}
+ onChangeText={setSearchQuery}
+ />
+ </View>
+ ) : null}
</View>
- {fileTree}
+ <MaterialScreenContent insetHorizontal>{fileTree}</MaterialScreenContent>
</View>
);
}
diff --git a/apps/mobile/src/features/home/AndroidHomeFab.android.tsx b/apps/mobile/src/features/home/AndroidHomeFab.android.tsx
new file mode 100644
index 00000000000..012feb5ff68
--- /dev/null
+++ b/apps/mobile/src/features/home/AndroidHomeFab.android.tsx
@@ -0,0 +1,44 @@
+import { useCallback, useRef, useState, type ComponentProps } from "react";
+import { View, type NativeScrollEvent, type NativeSyntheticEvent } from "react-native";
+import { useSafeAreaInsets } from "react-native-safe-area-context";
+import { MaterialNewThreadButton } from "../../components/MaterialNewThreadButton";
+import type { AndroidHomeFabLayout as SharedAndroidHomeFabLayout } from "./AndroidHomeFab.shared";
+import { useWorkspaceState } from "../../state/workspace";
+import { MaterialFabScrollContext } from "./MaterialFabScrollContext";
+import { updateMaterialFabScroll } from "./material-fab-scroll";
+
+export function AndroidHomeFabLayout(props: ComponentProps<typeof SharedAndroidHomeFabLayout>) {
+ const insets = useSafeAreaInsets();
+ const { state } = useWorkspaceState();
+ const [expanded, setExpanded] = useState(true);
+ const scrollState = useRef({ anchor: 0, expanded: true });
+ const onScroll = useCallback((event: NativeSyntheticEvent<NativeScrollEvent>) => {
+ const { contentOffset, contentSize, layoutMeasurement } = event.nativeEvent;
+ const next = updateMaterialFabScroll(
+ scrollState.current,
+ contentOffset.y,
+ contentSize.height - layoutMeasurement.height,
+ );
+ if (next.expanded !== scrollState.current.expanded) setExpanded(next.expanded);
+ scrollState.current = next;
+ }, []);
+
+ return (
+ <View className="flex-1">
+ <MaterialFabScrollContext value={onScroll}>{props.children}</MaterialFabScrollContext>
+ {state.hasConnections ? (
+ <MaterialNewThreadButton
+ extended
+ expanded={expanded}
+ onPress={props.onStartNewTask}
+ className="absolute right-5"
+ style={{
+ bottom: props.sidebar
+ ? Math.max(insets.bottom, 12) + 6
+ : Math.max(insets.bottom, 16) + 16,
+ }}
+ />
+ ) : null}
+ </View>
+ );
+}
diff --git a/apps/mobile/src/features/home/AndroidHomeFab.shared.tsx b/apps/mobile/src/features/home/AndroidHomeFab.shared.tsx
new file mode 100644
index 00000000000..7962371c1e1
--- /dev/null
+++ b/apps/mobile/src/features/home/AndroidHomeFab.shared.tsx
@@ -0,0 +1,10 @@
+import type { ReactNode } from "react";
+
+/** Other platforms render the list without Android's floating action button. */
+export function AndroidHomeFabLayout(props: {
+ readonly onStartNewTask: () => void;
+ readonly children: ReactNode;
+ readonly sidebar?: boolean;
+}) {
+ return <>{props.children}</>;
+}
diff --git a/apps/mobile/src/features/home/AndroidHomeFab.tsx b/apps/mobile/src/features/home/AndroidHomeFab.tsx
index 6957a6dab04..89bbb2a26a9 100644
--- a/apps/mobile/src/features/home/AndroidHomeFab.tsx
+++ b/apps/mobile/src/features/home/AndroidHomeFab.tsx
@@ -1,48 +1 @@
-import type { ReactNode } from "react";
-import { Platform, Pressable, View } from "react-native";
-import { useSafeAreaInsets } from "react-native-safe-area-context";
-
-import { SymbolView } from "../../components/AppSymbol";
-
-/**
- * Android-only wrapper that overlays a bottom-right new-task FAB on a thread
- * list. Other platforms render children unchanged.
- */
-export function AndroidHomeFabLayout(props: {
- readonly onStartNewTask: () => void;
- readonly children: ReactNode;
-}) {
- if (Platform.OS !== "android") {
- return <>{props.children}</>;
- }
-
- return <AndroidHomeFab {...props} />;
-}
-
-function AndroidHomeFab(props: {
- readonly onStartNewTask: () => void;
- readonly children: ReactNode;
-}) {
- const insets = useSafeAreaInsets();
- return (
- <View className="flex-1">
- {props.children}
- <Pressable
- accessibilityLabel="New task"
- accessibilityRole="button"
- onPress={props.onStartNewTask}
- className="absolute right-5 size-14 items-center justify-center rounded-full bg-primary shadow-lg"
- style={{
- bottom: Math.max(insets.bottom, 16) + 16,
- }}
- >
- <SymbolView
- name="square.and.pencil"
- size={22}
- tintColorClassName={"accent-primary-foreground"}
- type="monochrome"
- />
- </Pressable>
- </View>
- );
-}
+export { AndroidHomeFabLayout } from "./AndroidHomeFab.shared";
diff --git a/apps/mobile/src/features/home/HomeHeader.tsx b/apps/mobile/src/features/home/HomeHeader.tsx
index f67c2bff0f6..bf4c28aa547 100644
--- a/apps/mobile/src/features/home/HomeHeader.tsx
+++ b/apps/mobile/src/features/home/HomeHeader.tsx
@@ -1,18 +1,11 @@
-import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import type { EnvironmentId, SidebarThreadSortOrder } from "@t3tools/contracts";
import type { MenuAction } from "@react-native-menu/menu";
-import Constants from "expo-constants";
+
import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
import { useCallback, useMemo, useRef } from "react";
-import { Platform, Pressable, Text as RNText, TextInput, View } from "react-native";
+import { Platform } from "react-native";
import type { SearchBarCommands } from "react-native-screens";
-import { useSafeAreaInsets } from "react-native-safe-area-context";
-import { ControlPillMenu } from "../../components/ControlPill";
-import { SymbolView } from "../../components/AppSymbol";
-import { T3Wordmark } from "../../components/T3Wordmark";
-import { HOME_HORIZONTAL_INSET } from "../../lib/layoutMetrics";
-import { resolveMobileStageLabel } from "../../lib/mobileBranding";
import { useUniwindTheme } from "../../lib/useUniwindTheme";
import { useThreadListV2Enabled } from "../threads/use-thread-list-v2-enabled";
import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
@@ -22,7 +15,7 @@ import {
NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED,
} from "../layout/native-mail-search-toolbar";
import type { HomeProjectSortOrder } from "./homeThreadList";
-import { WorkspaceConnectionTitle } from "./WorkspaceConnectionTitle";
+import { MaterialThreadListToolbar } from "./MaterialThreadListToolbar";
import {
buildHomeListFilterMenu,
type HomeListFilterMenuEnvironment,
@@ -67,9 +60,6 @@ function checkedMenuState(checked: boolean) {
}
function AndroidHomeHeader(props: HomeHeaderProps) {
- const { materialYouStyleLayoutActive } = useAppearancePreferences();
- const insets = useSafeAreaInsets();
- const stageLabel = resolveMobileStageLabel(Constants.expoConfig?.extra?.appVariant);
// Thread List v2 lays the list out in fixed creation order, so the
// sort/group filter controls would be silently ignored — hide them and
// key the "customized" icon state off the environment filter alone.
@@ -200,120 +190,15 @@ function AndroidHomeHeader(props: HomeHeaderProps) {
return (
<>
<NativeStackScreenOptions options={{ headerShown: false }} />
- <View
- className={
- materialYouStyleLayoutActive
- ? "bg-header pb-3"
- : "border-b border-header-border bg-header pb-3"
- }
- style={{
- paddingHorizontal: HOME_HORIZONTAL_INSET,
- paddingTop: Math.max(insets.top, 12),
- }}
- >
- <View className="w-full max-w-[720px] self-center gap-3">
- <View className="flex-row items-center gap-2.5">
- {/* Brand slot doubles as the connection status surface: while an
- environment reconnects, the lockup fades to a status label in
- place (no layout shift in the list below). */}
- <WorkspaceConnectionTitle
- grow
- onPress={props.onOpenEnvironments}
- brand={
- <View className="flex-row items-center gap-2">
- {/* Mirrors the desktop SidebarBrand: T3 mark + muted "Code". */}
- <T3Wordmark colorClassName="accent-icon" height={15} />
- <RNText className="-ml-0.5 text-[21px] font-t3-medium tracking-[-0.5px] text-foreground-muted">
- Code
- </RNText>
- <View className="rounded-full bg-subtle px-2 py-0.75">
- <RNText className="text-[11px] font-t3-bold tracking-[1.1px] text-foreground-muted uppercase">
- {stageLabel}
- </RNText>
- </View>
- </View>
- }
- />
-
- <ControlPillMenu
- actions={menuActions}
- isAnchoredToRight
- onPressAction={handleMenuAction}
- >
- <Pressable
- accessibilityLabel="Filter and sort threads"
- accessibilityRole="button"
- className="size-11 items-center justify-center rounded-full bg-subtle"
- >
- <SymbolView
- name={
- hasCustomListOptions
- ? "line.3.horizontal.decrease.circle.fill"
- : "line.3.horizontal.decrease.circle"
- }
- size={16}
- tintColorClassName={"accent-icon"}
- type="monochrome"
- />
- </Pressable>
- </ControlPillMenu>
- {/* Built identically to the filter button so the two circles
- match exactly (ControlPill sizes via Tailwind classes and
- resolves to a different box). */}
- <Pressable
- accessibilityLabel="Open settings"
- accessibilityRole="button"
- onPress={props.onOpenSettings}
- className="size-11 items-center justify-center rounded-full bg-subtle"
- >
- <SymbolView
- name="gearshape"
- size={18}
- tintColorClassName={"accent-icon"}
- type="monochrome"
- />
- </Pressable>
- </View>
-
- <View
- className={
- materialYouStyleLayoutActive
- ? "min-h-12 flex-row items-center gap-2.5 rounded-full border border-input-border bg-input px-3.5"
- : "min-h-12 flex-row items-center gap-2.5 rounded-2xl border border-input-border bg-input px-3.5"
- }
- >
- <SymbolView
- name="magnifyingglass"
- size={17}
- tintColorClassName={"accent-foreground-muted"}
- type="monochrome"
- />
- <TextInput
- accessibilityLabel="Search threads"
- autoCapitalize="none"
- onChangeText={props.onSearchQueryChange}
- placeholder="Search threads"
- placeholderTextColorClassName="accent-placeholder"
- className="flex-1 py-2.5 text-base font-sans text-foreground"
- value={props.searchQuery}
- />
- {props.searchQuery.length > 0 ? (
- <Pressable
- accessibilityLabel="Clear search"
- hitSlop={10}
- onPress={() => props.onSearchQueryChange("")}
- >
- <SymbolView
- name="xmark.circle.fill"
- size={17}
- tintColorClassName={"accent-foreground-muted"}
- type="monochrome"
- />
- </Pressable>
- ) : null}
- </View>
- </View>
- </View>
+ <MaterialThreadListToolbar
+ searchQuery={props.searchQuery}
+ onSearchQueryChange={props.onSearchQueryChange}
+ filterActions={menuActions}
+ filterCustomized={hasCustomListOptions}
+ onFilterAction={handleMenuAction}
+ onOpenSettings={props.onOpenSettings}
+ onOpenEnvironments={props.onOpenEnvironments}
+ />
</>
);
}
diff --git a/apps/mobile/src/features/home/HomeRouteScreen.tsx b/apps/mobile/src/features/home/HomeRouteScreen.tsx
index b2da5af8ed2..00060668ba5 100644
--- a/apps/mobile/src/features/home/HomeRouteScreen.tsx
+++ b/apps/mobile/src/features/home/HomeRouteScreen.tsx
@@ -11,7 +11,11 @@ import { useWorkspaceState } from "../../state/workspace";
import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
import { WorkspaceEmptyDetail } from "../layout/WorkspaceEmptyDetail";
-import { WorkspaceSidebarToolbar } from "../layout/workspace-sidebar-toolbar";
+import {
+ AndroidWorkspaceSidebarButton,
+ WorkspaceSidebarToolbar,
+} from "../layout/workspace-sidebar-toolbar";
+import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
import { checkForAppUpdateOnLaunch, startAppUpdateForegroundRecheck } from "../updates/app-updates";
import { AndroidHomeFabLayout } from "./AndroidHomeFab";
import { HomeScreen } from "./HomeScreen";
@@ -27,7 +31,7 @@ import { getConnectionAwareBrandHeaderOptions } from "./WorkspaceConnectionTitle
export function HomeRouteScreen() {
const { width: windowWidth } = useWindowDimensions();
- const { layout } = useAdaptiveWorkspaceLayout();
+ const { layout, panes } = useAdaptiveWorkspaceLayout();
const projects = useProjects();
const threads = useThreadShells();
const { environments: workspaceEnvironments, state: catalogState } = useWorkspaceState();
@@ -126,8 +130,24 @@ export function HomeRouteScreen() {
/>
}
/>
+ {Platform.OS === "android" ? (
+ <AndroidScreenHeader title="Threads" leading={<AndroidWorkspaceSidebarButton />} />
+ ) : null}
<WorkspaceEmptyDetail
- onStartNewTask={() => navigation.navigate("NewTaskSheet", { screen: "NewTask" })}
+ onAddConnection={
+ Platform.OS === "android" && !catalogState.hasConnections
+ ? () =>
+ navigation.navigate("SettingsSheet", {
+ screen: "SettingsContent",
+ params: { screen: "SettingsEnvironmentNew" },
+ })
+ : undefined
+ }
+ onStartNewTask={
+ Platform.OS === "android" && panes.primarySidebarVisible
+ ? undefined
+ : () => navigation.navigate("NewTaskSheet", { screen: "NewTask" })
+ }
/>
</>
);
diff --git a/apps/mobile/src/features/home/HomeScreen.tsx b/apps/mobile/src/features/home/HomeScreen.tsx
index a0d7bf7433e..80642147052 100644
--- a/apps/mobile/src/features/home/HomeScreen.tsx
+++ b/apps/mobile/src/features/home/HomeScreen.tsx
@@ -30,13 +30,13 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
import { cn } from "../../lib/cn";
import { AppText as Text } from "../../components/AppText";
import { EmptyState } from "../../components/EmptyState";
+import { MaterialFloatingActionButton } from "../../components/MaterialFloatingActionButton";
import type { WorkspaceEnvironment, WorkspaceState } from "../../state/workspaceModel";
import type { SavedRemoteConnection } from "../../lib/connection";
import { scopedProjectKey } from "../../lib/scopedEntities";
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/preferences";
import { useThreadSearch } from "../../state/queries";
-import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import { useThreadJumpShortcuts } from "../keyboard/threadKeyboardShortcuts";
import { useThreadListV2Enabled } from "../threads/use-thread-list-v2-enabled";
import { usePendingThreadOrder } from "../../state/thread-order";
@@ -83,6 +83,7 @@ import {
type HomeProjectSortOrder,
} from "./homeThreadList";
import { SwipeableScrollGateProvider, useSwipeableScrollGate } from "./thread-swipe-actions";
+import { useMaterialFabScroll } from "./MaterialFabScrollContext";
/* ─── Types ──────────────────────────────────────────────────────────── */
@@ -219,7 +220,6 @@ function HomeTopContentSpacer() {
/* ─── Main screen ────────────────────────────────────────────────────── */
export function HomeScreen(props: HomeScreenProps) {
- const { materialYouStyleLayoutActive } = useAppearancePreferences();
const [groupDisplayStates, setGroupDisplayStates] = useState<
ReadonlyMap<string, HomeGroupDisplayState>
>(() => new Map());
@@ -315,7 +315,9 @@ export function HomeScreen(props: HomeScreenProps) {
const handleScrollBeginDrag = useCallback(() => {
openSwipeableRef.current?.close();
}, []);
+ const onMaterialFabScroll = useMaterialFabScroll();
const { swipeEnabled, scrollGateHandlers } = useSwipeableScrollGate({
+ onScroll: onMaterialFabScroll,
onScrollBeginDrag: handleScrollBeginDrag,
});
@@ -1104,11 +1106,11 @@ export function HomeScreen(props: HomeScreenProps) {
if (!hasAnyThreads) {
return (
- <View className={materialYouStyleLayoutActive ? "flex-1 bg-header" : "flex-1 bg-screen"}>
+ <View className={Platform.OS === "android" ? "flex-1 bg-header" : "flex-1 bg-screen"}>
<View
className={cn(
"flex-1 items-center justify-center bg-screen px-8",
- materialYouStyleLayoutActive && "overflow-hidden rounded-t-[28px]",
+ Platform.OS === "android" && "overflow-hidden rounded-t-[28px]",
)}
style={{
paddingBottom: Math.max(insets.bottom, 24) + iosBottomToolbarClearance,
@@ -1121,11 +1123,22 @@ export function HomeScreen(props: HomeScreenProps) {
detail={emptyState.detail}
actionLabel={!props.catalogState.hasReadyEnvironment ? "Add environment" : undefined}
onAction={!props.catalogState.hasReadyEnvironment ? props.onAddConnection : undefined}
+ action={
+ Platform.OS === "android" && !props.catalogState.hasReadyEnvironment ? (
+ <MaterialFloatingActionButton
+ label="Add environment"
+ icon="plus"
+ variant="extended"
+ tone="primary"
+ onPress={props.onAddConnection}
+ />
+ ) : undefined
+ }
variant="plain"
/>
{emptyState.loading ? (
<View className="mt-4 items-center">
- <ActivityIndicator colorClassName={"accent-icon-muted"} />
+ <ActivityIndicator colorClassName="accent-icon-muted" />
</View>
) : null}
</View>
@@ -1142,41 +1155,72 @@ export function HomeScreen(props: HomeScreenProps) {
const listEmpty = !hasResults ? (
hasSearchQuery && threadSearch.isPending ? null : hasSearchQuery ? (
- <EmptyState title="No results" detail={`No threads matching "${props.searchQuery}".`} />
+ <EmptyState
+ title="No results"
+ detail={`No threads matching "${props.searchQuery}".`}
+ variant={Platform.OS === "android" ? "plain" : undefined}
+ />
) : selectedProjectScope !== null ? (
<EmptyState
title={`No threads in ${selectedProjectScope.title}`}
detail="Choose another project or create a new task."
+ variant={Platform.OS === "android" ? "plain" : undefined}
/>
) : selectedEnvironmentLabel ? (
<EmptyState
title={`No threads in ${selectedEnvironmentLabel}`}
detail="Choose another environment or create a new task."
+ variant={Platform.OS === "android" ? "plain" : undefined}
/>
) : (
- <EmptyState title="No threads yet" detail="Create a task to start a new coding session." />
+ <EmptyState
+ title="No threads yet"
+ detail="Create a task to start a new coding session."
+ variant={Platform.OS === "android" ? "plain" : undefined}
+ />
)
) : null;
// Use the v2 project scope for its empty state. Snoozed threads need no
// special empty state: their shelf header is a list row even while collapsed.
const v2ListEmpty =
hasSearchQuery && threadSearch.isPending ? null : hasSearchQuery ? (
- <EmptyState title="No results" detail={`No threads matching "${props.searchQuery}".`} />
+ <EmptyState
+ title="No results"
+ detail={`No threads matching "${props.searchQuery}".`}
+ variant={Platform.OS === "android" ? "plain" : undefined}
+ />
) : v2ScopedProjectGroup !== null ? (
<EmptyState
title={`No threads in ${v2ScopedProjectGroup.title}`}
detail="Choose another project or create a new task."
+ variant={Platform.OS === "android" ? "plain" : undefined}
/>
) : (
listEmpty
);
+ if (
+ Platform.OS === "android" &&
+ (threadListV2Enabled ? threadListV2Items.length === 0 : listLayout.items.length === 0)
+ ) {
+ return (
+ <View className="flex-1 bg-header">
+ <View
+ className="flex-1 items-center justify-center overflow-hidden rounded-t-[28px] bg-screen px-4"
+ style={{ paddingBottom: insets.bottom }}
+ >
+ {threadListV2Enabled ? v2ListEmpty : listEmpty}
+ </View>
+ </View>
+ );
+ }
+
if (threadListV2Enabled) {
return (
- <View className={materialYouStyleLayoutActive ? "flex-1 bg-header" : "flex-1 bg-screen"}>
+ <View className={Platform.OS === "android" ? "flex-1 bg-header" : "flex-1 bg-screen"}>
<View
className={
- materialYouStyleLayoutActive
+ Platform.OS === "android"
? "flex-1 overflow-hidden rounded-t-[28px] bg-screen"
: "flex-1 bg-screen"
}
@@ -1216,7 +1260,7 @@ export function HomeScreen(props: HomeScreenProps) {
paddingBottom:
Platform.OS === "ios"
? Math.max(insets.bottom, 24) + 96 + iosBottomToolbarClearance
- : Math.max(insets.bottom, 16) + 88,
+ : Math.max(insets.bottom, 16) + (Platform.OS === "android" ? 148 : 88),
}}
/>
</SwipeableScrollGateProvider>
@@ -1226,10 +1270,10 @@ export function HomeScreen(props: HomeScreenProps) {
}
return (
- <View className={materialYouStyleLayoutActive ? "flex-1 bg-header" : "flex-1 bg-screen"}>
+ <View className={Platform.OS === "android" ? "flex-1 bg-header" : "flex-1 bg-screen"}>
<View
className={
- materialYouStyleLayoutActive
+ Platform.OS === "android"
? "flex-1 overflow-hidden rounded-t-[28px] bg-screen"
: "flex-1 bg-screen"
}
@@ -1270,7 +1314,7 @@ export function HomeScreen(props: HomeScreenProps) {
paddingBottom:
Platform.OS === "ios"
? Math.max(insets.bottom, 24) + 24 + iosBottomToolbarClearance
- : Math.max(insets.bottom, 16) + 88,
+ : Math.max(insets.bottom, 16) + (Platform.OS === "android" ? 148 : 88),
}}
scrollIndicatorInsets={
Platform.OS === "ios"
diff --git a/apps/mobile/src/features/home/MaterialFabScrollContext.ts b/apps/mobile/src/features/home/MaterialFabScrollContext.ts
new file mode 100644
index 00000000000..de99c9ee7d7
--- /dev/null
+++ b/apps/mobile/src/features/home/MaterialFabScrollContext.ts
@@ -0,0 +1,10 @@
+import { createContext, useContext } from "react";
+import type { NativeScrollEvent, NativeSyntheticEvent } from "react-native";
+
+export const MaterialFabScrollContext = createContext<
+ ((event: NativeSyntheticEvent<NativeScrollEvent>) => void) | undefined
+>(undefined);
+
+export function useMaterialFabScroll() {
+ return useContext(MaterialFabScrollContext);
+}
diff --git a/apps/mobile/src/features/home/MaterialThreadListToolbar.tsx b/apps/mobile/src/features/home/MaterialThreadListToolbar.tsx
new file mode 100644
index 00000000000..397e6984f3a
--- /dev/null
+++ b/apps/mobile/src/features/home/MaterialThreadListToolbar.tsx
@@ -0,0 +1,178 @@
+import { useCallback, useEffect, useRef, useState, type ComponentProps } from "react";
+import {
+ BackHandler,
+ Keyboard,
+ Pressable,
+ TextInput,
+ View,
+ type LayoutChangeEvent,
+} from "react-native";
+import { useSafeAreaInsets } from "react-native-safe-area-context";
+import type { MenuAction } from "@react-native-menu/menu";
+
+import { AndroidHeaderIconButton } from "../../components/AndroidScreenHeader";
+import { CompactBrandTitle } from "../../components/CompactBrandTitle";
+import { MaterialFloatingActionButton } from "../../components/MaterialFloatingActionButton";
+import { AndroidAnchoredMenu } from "../../components/AndroidAnchoredMenu";
+import { ControlPillMenu } from "../../components/ControlPill";
+import { SymbolView } from "../../components/AppSymbol";
+import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
+import { WorkspaceConnectionTitle } from "./WorkspaceConnectionTitle";
+import { useWorkspaceState } from "../../state/workspace";
+import { useMaterialToolbarHeight } from "../../components/useMaterialToolbarHeight";
+
+/** One toolbar height for the compact list and expanded sidebar, including search. */
+export function MaterialThreadListToolbar(props: {
+ readonly searchQuery: string;
+ readonly onSearchQueryChange: (query: string) => void;
+ readonly filterActions: MenuAction[];
+ readonly filterCustomized: boolean;
+ readonly onFilterAction: NonNullable<ComponentProps<typeof ControlPillMenu>["onPressAction"]>;
+ readonly onOpenSettings: () => void;
+ readonly onOpenEnvironments: () => void;
+ readonly sidebar?: boolean;
+ readonly onLayout?: (event: LayoutChangeEvent) => void;
+ readonly onRequestVisibility?: () => void;
+}) {
+ const insets = useSafeAreaInsets();
+ const toolbarHeight = useMaterialToolbarHeight();
+ const { state } = useWorkspaceState();
+ const { onRequestVisibility, onSearchQueryChange } = props;
+ const searchRef = useRef<TextInput>(null);
+ const [searchOpen, setSearchOpen] = useState(false);
+ const searching = searchOpen || props.searchQuery.length > 0;
+ const openSearch = useCallback(() => {
+ onRequestVisibility?.();
+ setSearchOpen(true);
+ searchRef.current?.focus();
+ return true;
+ }, [onRequestVisibility]);
+ useHardwareKeyboardCommand("focusSearch", openSearch);
+
+ const closeSearch = useCallback(() => {
+ onSearchQueryChange("");
+ setSearchOpen(false);
+ Keyboard.dismiss();
+ }, [onSearchQueryChange]);
+
+ useEffect(() => {
+ if (!searching) return;
+ const subscription = BackHandler.addEventListener("hardwareBackPress", () => {
+ closeSearch();
+ return true;
+ });
+ return () => subscription.remove();
+ }, [closeSearch, searching]);
+
+ const filterIcon = props.filterCustomized
+ ? "line.3.horizontal.decrease.circle.fill"
+ : "line.3.horizontal.decrease.circle";
+ const searchField = (
+ <View className="h-12 min-w-0 flex-1 flex-row items-center gap-2 rounded-full border border-input-border bg-input px-3">
+ <SymbolView name="magnifyingglass" size={18} tintColorClassName="accent-foreground-muted" />
+ <TextInput
+ ref={searchRef}
+ accessibilityLabel="Search threads"
+ autoFocus={true}
+ autoCapitalize="none"
+ autoCorrect={false}
+ returnKeyType="search"
+ placeholder="Search"
+ placeholderTextColorClassName="accent-placeholder"
+ selectionColorClassName="accent-primary/32"
+ cursorColorClassName="accent-primary"
+ selectionHandleColorClassName="accent-primary"
+ className="min-w-0 flex-1 py-2 font-sans text-base text-foreground"
+ value={props.searchQuery}
+ onChangeText={onSearchQueryChange}
+ />
+ {props.searchQuery.length > 0 ? (
+ <Pressable
+ accessibilityLabel="Clear search"
+ accessibilityRole="button"
+ hitSlop={10}
+ onPress={() => {
+ props.onSearchQueryChange("");
+ searchRef.current?.focus();
+ }}
+ >
+ <SymbolView
+ name="xmark.circle.fill"
+ size={18}
+ tintColorClassName="accent-foreground-muted"
+ />
+ </Pressable>
+ ) : null}
+ </View>
+ );
+
+ return (
+ <>
+ <View
+ onLayout={props.onLayout}
+ className={
+ props.sidebar
+ ? "absolute inset-x-0 top-0 z-[4] bg-header px-2 pb-2"
+ : "bg-header px-2 pb-2"
+ }
+ style={{ paddingTop: Math.max(insets.top, 12) }}
+ >
+ <View className="flex-row items-center gap-1" style={{ minHeight: toolbarHeight }}>
+ {searching ? (
+ <>
+ <AndroidHeaderIconButton
+ accessibilityLabel="Close search"
+ icon="arrow.left"
+ onPress={closeSearch}
+ />
+ {searchField}
+ </>
+ ) : (
+ <>
+ {/* Match the visible inset of the trailing 48dp icon button. */}
+ <View className="min-w-0 flex-1 pl-4">
+ <WorkspaceConnectionTitle
+ grow
+ onPress={props.onOpenEnvironments}
+ brand={<CompactBrandTitle allowFontScaling={false} />}
+ />
+ </View>
+ <AndroidHeaderIconButton
+ accessibilityLabel="Search threads"
+ icon="magnifyingglass"
+ onPress={openSearch}
+ />
+ <AndroidHeaderIconButton
+ accessibilityLabel="Open settings"
+ icon="gearshape"
+ onPress={props.onOpenSettings}
+ />
+ </>
+ )}
+ </View>
+ </View>
+ {/* Sit 8dp above the 56dp extended New thread FAB. */}
+ {state.hasConnections ? (
+ <View
+ className="absolute right-5 z-[5]"
+ style={{
+ bottom:
+ (props.sidebar ? Math.max(insets.bottom, 12) + 6 : Math.max(insets.bottom, 16) + 16) +
+ 56 +
+ 8,
+ }}
+ >
+ <AndroidAnchoredMenu actions={props.filterActions} onPressAction={props.onFilterAction}>
+ {(open) => (
+ <MaterialFloatingActionButton
+ label="Filter and sort threads"
+ icon={filterIcon}
+ onPress={open}
+ />
+ )}
+ </AndroidAnchoredMenu>
+ </View>
+ ) : null}
+ </>
+ );
+}
diff --git a/apps/mobile/src/features/home/material-fab-scroll.test.ts b/apps/mobile/src/features/home/material-fab-scroll.test.ts
new file mode 100644
index 00000000000..c68613ed299
--- /dev/null
+++ b/apps/mobile/src/features/home/material-fab-scroll.test.ts
@@ -0,0 +1,40 @@
+import { describe, expect, it } from "vite-plus/test";
+
+import { updateMaterialFabScroll, type MaterialFabScrollState } from "./material-fab-scroll";
+
+describe("Material FAB scroll direction", () => {
+ const initial: MaterialFabScrollState = { anchor: 0, expanded: true };
+
+ it("shrinks scrolling down and expands scrolling up without returning to the top", () => {
+ const collapsed = updateMaterialFabScroll(initial, 80, 500);
+ expect(collapsed.expanded).toBe(false);
+ const lower = updateMaterialFabScroll(collapsed, 180, 500);
+ expect(lower.expanded).toBe(false);
+ expect(updateMaterialFabScroll(lower, 160, 500).expanded).toBe(true);
+ });
+
+ it("accumulates travel but ignores jitter around a direction change", () => {
+ let state = updateMaterialFabScroll(initial, 10, 500);
+ expect(state.expanded).toBe(true);
+ state = updateMaterialFabScroll(state, 14, 500);
+ expect(state.expanded).toBe(false);
+ state = updateMaterialFabScroll(state, 100, 500);
+ state = updateMaterialFabScroll(state, 95, 500);
+ state = updateMaterialFabScroll(state, 98, 500);
+ expect(state.expanded).toBe(false);
+ expect(updateMaterialFabScroll(state, 88, 500).expanded).toBe(true);
+ });
+
+ it("does not expand from bottom bounce or collapse from top bounce", () => {
+ const bottom = updateMaterialFabScroll(initial, 500, 500);
+ const bounce = updateMaterialFabScroll(bottom, 560, 500);
+ expect(updateMaterialFabScroll(bounce, 500, 500).expanded).toBe(false);
+ expect(updateMaterialFabScroll(initial, -50, 500)).toEqual(initial);
+ });
+
+ it("expands near the top and when filtering leaves a non-scrollable list", () => {
+ const collapsed = updateMaterialFabScroll(initial, 80, 500);
+ expect(updateMaterialFabScroll(collapsed, 5, 500).expanded).toBe(true);
+ expect(updateMaterialFabScroll(collapsed, 80, -20)).toEqual(initial);
+ });
+});
diff --git a/apps/mobile/src/features/home/material-fab-scroll.ts b/apps/mobile/src/features/home/material-fab-scroll.ts
new file mode 100644
index 00000000000..b8994680398
--- /dev/null
+++ b/apps/mobile/src/features/home/material-fab-scroll.ts
@@ -0,0 +1,17 @@
+export interface MaterialFabScrollState {
+ readonly anchor: number;
+ readonly expanded: boolean;
+}
+
+/** Ignore small direction changes and overscroll; always show the label at the top. */
+export function updateMaterialFabScroll(
+ state: MaterialFabScrollState,
+ offset: number,
+ maxOffset: number,
+): MaterialFabScrollState {
+ const y = Math.max(0, Math.min(offset, Math.max(0, maxOffset)));
+ if (y <= 8) return { anchor: y, expanded: true };
+ const anchor = state.expanded ? Math.min(state.anchor, y) : Math.max(state.anchor, y);
+ if (Math.abs(y - anchor) >= 12) return { anchor: y, expanded: !state.expanded };
+ return { anchor, expanded: state.expanded };
+}
diff --git a/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx b/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
index 185a3b157fc..834301b8089 100644
--- a/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+++ b/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
@@ -22,7 +22,7 @@ import {
useState,
type ReactNode,
} from "react";
-import { useWindowDimensions, View } from "react-native";
+import { Platform, useWindowDimensions, View } from "react-native";
import Animated, {
useAnimatedStyle,
useDerivedValue,
@@ -56,7 +56,6 @@ import {
} from "../keyboard/hardwareKeyboardCommands";
import { AndroidHomeFabLayout } from "../home/AndroidHomeFab";
import { HomeListOptionsProvider } from "../home/home-list-options";
-import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import { ThreadNavigationSidebar } from "../threads/ThreadNavigationSidebar";
import { WORKSPACE_PANE_TIMING } from "./workspace-pane-animation";
import { WorkspaceInspectorPane } from "./workspace-inspector-pane";
@@ -234,7 +233,6 @@ function AdaptiveWorkspaceLayoutContent(
},
) {
const projectGroupingMode = props.projectGroupingMode;
- const { materialYouStyleLayoutActive } = useAppearancePreferences();
const { width, height } = useWindowDimensions();
const pathname = props.pathname;
const navigation = useNavigation();
@@ -582,7 +580,7 @@ function AdaptiveWorkspaceLayoutContent(
style={sidebarAnimatedStyle}
>
<View className="flex-1" style={{ width: layout.listPaneWidth }}>
- <AndroidHomeFabLayout onStartNewTask={handleStartNewTask}>
+ <AndroidHomeFabLayout sidebar onStartNewTask={handleStartNewTask}>
<ThreadNavigationSidebar
width={layout.listPaneWidth}
visible={panes.primarySidebarVisible}
@@ -602,7 +600,7 @@ function AdaptiveWorkspaceLayoutContent(
) : null}
<View
className={
- materialYouStyleLayoutActive
+ Platform.OS === "android"
? "flex-1 overflow-hidden bg-header"
: "flex-1 overflow-hidden bg-screen"
}
@@ -611,7 +609,12 @@ function AdaptiveWorkspaceLayoutContent(
<View
collapsable={false}
style={
- contentSettledWidth !== null ? { flex: 1, width: contentSettledWidth } : { flex: 1 }
+ contentSettledWidth !== null
+ ? {
+ flex: 1,
+ width: contentSettledWidth,
+ }
+ : { flex: 1 }
}
>
<WorkspaceContentWidthContext
diff --git a/apps/mobile/src/features/layout/WorkspaceEmptyDetail.tsx b/apps/mobile/src/features/layout/WorkspaceEmptyDetail.tsx
index 18e2838f537..d5037c6c64d 100644
--- a/apps/mobile/src/features/layout/WorkspaceEmptyDetail.tsx
+++ b/apps/mobile/src/features/layout/WorkspaceEmptyDetail.tsx
@@ -1,40 +1,69 @@
-import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import { SymbolView } from "../../components/AppSymbol";
-import { Pressable, View } from "react-native";
+import { Platform, Pressable, View } from "react-native";
import { AppText as Text } from "../../components/AppText";
+import { MaterialNewThreadButton } from "../../components/MaterialNewThreadButton";
+import { MaterialFloatingActionButton } from "../../components/MaterialFloatingActionButton";
+import { EmptyState } from "../../components/EmptyState";
-export function WorkspaceEmptyDetail(props: { readonly onStartNewTask?: () => void }) {
- const { materialYouStyleLayoutActive } = useAppearancePreferences();
+export function WorkspaceEmptyDetail(props: {
+ readonly onStartNewTask?: () => void;
+ readonly onAddConnection?: () => void;
+}) {
return (
<View
className={
- materialYouStyleLayoutActive
+ Platform.OS === "android"
? "flex-1 items-center justify-center px-10"
: "flex-1 items-center justify-center bg-screen px-10"
}
>
- <View className="max-w-[360px] items-center gap-3">
- <SymbolView
- name="sidebar.left"
- size={34}
- tintColorClassName={"accent-icon-subtle"}
- type="hierarchical"
- />
- <Text className="text-center text-xl font-t3-bold">Select a thread</Text>
- <Text className="text-center text-base text-foreground-muted">
- Choose a thread from the sidebar or start a new task.
- </Text>
- {props.onStartNewTask ? (
- <Pressable
- accessibilityRole="button"
- className="mt-2 flex-row items-center gap-2 rounded-full bg-primary px-5 py-3 active:opacity-70"
- onPress={props.onStartNewTask}
- >
- <Text className="text-base font-t3-bold text-primary-foreground">New Task</Text>
- </Pressable>
- ) : null}
- </View>
+ {props.onAddConnection ? (
+ <View className="w-full max-w-[430px]">
+ <EmptyState
+ title="No environments connected"
+ detail="Add an environment to load projects and start coding sessions."
+ variant="plain"
+ action={
+ <MaterialFloatingActionButton
+ label="Add environment"
+ icon="plus"
+ variant="extended"
+ tone="primary"
+ onPress={props.onAddConnection}
+ />
+ }
+ />
+ </View>
+ ) : (
+ <View className="max-w-[360px] items-center gap-3">
+ <SymbolView
+ name="sidebar.left"
+ size={34}
+ tintColorClassName="accent-icon-subtle"
+ type="hierarchical"
+ />
+ <Text className="text-center text-xl font-t3-bold">Select a thread</Text>
+ <Text className="text-center text-base text-foreground-muted">
+ {Platform.OS === "android"
+ ? "Choose a thread from the sidebar or start a new thread."
+ : "Choose a thread from the sidebar or start a new task."}
+ </Text>
+ {props.onStartNewTask ? (
+ Platform.OS === "android" ? (
+ <MaterialNewThreadButton extended className="mt-2" onPress={props.onStartNewTask} />
+ ) : (
+ <Pressable
+ accessibilityRole="button"
+ className="mt-2 flex-row items-center gap-2 rounded-full bg-primary px-5 py-3 active:opacity-70"
+ onPress={props.onStartNewTask}
+ >
+ <Text className="text-base font-t3-bold text-primary-foreground">New Task</Text>
+ </Pressable>
+ )
+ ) : null}
+ </View>
+ )}
</View>
);
}
diff --git a/apps/mobile/src/features/layout/workspace-pane-divider.tsx b/apps/mobile/src/features/layout/workspace-pane-divider.tsx
index cf640f19106..01d9646e9c8 100644
--- a/apps/mobile/src/features/layout/workspace-pane-divider.tsx
+++ b/apps/mobile/src/features/layout/workspace-pane-divider.tsx
@@ -1,5 +1,5 @@
import { useCallback, useMemo, useRef, useState } from "react";
-import { Pressable, StyleSheet, View, type AccessibilityActionEvent } from "react-native";
+import { Platform, Pressable, StyleSheet, View, type AccessibilityActionEvent } from "react-native";
import { Gesture, GestureDetector } from "react-native-gesture-handler";
import { runOnJS } from "react-native-reanimated";
import { cn } from "../../lib/cn";
@@ -79,6 +79,7 @@ export function WorkspacePaneDivider(props: WorkspacePaneDividerProps) {
className={cn(
"h-full self-center bg-border opacity-70",
dragging ? "w-0.5 bg-primary opacity-100" : "w-px",
+ Platform.OS === "android" && !dragging && "opacity-0",
)}
style={[styles.line, dragging && styles.activeLine]}
/>
diff --git a/apps/mobile/src/features/layout/workspace-sidebar-toolbar.tsx b/apps/mobile/src/features/layout/workspace-sidebar-toolbar.tsx
index d07a003361e..26677327575 100644
--- a/apps/mobile/src/features/layout/workspace-sidebar-toolbar.tsx
+++ b/apps/mobile/src/features/layout/workspace-sidebar-toolbar.tsx
@@ -2,8 +2,26 @@ import { NativeHeaderToolbar } from "../../native/StackHeader";
import type { ReactNode } from "react";
import { Platform } from "react-native";
+import { AndroidHeaderIconButton } from "../../components/AndroidScreenHeader";
+
import { useAdaptiveWorkspaceLayout } from "./AdaptiveWorkspaceLayout";
+export function AndroidWorkspaceSidebarButton() {
+ const { layout, panes, togglePrimarySidebar } = useAdaptiveWorkspaceLayout();
+ if (Platform.OS !== "android" || !layout.usesSplitView) return null;
+
+ return (
+ <AndroidHeaderIconButton
+ accessibilityLabel={
+ panes.primarySidebarVisible ? "Hide thread sidebar" : "Show thread sidebar"
+ }
+ icon="sidebar.left"
+ selected={panes.primarySidebarVisible}
+ onPress={togglePrimarySidebar}
+ />
+ );
+}
+
export function WorkspaceSidebarToolbar(
props: {
readonly children?: ReactNode;
diff --git a/apps/mobile/src/features/projects/AddProjectScreen.tsx b/apps/mobile/src/features/projects/AddProjectScreen.tsx
index 5724abb138c..4da58b3309e 100644
--- a/apps/mobile/src/features/projects/AddProjectScreen.tsx
+++ b/apps/mobile/src/features/projects/AddProjectScreen.tsx
@@ -1,3 +1,7 @@
+import { MaterialListRow } from "../../components/MaterialListRow";
+import { SettingsScreen } from "../settings/components/SettingsScreen";
+import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
+import { MaterialButton } from "../../components/MaterialButton";
import {
addProjectRemoteSourceLabel,
addProjectRemoteSourcePathHint,
@@ -41,14 +45,13 @@ import {
import { CommonActions, StackActions, useNavigation } from "@react-navigation/native";
import { SymbolView } from "../../components/AppSymbol";
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
-import { ActivityIndicator, Alert, Pressable, ScrollView, View } from "react-native";
+import { Platform, ActivityIndicator, Alert, Pressable, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import * as Arr from "effect/Array";
import * as Cause from "effect/Cause";
import * as Order from "effect/Order";
import { AsyncResult } from "effect/unstable/reactivity";
import { cn } from "../../lib/cn";
-
import { useProjects, useServerConfigs, waitForProject } from "../../state/entities";
import { filesystemEnvironment } from "../../state/filesystem";
import { projectEnvironment } from "../../state/projects";
@@ -123,13 +126,19 @@ function sourceFromParam(value: string | string[] | undefined): AddProjectRemote
function SectionTitle(props: { readonly children: string }) {
return (
- <Text className="px-1 text-2xs font-t3-bold tracking-[0.7px] uppercase text-foreground-muted">
+ <Text
+ className={
+ Platform.OS === "android"
+ ? "px-4 text-sm font-t3-medium text-primary"
+ : "px-1 text-2xs font-t3-bold tracking-[0.7px] uppercase text-foreground-muted"
+ }
+ >
{props.children}
</Text>
);
}
-function AddProjectShell(props: { readonly children: ReactNode }) {
+function AddProjectShell(props: { readonly children: ReactNode; readonly title: string }) {
const insets = useSafeAreaInsets();
return (
@@ -138,25 +147,35 @@ function AddProjectShell(props: { readonly children: ReactNode }) {
// scroll-view frame correction mistakes this full-height wrapper for a
// "header" sibling, coercing the ScrollView to zero height (blank sheet
// as soon as the sheet re-lays-out, e.g. when the keyboard opens).
- <View collapsable={false} className="flex-1 bg-sheet">
+ <SettingsScreen title={props.title}>
<ScrollView
keyboardShouldPersistTaps="handled"
contentInsetAdjustmentBehavior="automatic"
contentContainerStyle={{
- paddingHorizontal: 20,
+ paddingHorizontal: Platform.OS === "android" ? 16 : 20,
paddingTop: 16,
paddingBottom: Math.max(insets.bottom, 18) + 18,
- gap: 10,
+ gap: Platform.OS === "android" ? 16 : 10,
}}
>
{props.children}
</ScrollView>
- </View>
+ </SettingsScreen>
);
}
function ListSection(props: { readonly children: ReactNode }) {
- return <View className="overflow-hidden rounded-[24px] bg-card">{props.children}</View>;
+ return (
+ <View
+ className={
+ Platform.OS === "android"
+ ? "overflow-hidden rounded-[28px] bg-card"
+ : "overflow-hidden rounded-[24px] bg-card"
+ }
+ >
+ {props.children}
+ </View>
+ );
}
function ListRow(props: {
@@ -169,6 +188,20 @@ function ListRow(props: {
readonly right?: ReactNode;
readonly onPress?: () => void;
}) {
+ if (Platform.OS === "android") {
+ return (
+ <MaterialListRow
+ title={props.title}
+ subtitle={props.subtitle}
+ leading={props.icon}
+ trailing={props.right}
+ disabled={props.disabled}
+ onPress={props.onPress}
+ accessibilityRole={props.selected !== undefined ? "radio" : "button"}
+ accessibilityState={props.selected !== undefined ? { checked: props.selected } : undefined}
+ />
+ );
+ }
return (
<Pressable
disabled={props.disabled}
@@ -203,7 +236,7 @@ function ListRow(props: {
<SymbolView
name="chevron.right"
size={13}
- tintColorClassName={"accent-chevron"}
+ tintColorClassName="accent-chevron"
type="monochrome"
/>
) : null}
@@ -218,6 +251,7 @@ function PrimaryActionButton(props: {
readonly loading?: boolean;
readonly onPress: () => void;
}) {
+ if (Platform.OS === "android") return <MaterialButton {...props} tone="primary" fullWidth />;
return (
<Pressable
disabled={props.disabled}
@@ -435,9 +469,18 @@ function SourceControlRow(props: {
: `Clone ${addProjectRemoteSourceLabel(props.source)} ${props.hint}`;
const icon =
props.source === "url" ? (
- <SymbolView name="link" size={17} tintColorClassName={"accent-icon"} type="monochrome" />
+ <SymbolView
+ name="link"
+ size={Platform.OS === "android" ? 24 : 17}
+ tintColorClassName="accent-icon"
+ type="monochrome"
+ />
) : (
- <SourceControlIcon kind={props.source} size={18} colorClassName="accent-icon" />
+ <SourceControlIcon
+ kind={props.source}
+ size={Platform.OS === "android" ? 24 : 18}
+ colorClassName="accent-icon"
+ />
);
if (!props.ready) {
@@ -482,7 +525,7 @@ export function AddProjectSourceScreen() {
);
return (
- <AddProjectShell>
+ <AddProjectShell title="Add project">
{selectedEnvironment === null ? <EmptyEnvironmentState /> : null}
{environmentOptions.length > 1 ? (
@@ -495,7 +538,7 @@ export function AddProjectSourceScreen() {
title={environment.label}
subtitle={
canCreateProjectInEnvironment(environment.connectionState)
- ? environment.environmentId
+ ? undefined
: connectionStatusText({
phase: environment.connectionState,
error: environment.connectionError,
@@ -505,7 +548,7 @@ export function AddProjectSourceScreen() {
icon={
<EnvironmentMachineSymbol
kind={environment.machine}
- size={17}
+ size={Platform.OS === "android" ? 24 : 17}
tintColorClassName="accent-icon"
/>
}
@@ -516,8 +559,8 @@ export function AddProjectSourceScreen() {
environment.environmentId === selectedEnvironment?.environmentId ? (
<SymbolView
name="checkmark"
- size={14}
- tintColorClassName={"accent-icon"}
+ size={Platform.OS === "android" ? 20 : 14}
+ tintColorClassName="accent-icon"
type="monochrome"
/>
) : null
@@ -538,8 +581,8 @@ export function AddProjectSourceScreen() {
icon={
<SymbolView
name="folder.badge.plus"
- size={17}
- tintColorClassName={"accent-icon"}
+ size={Platform.OS === "android" ? 24 : 17}
+ tintColorClassName="accent-icon"
type="monochrome"
/>
}
@@ -570,7 +613,7 @@ export function AddProjectSourceScreen() {
)}
</ListSection>
{discoveryState.isPending ? (
- <ActivityIndicator colorClassName={"accent-icon-muted"} />
+ <ActivityIndicator colorClassName="accent-icon-muted" />
) : null}
</>
) : null}
@@ -723,7 +766,7 @@ export function AddProjectRepositoryScreen(props: {
}, [environment, isSubmitting, lookupRepositoryQuery, repositoryInput, navigation, source]);
return (
- <AddProjectShell>
+ <AddProjectShell title={source === "url" ? "Git URL" : addProjectRemoteSourceLabel(source)}>
{error ? <ErrorBanner message={error} /> : null}
{environment ? (
<>
@@ -800,7 +843,7 @@ function FolderBrowser(props: {
<ListSection>
{browseState.isPending && browseState.data === null ? (
<View className="items-center py-5">
- <ActivityIndicator colorClassName={"accent-icon-muted"} />
+ <ActivityIndicator colorClassName="accent-icon-muted" />
</View>
) : null}
{browsePath.canBrowseUp ? (
@@ -809,8 +852,8 @@ function FolderBrowser(props: {
icon={
<SymbolView
name="arrow.turn.left.up"
- size={17}
- tintColorClassName={"accent-icon-muted"}
+ size={Platform.OS === "android" ? 24 : 17}
+ tintColorClassName="accent-icon-muted"
type="monochrome"
/>
}
@@ -832,8 +875,8 @@ function FolderBrowser(props: {
icon={
<SymbolView
name="folder"
- size={17}
- tintColorClassName={"accent-icon-muted"}
+ size={Platform.OS === "android" ? 24 : 17}
+ tintColorClassName="accent-icon-muted"
type="monochrome"
/>
}
@@ -882,7 +925,7 @@ export function AddProjectLocalFolderScreen(props: { readonly environmentId?: st
}, [createProject, environment, isBrowseNavigating, isSubmitting, pathInput]);
return (
- <AddProjectShell>
+ <AddProjectShell title="Local folder">
{error ? <ErrorBanner message={error} /> : null}
{environment ? (
<>
@@ -1025,7 +1068,7 @@ export function AddProjectDestinationScreen(props: {
]);
return (
- <AddProjectShell>
+ <AddProjectShell title="Clone destination">
{error ? <ErrorBanner message={error} /> : null}
{repositoryTitle ? (
<View className="rounded-[24px] bg-card px-4 py-3">
diff --git a/apps/mobile/src/features/review/ReviewSheet.tsx b/apps/mobile/src/features/review/ReviewSheet.tsx
index 22fa1bc5d50..0035f91e2d1 100644
--- a/apps/mobile/src/features/review/ReviewSheet.tsx
+++ b/apps/mobile/src/features/review/ReviewSheet.tsx
@@ -35,6 +35,8 @@ import { AppText as Text } from "../../components/AppText";
import { SymbolView } from "../../components/AppSymbol";
import { AndroidHeaderIconButton, AndroidScreenHeader } from "../../components/AndroidScreenHeader";
import { ControlPillMenu } from "../../components/ControlPill";
+import { MaterialScreenContent } from "../../components/MaterialScreenContent";
+import { cn } from "../../lib/cn";
import { environmentCatalog } from "../../connection/catalog";
import { useEnvironmentPresentation } from "../../state/presentation";
import { useAtomCommand } from "../../state/use-atom-command";
@@ -54,7 +56,10 @@ import { useSelectedThreadGitState } from "../../state/use-selected-thread-git-s
import { useSelectedThreadWorktree } from "../../state/use-selected-thread-worktree";
import { useThreadSelection } from "../../state/use-thread-selection";
import { vcsEnvironment } from "../../state/vcs";
-import { WorkspaceSidebarToolbar } from "../layout/workspace-sidebar-toolbar";
+import {
+ AndroidWorkspaceSidebarButton,
+ WorkspaceSidebarToolbar,
+} from "../layout/workspace-sidebar-toolbar";
import { ThreadGitMenu } from "../threads/ThreadGitControls";
import { useReviewCacheForThread } from "./reviewState";
import {
@@ -81,7 +86,12 @@ const SHOWCASE_ENABLED = process.env.EXPO_PUBLIC_SHOWCASE === "1";
const ReviewNotice = memo(function ReviewNotice(props: { readonly notice: string }) {
return (
- <View className="border-b border-warning-border bg-warning px-4 py-3">
+ <View
+ className={cn(
+ "bg-warning px-4 py-3",
+ Platform.OS === "android" ? "m-2 rounded-[20px]" : "border-b border-warning-border",
+ )}
+ >
<Text className="text-xs font-t3-bold uppercase text-warning-foreground">Partial diff</Text>
<Text className="text-xs leading-normal text-warning-foreground">{props.notice}</Text>
</View>
@@ -103,7 +113,7 @@ function ReviewSelectionActionBar(props: {
<SymbolView
name={props.onOpenComment ? "text.bubble" : "line.3.horizontal.decrease.circle"}
size={16}
- tintColorClassName={"accent-primary-foreground"}
+ tintColorClassName="accent-primary-foreground"
type="monochrome"
/>
<Text className="text-base font-t3-bold text-primary-foreground">{props.title}</Text>
@@ -143,7 +153,7 @@ function ReviewSelectionActionBar(props: {
<SymbolView
name="xmark"
size={16}
- tintColorClassName={"accent-primary-foreground"}
+ tintColorClassName="accent-primary-foreground"
type="monochrome"
/>
</Pressable>
@@ -174,9 +184,14 @@ const ReviewFileNavigatorRow = memo(function ReviewFileNavigatorRow(props: {
accessibilityRole="button"
accessibilityState={{ selected }}
className={
- selected
- ? "mt-1 min-h-12 justify-center rounded-xl bg-subtle-strong px-3 py-2"
- : "mt-1 min-h-12 justify-center rounded-xl px-3 py-2 active:bg-subtle"
+ Platform.OS === "android"
+ ? cn(
+ "mt-1 min-h-12 justify-center rounded-[20px] px-3 py-2 active:bg-subtle",
+ selected && "bg-thread-selected",
+ )
+ : selected
+ ? "mt-1 min-h-12 justify-center rounded-xl bg-subtle-strong px-3 py-2"
+ : "mt-1 min-h-12 justify-center rounded-xl px-3 py-2 active:bg-subtle"
}
onPress={handlePress}
>
@@ -323,16 +338,28 @@ function ReviewFileNavigator({
}
return (
- <View className="flex-1 border-l border-border bg-sheet">
- <View className="border-b border-border" style={{ paddingTop: headerInset }}>
- <View className="px-4 py-3">
- <Text className="text-sm font-t3-bold text-foreground">Changed files</Text>
- <Text className="text-xs text-foreground-muted">
- {files.length} {files.length === 1 ? "file" : "files"}
- </Text>
+ <View
+ className={
+ Platform.OS === "android" ? "flex-1 bg-header" : "flex-1 border-l border-border bg-sheet"
+ }
+ >
+ {Platform.OS === "android" ? (
+ <AndroidScreenHeader
+ title="Changed files"
+ subtitle={`${files.length} ${files.length === 1 ? "file" : "files"}`}
+ hideBottomBorder
+ />
+ ) : (
+ <View className="border-b border-border" style={{ paddingTop: headerInset }}>
+ <View className="px-4 py-3">
+ <Text className="text-sm font-t3-bold text-foreground">Changed files</Text>
+ <Text className="text-xs text-foreground-muted">
+ {files.length} {files.length === 1 ? "file" : "files"}
+ </Text>
+ </View>
</View>
- </View>
- {fileList}
+ )}
+ <MaterialScreenContent insetHorizontal>{fileList}</MaterialScreenContent>
</View>
);
}
@@ -632,23 +659,21 @@ export function ReviewSheet(props: ReviewSheetProps) {
parsedDiff.kind === "files" &&
NativeReviewDiffView !== null;
useRegisterWorkspaceInspector(showChangedFilesPane ? renderInspector : undefined);
- // Raw fallback renders the patch inline with no inspector content, so the
- // pane toggle would open an empty column — hide it in exactly that case.
- const showChangedFilesToggle =
- panes.supportsAuxiliaryPane &&
- !(
- !showConnectionNotice &&
- selectedSection !== null &&
- parsedDiff.kind === "files" &&
- NativeReviewDiffView === null
- );
+ // A toggle needs registered content; loading, errors and raw patches have no navigator pane.
+ const showChangedFilesToggle = panes.supportsAuxiliaryPane && showChangedFilesPane;
const listHeader = useMemo(() => {
const children: ReactElement[] = [];
if (error) {
children.push(
- <View key="review-error" className="border-b border-border bg-card px-4 py-3">
+ <View
+ key="review-error"
+ className={cn(
+ "bg-card px-4 py-3",
+ Platform.OS === "android" ? "m-2 rounded-[20px]" : "border-b border-border",
+ )}
+ >
<Text className="text-sm font-t3-bold text-foreground">Review unavailable</Text>
<Text className="text-xs leading-normal text-foreground-muted">{error}</Text>
</View>,
@@ -699,21 +724,35 @@ export function ReviewSheet(props: ReviewSheetProps) {
{isAndroid ? (
<AndroidScreenHeader
title="Review changes"
+ leading={<AndroidWorkspaceSidebarButton />}
+ hideBottomBorder
subtitle={androidHeaderSubtitle || "Select a diff"}
onBack={handleReturnToThread}
trailing={
- showSectionToolbar ? (
- <ControlPillMenu
- actions={androidSectionMenuActions}
- isAnchoredToRight
- onPressAction={handleAndroidSectionMenuAction}
- >
+ <>
+ {showChangedFilesToggle ? (
<AndroidHeaderIconButton
- accessibilityLabel="Select review diff"
- icon="ellipsis.circle"
+ accessibilityLabel={
+ panes.auxiliaryPaneVisible ? "Hide changed files" : "Show changed files"
+ }
+ icon="sidebar.right"
+ selected={panes.auxiliaryPaneVisible}
+ onPress={toggleAuxiliaryPane}
/>
- </ControlPillMenu>
- ) : null
+ ) : null}
+ {showSectionToolbar ? (
+ <ControlPillMenu
+ actions={androidSectionMenuActions}
+ isAnchoredToRight
+ onPressAction={handleAndroidSectionMenuAction}
+ >
+ <AndroidHeaderIconButton
+ accessibilityLabel="Select review diff"
+ icon="ellipsis.circle"
+ />
+ </ControlPillMenu>
+ ) : null}
+ </>
}
/>
) : null}
@@ -805,141 +844,187 @@ export function ReviewSheet(props: ReviewSheetProps) {
</NativeHeaderToolbar>
) : null}
- <View className="flex-1 bg-sheet">
- {showConnectionNotice ? (
- <View className="flex-1" style={{ paddingTop: topContentInset }}>
- <EnvironmentConnectionNotice
- environmentLabel={environment.presentation?.entry.target.label ?? "Environment"}
- connection={
- environment.presentation?.connection ?? {
- phase: "available",
- error: null,
- traceId: null,
+ <MaterialScreenContent>
+ <View className={Platform.OS === "android" ? "flex-1 bg-sheet-solid" : "flex-1 bg-sheet"}>
+ {showConnectionNotice ? (
+ <View className="flex-1" style={{ paddingTop: topContentInset }}>
+ <EnvironmentConnectionNotice
+ environmentLabel={environment.presentation?.entry.target.label ?? "Environment"}
+ connection={
+ environment.presentation?.connection ?? {
+ phase: "available",
+ error: null,
+ traceId: null,
+ }
}
- }
- resourceName="review"
- onRetry={handleRetryEnvironment}
- />
- </View>
- ) : selectedSection && parsedDiff.kind === "files" && NativeReviewDiffView ? (
- <View
- className="flex-1"
- style={{
- backgroundColor: nativeBridge.theme.background,
- }}
- >
+ resourceName="review"
+ onRetry={handleRetryEnvironment}
+ />
+ </View>
+ ) : selectedSection && parsedDiff.kind === "files" && NativeReviewDiffView ? (
<View
- className="min-w-0 flex-1"
- style={{ paddingTop: topContentInset + REVIEW_HEADER_SPACING }}
+ className="flex-1"
+ style={{
+ backgroundColor: nativeBridge.theme.background,
+ }}
>
- {listHeader}
- <View className="min-w-0 flex-1" collapsable={false}>
- <NativeReviewDiffView
- collapsable={false}
- testID="review-native-diff-view"
- refreshing={isPullRefreshing || isSelectedSectionPending || areFilePatchesPending}
- onPullToRefresh={() => void handlePullToRefresh()}
- style={StyleSheet.absoluteFill}
- appearanceScheme={selectedTheme}
- collapsedFileIdsJson={nativeBridge.collapsedFileIdsJson}
- collapsedCommentIdsJson={nativeBridge.collapsedCommentIdsJson}
- contentResetKey={`${reviewCache.threadKey}:${selectedSection.id}`}
- contentWidth={NATIVE_REVIEW_DIFF_CONTENT_WIDTH}
- nativeViewRef={nativeReviewDiffViewRef}
- rowHeight={nativeReviewDiffStyle.rowHeight}
- rowsJson={nativeBridge.rowsJson}
- selectedRowIdsJson={nativeBridge.selectedRowIdsJson}
- styleJson={nativeBridge.styleJson}
- themeJson={nativeBridge.themeJson}
- tokensPatchJson={nativeBridge.tokensPatchJson}
- tokensResetKey={nativeBridge.tokensResetKey}
- viewedFileIdsJson={nativeBridge.viewedFileIdsJson}
- onDebug={handleNativeDebug}
- onPressLine={commentSelection.onPressLine}
- onVisibleFileChange={handleVisibleFileChange}
- onToggleComment={nativeBridge.onToggleComment}
- onToggleFile={handleNativeToggleFile}
- onToggleViewedFile={handleNativeToggleViewedFile}
- />
+ <View
+ className="min-w-0 flex-1"
+ style={{ paddingTop: topContentInset + REVIEW_HEADER_SPACING }}
+ >
+ {listHeader}
+ <View className="min-w-0 flex-1" collapsable={false}>
+ <NativeReviewDiffView
+ collapsable={false}
+ testID="review-native-diff-view"
+ refreshing={
+ isPullRefreshing || isSelectedSectionPending || areFilePatchesPending
+ }
+ onPullToRefresh={() => void handlePullToRefresh()}
+ style={StyleSheet.absoluteFill}
+ appearanceScheme={selectedTheme}
+ collapsedFileIdsJson={nativeBridge.collapsedFileIdsJson}
+ collapsedCommentIdsJson={nativeBridge.collapsedCommentIdsJson}
+ contentResetKey={`${reviewCache.threadKey}:${selectedSection.id}`}
+ contentWidth={NATIVE_REVIEW_DIFF_CONTENT_WIDTH}
+ nativeViewRef={nativeReviewDiffViewRef}
+ rowHeight={nativeReviewDiffStyle.rowHeight}
+ rowsJson={nativeBridge.rowsJson}
+ selectedRowIdsJson={nativeBridge.selectedRowIdsJson}
+ styleJson={nativeBridge.styleJson}
+ themeJson={nativeBridge.themeJson}
+ tokensPatchJson={nativeBridge.tokensPatchJson}
+ tokensResetKey={nativeBridge.tokensResetKey}
+ viewedFileIdsJson={nativeBridge.viewedFileIdsJson}
+ onDebug={handleNativeDebug}
+ onPressLine={commentSelection.onPressLine}
+ onVisibleFileChange={handleVisibleFileChange}
+ onToggleComment={nativeBridge.onToggleComment}
+ onToggleFile={handleNativeToggleFile}
+ onToggleViewedFile={handleNativeToggleViewedFile}
+ />
+ </View>
</View>
</View>
- </View>
- ) : (
- <ScrollView
- contentInsetAdjustmentBehavior="never"
- contentInset={{ top: topContentInset, bottom: Math.max(insets.bottom, 18) + 18 }}
- contentOffset={{ x: 0, y: -topContentInset }}
- scrollIndicatorInsets={{
- top: topContentInset,
- bottom: Math.max(insets.bottom, 18) + 18,
- }}
- showsVerticalScrollIndicator={false}
- className="flex-1"
- refreshControl={
- // The native diff surface owns pull-to-refresh via onPullToRefresh;
- // the raw fallback (and empty states) need an explicit control —
- // iOS has no other refresh affordance here (the explicit
- // "Refresh current diff" menu is Android-only).
- <RefreshControl
- refreshing={isPullRefreshing || isSelectedSectionPending || areFilePatchesPending}
- onRefresh={() => void handlePullToRefresh()}
- />
- }
- >
- {listHeader}
- {!selectedSection ? (
- <View className="border-b border-border bg-card px-4 py-5">
- <Text className="text-sm font-t3-bold text-foreground">No review diffs</Text>
- <Text className="text-xs leading-normal text-foreground-muted">
- This thread has no ready turn diffs and the worktree diff is empty.
- </Text>
- </View>
- ) : selectedSection.isLoading && selectedSection.diff === null ? (
- <View className="items-center gap-3 border-b border-border bg-card px-4 py-6">
- <ActivityIndicator size="small" />
- <Text className="text-xs text-foreground-muted">Loading diff…</Text>
- </View>
- ) : parsedDiff.kind === "empty" ? (
- <View className="border-b border-border bg-card px-4 py-5">
- <Text className="text-sm font-t3-bold text-foreground">No changes</Text>
- <Text className="text-xs leading-normal text-foreground-muted">
- {selectedSection.subtitle ?? "This diff is empty."}
- </Text>
- </View>
- ) : parsedDiff.kind === "raw" ? (
- <View className="gap-3 border-b border-border bg-card px-4 py-4">
- <Text className="text-xs leading-normal text-foreground-muted">
- {parsedDiff.reason}
- </Text>
- <ScrollView horizontal showsHorizontalScrollIndicator={false} bounces={false}>
- <Text selectable className="font-mono text-xs leading-relaxed text-foreground">
- {parsedDiff.text}
+ ) : (
+ <ScrollView
+ contentContainerStyle={
+ Platform.OS === "android" && (parsedDiff.kind === "empty" || !selectedSection)
+ ? { flexGrow: 1, justifyContent: "center" }
+ : undefined
+ }
+ contentInsetAdjustmentBehavior="never"
+ contentInset={{ top: topContentInset, bottom: Math.max(insets.bottom, 18) + 18 }}
+ contentOffset={{ x: 0, y: -topContentInset }}
+ scrollIndicatorInsets={{
+ top: topContentInset,
+ bottom: Math.max(insets.bottom, 18) + 18,
+ }}
+ showsVerticalScrollIndicator={false}
+ className="flex-1"
+ refreshControl={
+ // The native diff surface owns pull-to-refresh via onPullToRefresh;
+ // the raw fallback (and empty states) need an explicit control —
+ // iOS has no other refresh affordance here (the explicit
+ // "Refresh current diff" menu is Android-only).
+ <RefreshControl
+ refreshing={isPullRefreshing || isSelectedSectionPending || areFilePatchesPending}
+ onRefresh={() => void handlePullToRefresh()}
+ />
+ }
+ >
+ {listHeader}
+ {!selectedSection ? (
+ <View
+ className={
+ Platform.OS === "android"
+ ? "items-center px-6 py-5"
+ : "border-b border-border bg-card px-4 py-5"
+ }
+ >
+ <Text className="text-sm font-t3-bold text-foreground">No review diffs</Text>
+ <Text
+ className={cn(
+ "text-xs leading-normal text-foreground-muted",
+ Platform.OS === "android" && "mt-2 text-center",
+ )}
+ >
+ This thread has no ready turn diffs and the worktree diff is empty.
</Text>
- </ScrollView>
- </View>
- ) : parsedDiff.kind === "files" ? (
- // The native diff surface could not be resolved on this binary;
- // degrade to the raw patch instead of crashing the app.
- <View className="gap-3 border-b border-border bg-card px-4 py-4">
- <Text className="text-xs leading-normal text-foreground-muted">
- Native diff view unavailable. Showing the raw patch.
- </Text>
- <ScrollView horizontal showsHorizontalScrollIndicator={false} bounces={false}>
- <Text selectable className="font-mono text-xs leading-relaxed text-foreground">
- {selectedSection?.diff ?? ""}
+ </View>
+ ) : selectedSection.isLoading && selectedSection.diff === null ? (
+ <View
+ className={cn(
+ "items-center gap-3 px-4 py-6",
+ Platform.OS !== "android" && "border-b border-border bg-card",
+ )}
+ >
+ <ActivityIndicator size="small" />
+ <Text className="text-xs text-foreground-muted">Loading diff…</Text>
+ </View>
+ ) : parsedDiff.kind === "empty" ? (
+ <View
+ className={
+ Platform.OS === "android"
+ ? "items-center px-6 py-5"
+ : "border-b border-border bg-card px-4 py-5"
+ }
+ >
+ <Text className="text-sm font-t3-bold text-foreground">No changes</Text>
+ <Text
+ className={cn(
+ "text-xs leading-normal text-foreground-muted",
+ Platform.OS === "android" && "mt-2 text-center",
+ )}
+ >
+ {selectedSection.subtitle ?? "This diff is empty."}
</Text>
- </ScrollView>
- </View>
- ) : null}
- </ScrollView>
- )}
- <ReviewSelectionActionBar
- bottomInset={insets.bottom}
- title={commentSelection.selectionAction?.title ?? null}
- onOpenComment={commentSelection.selectionAction?.onOpenComment ?? null}
- onClear={commentSelection.clearSelection}
- />
- </View>
+ </View>
+ ) : parsedDiff.kind === "raw" ? (
+ <View
+ className={cn(
+ "gap-3 bg-card px-4 py-4",
+ Platform.OS === "android" ? "m-2 rounded-[20px]" : "border-b border-border",
+ )}
+ >
+ <Text className="text-xs leading-normal text-foreground-muted">
+ {parsedDiff.reason}
+ </Text>
+ <ScrollView horizontal showsHorizontalScrollIndicator={false} bounces={false}>
+ <Text selectable className="font-mono text-xs leading-relaxed text-foreground">
+ {parsedDiff.text}
+ </Text>
+ </ScrollView>
+ </View>
+ ) : parsedDiff.kind === "files" ? (
+ // The native diff surface could not be resolved on this binary;
+ // degrade to the raw patch instead of crashing the app.
+ <View
+ className={cn(
+ "gap-3 bg-card px-4 py-4",
+ Platform.OS === "android" ? "m-2 rounded-[20px]" : "border-b border-border",
+ )}
+ >
+ <Text className="text-xs leading-normal text-foreground-muted">
+ Native diff view unavailable. Showing the raw patch.
+ </Text>
+ <ScrollView horizontal showsHorizontalScrollIndicator={false} bounces={false}>
+ <Text selectable className="font-mono text-xs leading-relaxed text-foreground">
+ {selectedSection?.diff ?? ""}
+ </Text>
+ </ScrollView>
+ </View>
+ ) : null}
+ </ScrollView>
+ )}
+ <ReviewSelectionActionBar
+ bottomInset={insets.bottom}
+ title={commentSelection.selectionAction?.title ?? null}
+ onOpenComment={commentSelection.selectionAction?.onOpenComment ?? null}
+ onClear={commentSelection.clearSelection}
+ />
+ </View>
+ </MaterialScreenContent>
</>
);
}
diff --git a/apps/mobile/src/features/review/nativeReviewDiffAdapter.test.ts b/apps/mobile/src/features/review/nativeReviewDiffAdapter.test.ts
index 7387adb567e..21c86a2beab 100644
--- a/apps/mobile/src/features/review/nativeReviewDiffAdapter.test.ts
+++ b/apps/mobile/src/features/review/nativeReviewDiffAdapter.test.ts
@@ -255,6 +255,31 @@ describe("createNativeReviewDiffTheme", () => {
}
});
+ it.each(["light", "dark"] as const)(
+ "preserves Material You RGBA hex channels and composites alpha in %s",
+ (appearance) => {
+ const variables = {
+ ...appTheme("material-you", appearance),
+ "--color-screen": "#101214FF",
+ "--color-sheet": "#20222480",
+ "--color-md-code-text": "#E3E2E6FF",
+ "--color-foreground-muted": "#C7C5D080",
+ "--color-border": "#44464F80",
+ "--color-primary": "#A8C7FAFF",
+ };
+ const theme = createNativeReviewDiffTheme(appearance, "material-you", variables);
+ expect(theme.background).toBe("#181a1c");
+ expect(theme.headerBackground).toBe(theme.background);
+ expect(theme.text).toBe("#e3e2e6");
+ expect(theme.mutedText).toBe("#707076");
+ expect(theme.border).toBe("#2e3036");
+ expect(theme.hunkText).toBe("#a8c7fa");
+ for (const color of Object.values(theme)) {
+ expect(color).toMatch(/^#[\da-f]{6}$/i);
+ }
+ },
+ );
+
it("uses the selected app palette for native code surfaces", () => {
const standard = createNativeReviewDiffTheme("dark", "t3-code", appTheme("t3-code", "dark"));
const iris = createNativeReviewDiffTheme("dark", "iris", appTheme("iris", "dark"));
diff --git a/apps/mobile/src/features/review/nativeReviewDiffAdapter.ts b/apps/mobile/src/features/review/nativeReviewDiffAdapter.ts
index 6cc56e8ceab..b35d561a249 100644
--- a/apps/mobile/src/features/review/nativeReviewDiffAdapter.ts
+++ b/apps/mobile/src/features/review/nativeReviewDiffAdapter.ts
@@ -19,7 +19,7 @@ import type { ReviewInlineComment } from "./reviewCommentSelection";
const NATIVE_REVIEW_MAX_WORD_DIFF_RANGE_COUNT = 4;
const NATIVE_REVIEW_MAX_WORD_DIFF_COVERAGE = 0.45;
-const NATIVE_HEX_COLOR = /^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i;
+const NATIVE_HEX_COLOR = /^#([\da-f]{2})([\da-f]{2})([\da-f]{2})([\da-f]{2})?$/i;
const NATIVE_RGBA_COLOR =
/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)(?:\s*,\s*([\d.]+))?\s*\)$/;
@@ -44,15 +44,19 @@ export function buildNativeReviewSnippetRows(
function opaqueNativeHexColor(color: string, background: string): string {
const hex = NATIVE_HEX_COLOR.exec(color);
- if (hex) return color;
+ if (hex && !hex[4]) return color;
const rgba = NATIVE_RGBA_COLOR.exec(color);
const backgroundHex = NATIVE_HEX_COLOR.exec(background);
- if (!rgba || !backgroundHex) return background;
+ if ((!hex && !rgba) || !backgroundHex) return background;
- const alpha = rgba[4] === undefined ? 1 : Math.min(1, Math.max(0, Number(rgba[4])));
+ const alpha = hex
+ ? Number.parseInt(hex[4] ?? "ff", 16) / 255
+ : rgba?.[4] === undefined
+ ? 1
+ : Math.min(1, Math.max(0, Number(rgba[4])));
const channels = [1, 2, 3].map((index) => {
- const foreground = Number(rgba[index]);
+ const foreground = hex ? Number.parseInt(hex[index] ?? "0", 16) : Number(rgba?.[index]);
const behind = Number.parseInt(backgroundHex[index] ?? "0", 16);
return Math.round(foreground * alpha + behind * (1 - alpha));
});
@@ -169,7 +173,11 @@ export function createNativeReviewDiffTheme(
// Swift expects #RRGGBB/#RRGGBBAA while Android expects #RRGGBB/#AARRGGBB.
// Flatten translucent app tokens onto the code surface so both native
// implementations receive the one unambiguous shared format.
- const background = opaqueNativeHexColor(appTheme["--color-sheet"], appTheme["--color-screen"]);
+ const screen = opaqueNativeHexColor(
+ appTheme["--color-screen"],
+ scheme === "dark" ? "#000000" : "#ffffff",
+ );
+ const background = opaqueNativeHexColor(appTheme["--color-sheet"], screen);
const nativeColor = (color: string) => opaqueNativeHexColor(color, background);
if (scheme === "dark") {
diff --git a/apps/mobile/src/features/settings/SettingsAppearanceRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsAppearanceRouteScreen.tsx
index a97193d6b6a..4fbfb98bfdd 100644
--- a/apps/mobile/src/features/settings/SettingsAppearanceRouteScreen.tsx
+++ b/apps/mobile/src/features/settings/SettingsAppearanceRouteScreen.tsx
@@ -1,26 +1,17 @@
-import { useNavigation } from "@react-navigation/native";
-import { Platform, ScrollView, View } from "react-native";
+import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
import { useSafeAreaInsets } from "react-native-safe-area-context";
-import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
-import { NativeStackScreenOptions } from "../../native/StackHeader";
+import { SettingsScreen } from "./components/SettingsScreen";
import { CodeAppearanceSection } from "./appearance/sections/CodeAppearanceSection";
import { TerminalAppearanceSection } from "./appearance/sections/TerminalAppearanceSection";
import { TextAppearanceSection } from "./appearance/sections/TextAppearanceSection";
import { ThemeAppearanceSection } from "./appearance/sections/ThemeAppearanceSection";
export function SettingsAppearanceRouteScreen() {
- const navigation = useNavigation();
const insets = useSafeAreaInsets();
return (
- <View collapsable={false} className="flex-1 bg-sheet">
- {Platform.OS === "android" ? (
- <>
- <NativeStackScreenOptions options={{ headerShown: false }} />
- <AndroidScreenHeader title="Appearance" onBack={() => navigation.goBack()} />
- </>
- ) : null}
+ <SettingsScreen title="Appearance">
<ScrollView
contentInsetAdjustmentBehavior="automatic"
showsVerticalScrollIndicator={false}
@@ -35,6 +26,6 @@ export function SettingsAppearanceRouteScreen() {
<TerminalAppearanceSection />
<CodeAppearanceSection />
</ScrollView>
- </View>
+ </SettingsScreen>
);
}
diff --git a/apps/mobile/src/features/settings/SettingsClientStorageRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsClientStorageRouteScreen.tsx
index bf66574717e..5c36b16cac2 100644
--- a/apps/mobile/src/features/settings/SettingsClientStorageRouteScreen.tsx
+++ b/apps/mobile/src/features/settings/SettingsClientStorageRouteScreen.tsx
@@ -1,8 +1,9 @@
+import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
import { useAtomSet, useAtomValue } from "@effect/atom-react";
import { type EnvironmentMachineKind, resolveEnvironmentMachineKind } from "@t3tools/contracts";
import { AsyncResult } from "effect/unstable/reactivity";
import { useMemo } from "react";
-import { ActivityIndicator, Alert, Pressable, ScrollView, View } from "react-native";
+import { ActivityIndicator, Alert, Pressable, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { AppText as Text } from "../../components/AppText";
@@ -16,6 +17,7 @@ import {
import { useServerConfigs } from "../../state/entities";
import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
import { SettingsSection } from "./components/SettingsSection";
+import { SettingsScreen } from "./components/SettingsScreen";
export function SettingsClientStorageRouteScreen() {
const insets = useSafeAreaInsets();
@@ -71,7 +73,7 @@ export function SettingsClientStorageRouteScreen() {
};
return (
- <View collapsable={false} className="flex-1 bg-sheet">
+ <SettingsScreen title="Client Storage">
<ScrollView
contentInsetAdjustmentBehavior="automatic"
contentInset={{ bottom: Math.max(insets.bottom, 18) }}
@@ -85,7 +87,7 @@ export function SettingsClientStorageRouteScreen() {
<SymbolView
name="exclamationmark.triangle"
size={28}
- tintColorClassName={"accent-danger-foreground"}
+ tintColorClassName="accent-danger-foreground"
type="monochrome"
weight="regular"
/>
@@ -123,7 +125,7 @@ export function SettingsClientStorageRouteScreen() {
<SymbolView
name="checkmark.circle"
size={28}
- tintColorClassName={"accent-icon"}
+ tintColorClassName="accent-icon"
type="monochrome"
weight="regular"
/>
@@ -146,16 +148,14 @@ export function SettingsClientStorageRouteScreen() {
<SymbolView
name="trash"
size={22}
- tintColorClassName={"accent-danger-foreground"}
+ tintColorClassName="accent-danger-foreground"
type="monochrome"
weight="regular"
/>
<Text className="flex-1 text-lg tabular-nums text-danger-foreground">
{summary ? `Clear ${formatBytes(summary.payloadBytes)}` : "Clear caches"}
</Text>
- {isClearing ? (
- <ActivityIndicator colorClassName={"accent-danger-foreground"} />
- ) : null}
+ {isClearing ? <ActivityIndicator colorClassName="accent-danger-foreground" /> : null}
</Pressable>
</SettingsSection>
<Text className="px-2 text-sm leading-normal text-foreground-muted">
@@ -169,7 +169,7 @@ export function SettingsClientStorageRouteScreen() {
) : null}
</View>
</ScrollView>
- </View>
+ </SettingsScreen>
);
}
diff --git a/apps/mobile/src/features/settings/SettingsEnvironmentsRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsEnvironmentsRouteScreen.tsx
index 653107d22bb..1ca43b5a73c 100644
--- a/apps/mobile/src/features/settings/SettingsEnvironmentsRouteScreen.tsx
+++ b/apps/mobile/src/features/settings/SettingsEnvironmentsRouteScreen.tsx
@@ -1,13 +1,14 @@
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
+import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
+import { NativeHeaderToolbar } from "../../native/StackHeader";
import { useNavigation } from "@react-navigation/native";
import { SymbolView } from "../../components/AppSymbol";
import type { EnvironmentId } from "@t3tools/contracts";
import { useCallback, useState } from "react";
-import { Platform, ScrollView, View } from "react-native";
+import { Platform, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { AppText as Text } from "../../components/AppText";
-import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
+import { SettingsScreen } from "./components/SettingsScreen";
import { CloudEnvironmentRows } from "../connection/CloudEnvironmentRows";
import { ConnectionEnvironmentRow } from "../connection/ConnectionEnvironmentRow";
import { GitHubRoutingSettings } from "../connection/GitHubRoutingSettings";
@@ -79,28 +80,21 @@ export function SettingsEnvironmentsRouteScreen() {
);
return (
- <View collapsable={false} className="flex-1 bg-sheet">
- {Platform.OS === "android" ? (
- <>
- {/* Android renders its own in-screen header instead of the native bar. */}
- <NativeStackScreenOptions options={{ headerShown: false }} />
- <AndroidScreenHeader
- title="Environments"
- onBack={() => navigation.goBack()}
- actions={[
- {
- accessibilityLabel: "Add environment",
- icon: "plus",
- onPress: () =>
- navigation.navigate("SettingsSheet", {
- screen: "SettingsContent",
- params: { screen: "SettingsEnvironmentNew" },
- }),
- },
- ]}
- />
- </>
- ) : (
+ <SettingsScreen
+ title="Environments"
+ actions={[
+ {
+ accessibilityLabel: "Add environment",
+ icon: "plus",
+ onPress: () =>
+ navigation.navigate("SettingsSheet", {
+ screen: "SettingsContent",
+ params: { screen: "SettingsEnvironmentNew" },
+ }),
+ },
+ ]}
+ >
+ {Platform.OS !== "android" ? (
<NativeHeaderToolbar placement="right">
<NativeHeaderToolbar.Button
icon="plus"
@@ -114,7 +108,7 @@ export function SettingsEnvironmentsRouteScreen() {
tintColor={headerIconColor}
/>
</NativeHeaderToolbar>
- )}
+ ) : null}
<ScrollView
contentInsetAdjustmentBehavior="automatic"
showsVerticalScrollIndicator={false}
@@ -177,6 +171,6 @@ export function SettingsEnvironmentsRouteScreen() {
/>
<GitHubRoutingSettings />
</ScrollView>
- </View>
+ </SettingsScreen>
);
}
diff --git a/apps/mobile/src/features/settings/SettingsOpenSourceLicensesRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsOpenSourceLicensesRouteScreen.tsx
index 16cb39e4b8c..efeca40e0ff 100644
--- a/apps/mobile/src/features/settings/SettingsOpenSourceLicensesRouteScreen.tsx
+++ b/apps/mobile/src/features/settings/SettingsOpenSourceLicensesRouteScreen.tsx
@@ -1,3 +1,4 @@
+import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
import { LegendList } from "@legendapp/list/react-native";
import { type StaticScreenProps, useNavigation } from "@react-navigation/native";
import {
@@ -8,18 +9,19 @@ import {
type ThirdPartyLicenseEntry,
} from "@t3tools/shared/thirdPartyLicenses";
import { useCallback, useMemo, useState } from "react";
-import { Linking, Platform, Pressable, ScrollView, View } from "react-native";
+import { Linking, Platform, Pressable, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
-import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
import { SymbolView } from "../../components/AppSymbol";
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
+import { SettingsScreen } from "./components/SettingsScreen";
import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
import {
createNativeMailSearchToolbarItem,
NATIVE_MAIL_SEARCH_TOOLBAR_CONTENT_INSET,
NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED,
} from "../layout/native-mail-search-toolbar";
+
import { getMobileThirdPartyLicenses } from "./mobileThirdPartyLicenses";
function useMobileThirdPartyLicenses() {
@@ -97,24 +99,18 @@ export function SettingsOpenSourceLicensesRouteScreen() {
if (!manifest) {
return (
- <View collapsable={false} className="flex-1 bg-sheet">
- {Platform.OS === "android" ? (
- <>
- <NativeStackScreenOptions options={{ headerShown: false }} />
- <AndroidScreenHeader title="Open source licenses" onBack={() => navigation.goBack()} />
- </>
- ) : null}
+ <SettingsScreen title="Open source licenses">
<View className="flex-1 items-center justify-center px-6">
<Text className="text-center text-base text-foreground-muted">
License notices are unavailable in this build.
</Text>
</View>
- </View>
+ </SettingsScreen>
);
}
return (
- <View collapsable={false} className="flex-1 bg-sheet">
+ <SettingsScreen title="Open source licenses">
{Platform.OS === "ios" ? (
<NativeStackScreenOptions
options={{
@@ -148,12 +144,7 @@ export function SettingsOpenSourceLicensesRouteScreen() {
<NativeHeaderToolbar.SearchBarSlot />
</NativeHeaderToolbar>
) : null}
- {Platform.OS === "android" ? (
- <>
- <NativeStackScreenOptions options={{ headerShown: false }} />
- <AndroidScreenHeader title="Open source licenses" onBack={() => navigation.goBack()} />
- </>
- ) : null}
+
<LegendList
className="flex-1"
contentContainerStyle={{
@@ -195,14 +186,13 @@ export function SettingsOpenSourceLicensesRouteScreen() {
renderItem={renderItem}
showsVerticalScrollIndicator={false}
/>
- </View>
+ </SettingsScreen>
);
}
type LicenseDetailProps = StaticScreenProps<{ readonly entryKey: string }>;
export function SettingsOpenSourceLicenseRouteScreen({ route }: LicenseDetailProps) {
- const navigation = useNavigation();
const insets = useSafeAreaInsets();
const manifest = useMobileThirdPartyLicenses();
const entry = manifest
@@ -212,30 +202,18 @@ export function SettingsOpenSourceLicenseRouteScreen({ route }: LicenseDetailPro
if (!entry) {
return (
- <View collapsable={false} className="flex-1 bg-sheet">
- {Platform.OS === "android" ? (
- <>
- <NativeStackScreenOptions options={{ headerShown: false }} />
- <AndroidScreenHeader title="License notice" onBack={() => navigation.goBack()} />
- </>
- ) : null}
+ <SettingsScreen title="License notice">
<View className="flex-1 items-center justify-center px-6">
<Text className="text-center text-base text-foreground-muted">
This license notice is unavailable.
</Text>
</View>
- </View>
+ </SettingsScreen>
);
}
return (
- <View collapsable={false} className="flex-1 bg-sheet">
- {Platform.OS === "android" ? (
- <>
- <NativeStackScreenOptions options={{ headerShown: false }} />
- <AndroidScreenHeader title="License notice" onBack={() => navigation.goBack()} />
- </>
- ) : null}
+ <SettingsScreen title="License notice">
<ScrollView
className="flex-1"
contentInsetAdjustmentBehavior="automatic"
@@ -275,6 +253,6 @@ export function SettingsOpenSourceLicenseRouteScreen({ route }: LicenseDetailPro
</Text>
</View>
</ScrollView>
- </View>
+ </SettingsScreen>
);
}
diff --git a/apps/mobile/src/features/settings/SettingsProjectGroupingRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsProjectGroupingRouteScreen.tsx
index 951168fefcf..5eb815098aa 100644
--- a/apps/mobile/src/features/settings/SettingsProjectGroupingRouteScreen.tsx
+++ b/apps/mobile/src/features/settings/SettingsProjectGroupingRouteScreen.tsx
@@ -1,14 +1,13 @@
+import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
import { useAtomSet, useAtomValue } from "@effect/atom-react";
-import { useNavigation } from "@react-navigation/native";
import type { SidebarProjectGroupingMode } from "@t3tools/contracts";
import { AsyncResult } from "effect/unstable/reactivity";
-import { Platform, Pressable, ScrollView, View } from "react-native";
+import { Pressable, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
-import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
import { AppText as Text } from "../../components/AppText";
import { SymbolView } from "../../components/AppSymbol";
-import { NativeStackScreenOptions } from "../../native/StackHeader";
+import { SettingsScreen } from "./components/SettingsScreen";
import {
mobileProjectGroupingModePatch,
resolveMobileProjectGroupingSettings,
@@ -39,7 +38,6 @@ const GROUPING_OPTIONS: ReadonlyArray<{
];
export function SettingsProjectGroupingRouteScreen() {
- const navigation = useNavigation();
const insets = useSafeAreaInsets();
const preferencesResult = useAtomValue(mobilePreferencesAtom);
const savePreferences = useAtomSet(updateMobilePreferencesAtom);
@@ -49,13 +47,7 @@ export function SettingsProjectGroupingRouteScreen() {
: null;
return (
- <View collapsable={false} className="flex-1 bg-sheet">
- {Platform.OS === "android" ? (
- <>
- <NativeStackScreenOptions options={{ headerShown: false }} />
- <AndroidScreenHeader title="Project Grouping" onBack={() => navigation.goBack()} />
- </>
- ) : null}
+ <SettingsScreen title="Project Grouping">
<ScrollView
contentInsetAdjustmentBehavior="automatic"
showsVerticalScrollIndicator={false}
@@ -99,6 +91,6 @@ export function SettingsProjectGroupingRouteScreen() {
))}
</SettingsSection>
</ScrollView>
- </View>
+ </SettingsScreen>
);
}
diff --git a/apps/mobile/src/features/settings/SettingsRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsRouteScreen.tsx
index dc4f1d2ee32..d32dcb3e682 100644
--- a/apps/mobile/src/features/settings/SettingsRouteScreen.tsx
+++ b/apps/mobile/src/features/settings/SettingsRouteScreen.tsx
@@ -1,3 +1,5 @@
+import { AutoSettleDaysField } from "./components/AutoSettleDaysField";
+import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
import { useAuth, useUser } from "@clerk/expo";
import { useAtomSet, useAtomValue } from "@effect/atom-react";
import Constants from "expo-constants";
@@ -8,7 +10,7 @@ import { SymbolView } from "../../components/AppSymbol";
import * as Effect from "effect/Effect";
import { AsyncResult } from "effect/unstable/reactivity";
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
-import { Alert, Linking, Platform, Pressable, ScrollView, View } from "react-native";
+import { Alert, Linking, Platform, Pressable, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import {
@@ -18,8 +20,7 @@ import {
settlePromise,
squashAtomCommandFailure,
} from "@t3tools/client-runtime/state/runtime";
-import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
-import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
+import { AppText as Text } from "../../components/AppText";
import { supportsAgentAwarenessPush } from "../agent-awareness/capabilities";
import {
openAndroidLiveUpdateSettings,
@@ -37,15 +38,12 @@ import { hasCloudPublicConfig, resolveRelayClerkTokenOptions } from "../cloud/pu
import { withNativeGlassHeaderItem } from "../layout/native-glass-header-items";
import { WorkspaceSidebarToolbar } from "../layout/workspace-sidebar-toolbar";
import { runtime } from "../../lib/runtime";
+import { cn } from "../../lib/cn";
import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/preferences";
import { serverEnvironment } from "../../state/server";
import { useAtomCommand } from "../../state/use-atom-command";
import { useEnvironments } from "../../state/environments";
-import {
- DEFAULT_SERVER_SETTINGS,
- MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
- MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
-} from "@t3tools/contracts";
+import { DEFAULT_SERVER_SETTINGS } from "@t3tools/contracts";
import { supportsSharedSettingsSync } from "@t3tools/client-runtime/state/shared-settings";
import { useThreadListV2Enabled } from "../threads/use-thread-list-v2-enabled";
import {
@@ -58,6 +56,7 @@ import { useSavedRemoteConnections } from "../../state/use-remote-environment-re
import { SettingsRow } from "./components/SettingsRow";
import { SettingsSection } from "./components/SettingsSection";
import { SettingsSwitchRow } from "./components/SettingsSwitchRow";
+import { SettingsScreen } from "./components/SettingsScreen";
import { resolveAgentAwarenessPlatformPresentation } from "./SettingsRouteScreen.logic";
import { planAutoSettleSettingsSync, type AutoSettleSettings } from "./autoSettleSettingsSync";
@@ -79,17 +78,16 @@ function useDeviceRegistered(): boolean {
export function SettingsRouteScreen() {
const navigation = useNavigation();
+ const content = hasCloudPublicConfig() ? (
+ <ConfiguredSettingsRouteScreen />
+ ) : (
+ <LocalSettingsRouteScreen />
+ );
return (
<>
<WorkspaceSidebarToolbar />
- {Platform.OS === "android" ? (
- <>
- {/* Android renders its own in-screen header instead of the native bar. */}
- <NativeStackScreenOptions options={{ headerShown: false }} />
- <AndroidScreenHeader title="Settings" onBack={() => navigation.goBack()} />
- </>
- ) : (
+ {Platform.OS !== "android" ? (
<NativeStackScreenOptions
options={{
unstable_headerRightItems:
@@ -107,8 +105,12 @@ export function SettingsRouteScreen() {
: undefined,
}}
/>
+ ) : null}
+ {Platform.OS === "android" ? (
+ <SettingsScreen title="Settings">{content}</SettingsScreen>
+ ) : (
+ content
)}
- {hasCloudPublicConfig() ? <ConfiguredSettingsRouteScreen /> : <LocalSettingsRouteScreen />}
</>
);
}
@@ -134,6 +136,7 @@ function LocalSettingsRouteScreen() {
icon="desktopcomputer"
label="Environments"
value={`${environmentCount}`}
+ valuePosition="trailing"
target="SettingsEnvironments"
/>
</SettingsSection>
@@ -516,6 +519,7 @@ function ConfiguredSettingsRouteScreen() {
icon="desktopcomputer"
label="Environments"
value={`${environmentCount}`}
+ valuePosition="trailing"
target="SettingsEnvironments"
/>
<SettingsSwitchRow
@@ -616,6 +620,7 @@ const AUTO_SETTLE_DEFAULT_DAYS = DEFAULT_SERVER_SETTINGS.sidebarAutoSettleAfterD
*/
function AutoSettleSettingsRows() {
const { environments } = useEnvironments();
+ const [pendingWrites, setPendingWrites] = useState(0);
const updateSettings = useAtomCommand(serverEnvironment.updateSettings, {
label: "server settings update",
reportFailure: true,
@@ -625,16 +630,17 @@ function AutoSettleSettingsRows() {
const reference = syncTargets[0] ?? null;
const referenceSettings = reference?.serverConfig?.settings ?? null;
- const [daysDraft, setDaysDraft] = useState<string | null>(null);
-
if (reference === null || referenceSettings === null) {
return null;
}
const writeToAll = (patch: Partial<AutoSettleSettings>) => {
- for (const environment of syncTargets) {
- void updateSettings({ environmentId: environment.environmentId, input: { patch } });
- }
+ setPendingWrites((count) => count + 1);
+ void Promise.allSettled(
+ syncTargets.map((environment) =>
+ updateSettings({ environmentId: environment.environmentId, input: { patch } }),
+ ),
+ ).finally(() => setPendingWrites((count) => count - 1));
};
const { patch: autoSettlePatch, mismatches } = planAutoSettleSettingsSync(
@@ -647,21 +653,6 @@ function AutoSettleSettingsRows() {
);
const afterDays = referenceSettings.sidebarAutoSettleAfterDays;
- const commitDays = () => {
- const draft = (daysDraft ?? "").trim();
- setDaysDraft(null);
- // Whole-string check so "3.5" and "3days" are rejected instead of
- // silently becoming 3 on every eligible sync target.
- const parsed = /^\d+$/.test(draft) ? Number(draft) : Number.NaN;
- if (
- Number.isInteger(parsed) &&
- parsed >= MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS &&
- parsed <= MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS &&
- parsed !== afterDays
- ) {
- writeToAll({ sidebarAutoSettleAfterDays: parsed });
- }
- };
return (
<>
@@ -674,28 +665,34 @@ function AutoSettleSettingsRows() {
<SettingsSwitchRow
icon="clock"
label="Auto-settle inactive threads"
- subtitle={afterDays === null ? undefined : `After ${afterDays} days without activity`}
value={afterDays !== null}
onValueChange={(value) =>
writeToAll({ sidebarAutoSettleAfterDays: value ? AUTO_SETTLE_DEFAULT_DAYS : null })
}
/>
{afterDays !== null ? (
- <View className="flex-row items-center gap-4 border-t border-border-subtle p-4">
- <Text className="flex-1 text-lg text-foreground">Days before auto-settle</Text>
- <TextInput
- className="min-h-10 w-20 rounded-xl px-3 py-2 text-center text-base"
- keyboardType="number-pad"
- returnKeyType="done"
- value={daysDraft ?? String(afterDays)}
- onChangeText={setDaysDraft}
- onBlur={commitDays}
- onSubmitEditing={commitDays}
- accessibilityLabel="Days before auto-settle"
+ <View
+ className={cn(
+ "flex-row items-center gap-4 px-4",
+ Platform.OS === "android" ? "min-h-14 py-3" : "py-4",
+ )}
+ >
+ <View style={{ width: Platform.OS === "android" ? 24 : 22 }} />
+ <Text
+ className={cn(
+ "flex-1 text-foreground",
+ Platform.OS === "android" ? "text-base" : "text-lg",
+ )}
+ >
+ Inactive days
+ </Text>
+ <AutoSettleDaysField
+ value={afterDays}
+ onValueChange={(value) => writeToAll({ sidebarAutoSettleAfterDays: value })}
/>
</View>
) : null}
- {mismatches.length > 0 ? (
+ {pendingWrites === 0 && mismatches.length > 0 ? (
<View className="flex-row items-center gap-4 border-t border-border-subtle p-4">
<View className="min-w-0 flex-1">
<Text className="text-lg text-foreground">Auto-settle defaults differ</Text>
@@ -705,14 +702,7 @@ function AutoSettleSettingsRows() {
</View>
<Pressable
accessibilityRole="button"
- onPress={() => {
- for (const mismatch of mismatches) {
- void updateSettings({
- environmentId: mismatch.environmentId,
- input: { patch: autoSettlePatch },
- });
- }
- }}
+ onPress={() => writeToAll(autoSettlePatch)}
className="rounded-full bg-subtle px-4 py-2 active:opacity-70"
>
<Text className="text-base font-t3-medium text-foreground">
@@ -831,7 +821,7 @@ function AppSettingsSection() {
<SymbolView
name="info.circle"
size={22}
- tintColorClassName={"accent-icon"}
+ tintColorClassName="accent-icon"
type="monochrome"
weight="regular"
/>
diff --git a/apps/mobile/src/features/settings/appearance/AppearancePreferencesProvider.tsx b/apps/mobile/src/features/settings/appearance/AppearancePreferencesProvider.tsx
index e6622e3269e..5e0426daaa0 100644
--- a/apps/mobile/src/features/settings/appearance/AppearancePreferencesProvider.tsx
+++ b/apps/mobile/src/features/settings/appearance/AppearancePreferencesProvider.tsx
@@ -51,9 +51,6 @@ interface AppearancePreferencesContextValue {
readonly themeIds: MobileThemeIds;
readonly themeMode: MobileThemeMode;
readonly themeAppearance: MobileThemeAppearance;
- readonly materialYouStyleLayoutEnabled: boolean;
- readonly materialYouStyleLayoutActive: boolean;
- readonly setMaterialYouStyleLayoutEnabled: (value: boolean) => void;
readonly systemColorsAvailable: boolean;
readonly systemColorsActive: boolean;
readonly themeVariables: MobileThemeVariables;
@@ -97,8 +94,6 @@ export function AppearancePreferencesProvider(props: { readonly children: ReactN
[resolvedThemeIds.dark, resolvedThemeIds.light],
);
const themeId = themeIds[themeAppearance];
- const materialYouStyleLayoutEnabled = storedPreferences?.materialYouStyleLayoutEnabled ?? false;
- const materialYouStyleLayoutActive = Platform.OS === "android" && materialYouStyleLayoutEnabled;
const systemColorsActive = themeId === "material-you" && isSystemColorsAvailable;
const [systemColorPalettes, setSystemColorPalettes] = useState(readSystemColorPalettes);
useEffect(() => {
@@ -120,7 +115,7 @@ export function AppearancePreferencesProvider(props: { readonly children: ReactN
}, []);
const themeVariablesByAppearance = useMemo(() => {
const resolve = (appearance: MobileThemeAppearance) => {
- const base = getMobileThemeRuntimeVariables(themeIds[appearance], appearance);
+ const base = getMobileThemeRuntimeVariables(themeIds[appearance], appearance, Platform.OS);
return themeIds[appearance] === "material-you" && systemColorPalettes
? materialYouPaletteToMobileThemeVariables(
systemColorPalettes[appearance],
@@ -247,13 +242,6 @@ export function AppearancePreferencesProvider(props: { readonly children: ReactN
[runtimeState, syncThemeRuntime, updateThemePreferences],
);
- const setMaterialYouStyleLayoutEnabled = useCallback(
- (value: boolean) => {
- updatePreferences({ materialYouStyleLayoutEnabled: value });
- },
- [updatePreferences],
- );
-
const setBaseFontSize = useCallback(
(value: number) => {
const current = appliedRuntimeStateRef.current ?? runtimeState;
@@ -293,9 +281,6 @@ export function AppearancePreferencesProvider(props: { readonly children: ReactN
themeAppearance,
systemColorsAvailable: isSystemColorsAvailable,
systemColorsActive,
- materialYouStyleLayoutEnabled,
- materialYouStyleLayoutActive,
- setMaterialYouStyleLayoutEnabled,
themeVariables,
themeVariablesByAppearance,
systemColorPalettes,
@@ -315,9 +300,6 @@ export function AppearancePreferencesProvider(props: { readonly children: ReactN
themeMode,
themeAppearance,
systemColorsActive,
- materialYouStyleLayoutEnabled,
- materialYouStyleLayoutActive,
- setMaterialYouStyleLayoutEnabled,
themeVariables,
themeVariablesByAppearance,
systemColorPalettes,
diff --git a/apps/mobile/src/features/settings/appearance/components/FontSizeSliderRow.android.tsx b/apps/mobile/src/features/settings/appearance/components/FontSizeSliderRow.android.tsx
new file mode 100644
index 00000000000..6588895f73a
--- /dev/null
+++ b/apps/mobile/src/features/settings/appearance/components/FontSizeSliderRow.android.tsx
@@ -0,0 +1,81 @@
+import { Host, Slider } from "@expo/ui/jetpack-compose";
+import { fillMaxWidth } from "@expo/ui/jetpack-compose/modifiers";
+import * as Haptics from "expo-haptics";
+import { useRef, type ComponentProps } from "react";
+import { View } from "react-native";
+
+import { AppText as Text } from "../../../../components/AppText";
+import { SymbolView } from "../../../../components/AppSymbol";
+import { useAppearancePreferences } from "../AppearancePreferencesProvider";
+import type { FontSizeSliderRow as SharedFontSizeSliderRow } from "./FontSizeSliderRow.shared";
+
+export function FontSizeSliderRow(props: ComponentProps<typeof SharedFontSizeSliderRow>) {
+ const {
+ themeAppearance,
+ systemColorsActive,
+ themeVariables: colors,
+ } = useAppearancePreferences();
+ const draft = useRef(props.value);
+ const commit = (value: number) => {
+ if (props.disabled) return;
+ const next = Math.min(
+ props.max,
+ Math.max(props.min, props.min + Math.round((value - props.min) / props.step) * props.step),
+ );
+ if (next === props.value) return;
+ void Haptics.selectionAsync().catch(() => undefined);
+ props.onChange(next);
+ };
+ return (
+ <View className={props.disabled ? "gap-2 p-4 opacity-45" : "gap-2 p-4"}>
+ <View className="flex-row items-center gap-4">
+ <SymbolView name={props.icon} size={24} tintColorClassName="accent-icon" />
+ <Text className="min-w-0 flex-1 text-base">{props.label}</Text>
+ <Text className="text-sm text-foreground-muted">{props.valueLabel}</Text>
+ </View>
+ <View
+ accessible
+ accessibilityLabel={props.label}
+ accessibilityRole="adjustable"
+ accessibilityState={{ disabled: Boolean(props.disabled) }}
+ accessibilityValue={{
+ min: props.min,
+ max: props.max,
+ now: props.value,
+ text: props.valueLabel,
+ }}
+ accessibilityActions={[{ name: "increment" }, { name: "decrement" }]}
+ onAccessibilityAction={({ nativeEvent }) => {
+ if (nativeEvent.actionName === "increment") commit(props.value + props.step);
+ else if (nativeEvent.actionName === "decrement") commit(props.value - props.step);
+ }}
+ >
+ <View importantForAccessibility="no-hide-descendants">
+ <Host
+ colorScheme={themeAppearance}
+ seedColor={systemColorsActive ? undefined : colors["--color-primary"]}
+ style={{ height: 48, width: "100%" }}
+ >
+ <Slider
+ min={props.min}
+ max={props.max}
+ value={props.value}
+ steps={Math.max(0, Math.round((props.max - props.min) / props.step) - 1)}
+ enabled={!props.disabled}
+ modifiers={[fillMaxWidth()]}
+ colors={{
+ thumbColor: colors["--color-primary"],
+ activeTrackColor: colors["--color-primary"],
+ inactiveTrackColor: colors["--color-secondary"],
+ }}
+ onValueChange={(value) => {
+ draft.current = value;
+ }}
+ onValueChangeFinished={() => commit(draft.current)}
+ />
+ </Host>
+ </View>
+ </View>
+ </View>
+ );
+}
diff --git a/apps/mobile/src/features/settings/appearance/components/FontSizeSliderRow.shared.tsx b/apps/mobile/src/features/settings/appearance/components/FontSizeSliderRow.shared.tsx
new file mode 100644
index 00000000000..98a17388485
--- /dev/null
+++ b/apps/mobile/src/features/settings/appearance/components/FontSizeSliderRow.shared.tsx
@@ -0,0 +1,211 @@
+import * as Haptics from "expo-haptics";
+import { SymbolView } from "../../../../components/AppSymbol";
+import { useCallback, useEffect, useMemo, useRef } from "react";
+import { View, type AccessibilityActionEvent } from "react-native";
+import { Gesture, GestureDetector } from "react-native-gesture-handler";
+import Animated, {
+ runOnJS,
+ useAnimatedStyle,
+ useSharedValue,
+ withTiming,
+} from "react-native-reanimated";
+import type { ComponentProps } from "react";
+
+import { AppText as Text } from "../../../../components/AppText";
+
+type SymbolName = ComponentProps<typeof SymbolView>["name"];
+
+const THUMB_SIZE = 26;
+const TRACK_HEIGHT = 4;
+const SNAP_ANIMATION = { duration: 120 } as const;
+
+function clampFraction(value: number): number {
+ "worklet";
+ return Math.min(1, Math.max(0, value));
+}
+
+export function FontSizeSliderRow(props: {
+ readonly disabled?: boolean;
+ readonly icon: SymbolName;
+ readonly label: string;
+ readonly valueLabel: string;
+ readonly min: number;
+ readonly max: number;
+ readonly step: number;
+ readonly value: number;
+ readonly onChange: (value: number) => void;
+}) {
+ const latest = useRef(props);
+ latest.current = props;
+
+ const { min, max, step, value, disabled } = props;
+ const fraction = (value - min) / (max - min);
+
+ const progress = useSharedValue(clampFraction(fraction));
+ const trackWidth = useSharedValue(0);
+ const dragging = useSharedValue(false);
+
+ useEffect(() => {
+ if (!dragging.value) {
+ progress.value = withTiming(clampFraction(fraction), SNAP_ANIMATION);
+ }
+ }, [dragging, fraction, progress]);
+
+ const commit = useCallback((next: number) => {
+ const current = latest.current;
+ if (current.disabled || next === current.value) {
+ return;
+ }
+ Haptics.selectionAsync().catch(() => undefined);
+ current.onChange(next);
+ }, []);
+
+ const gesture = useMemo(() => {
+ const snapValue = (raw: number): number => {
+ "worklet";
+ const stepped = Math.round((raw - min) / step) * step + min;
+ return Math.min(max, Math.max(min, stepped));
+ };
+ const fractionAt = (x: number): number => {
+ "worklet";
+ const usable = trackWidth.value - THUMB_SIZE;
+ if (usable <= 0) {
+ return 0;
+ }
+ return clampFraction((x - THUMB_SIZE / 2) / usable);
+ };
+ const valueAtFraction = (f: number): number => {
+ "worklet";
+ return snapValue(min + f * (max - min));
+ };
+ const fractionOfValue = (v: number): number => {
+ "worklet";
+ return clampFraction((v - min) / (max - min));
+ };
+
+ const pan = Gesture.Pan()
+ .enabled(!disabled)
+ .activeOffsetX([-8, 8])
+ .failOffsetY([-12, 12])
+ .onUpdate((event) => {
+ dragging.value = true;
+ const f = fractionAt(event.x);
+ progress.value = f;
+ })
+ .onFinalize((_event, success) => {
+ if (!dragging.value) {
+ return;
+ }
+ dragging.value = false;
+ if (!success) {
+ progress.value = withTiming(fractionOfValue(value), SNAP_ANIMATION);
+ return;
+ }
+ const next = valueAtFraction(progress.value);
+ progress.value = withTiming(fractionOfValue(next), SNAP_ANIMATION);
+ runOnJS(commit)(next);
+ });
+
+ const tap = Gesture.Tap()
+ .enabled(!disabled)
+ .onEnd((event) => {
+ const next = valueAtFraction(fractionAt(event.x));
+ progress.value = withTiming(fractionOfValue(next), SNAP_ANIMATION);
+ runOnJS(commit)(next);
+ });
+
+ return Gesture.Race(pan, tap);
+ }, [commit, disabled, dragging, max, min, progress, step, trackWidth, value]);
+
+ const fillStyle = useAnimatedStyle(() => ({
+ width: THUMB_SIZE / 2 + progress.value * Math.max(0, trackWidth.value - THUMB_SIZE),
+ }));
+ const thumbStyle = useAnimatedStyle(() => ({
+ transform: [{ translateX: progress.value * Math.max(0, trackWidth.value - THUMB_SIZE) }],
+ }));
+
+ const handleAccessibilityAction = (event: AccessibilityActionEvent) => {
+ if (event.nativeEvent.actionName === "increment") {
+ commit(Math.min(max, value + step));
+ } else if (event.nativeEvent.actionName === "decrement") {
+ commit(Math.max(min, value - step));
+ }
+ };
+
+ return (
+ <View className={disabled ? "gap-1 p-4 opacity-[0.45]" : "gap-1 p-4"}>
+ <View className="flex-row items-center gap-4">
+ <SymbolView
+ name={props.icon}
+ size={22}
+ tintColorClassName={"accent-icon"}
+ type="monochrome"
+ weight="regular"
+ />
+ <Text className="flex-1 text-lg text-foreground">{props.label}</Text>
+ <Text className="text-base font-t3-medium text-foreground-muted">{props.valueLabel}</Text>
+ </View>
+ <View className="flex-row items-center gap-3">
+ <SymbolView
+ name="textformat.size.smaller"
+ size={15}
+ tintColorClassName={"accent-icon-muted"}
+ type="monochrome"
+ weight="regular"
+ />
+ <GestureDetector gesture={gesture}>
+ <View
+ accessible
+ accessibilityActions={[
+ { name: "increment", label: `Increase ${props.label}` },
+ { name: "decrement", label: `Decrease ${props.label}` },
+ ]}
+ accessibilityLabel={props.label}
+ accessibilityRole="adjustable"
+ accessibilityState={{ disabled: Boolean(disabled) }}
+ accessibilityValue={{ min, max, now: value, text: props.valueLabel }}
+ className="h-11 flex-1 justify-center"
+ onAccessibilityAction={handleAccessibilityAction}
+ onLayout={(event) => {
+ trackWidth.value = event.nativeEvent.layout.width;
+ }}
+ >
+ <View
+ className="w-full rounded-full bg-secondary-border"
+ style={{ height: TRACK_HEIGHT }}
+ >
+ <Animated.View
+ className="absolute inset-y-0 left-0 rounded-full bg-primary"
+ style={fillStyle}
+ />
+ </View>
+ <Animated.View
+ className="absolute left-0 rounded-full border-border bg-primary-foreground"
+ style={[
+ {
+ borderWidth: 1,
+ height: THUMB_SIZE,
+ marginTop: -THUMB_SIZE / 2,
+ shadowColor: "#000000",
+ shadowOffset: { height: 2, width: 0 },
+ shadowOpacity: 0.18,
+ shadowRadius: 3,
+ top: "50%",
+ width: THUMB_SIZE,
+ },
+ thumbStyle,
+ ]}
+ />
+ </View>
+ </GestureDetector>
+ <SymbolView
+ name="textformat.size.larger"
+ size={22}
+ tintColorClassName={"accent-icon-muted"}
+ type="monochrome"
+ weight="regular"
+ />
+ </View>
+ </View>
+ );
+}
diff --git a/apps/mobile/src/features/settings/appearance/components/FontSizeSliderRow.tsx b/apps/mobile/src/features/settings/appearance/components/FontSizeSliderRow.tsx
index 7f33f9226d1..76f18645c0b 100644
--- a/apps/mobile/src/features/settings/appearance/components/FontSizeSliderRow.tsx
+++ b/apps/mobile/src/features/settings/appearance/components/FontSizeSliderRow.tsx
@@ -1,210 +1 @@
-import * as Haptics from "expo-haptics";
-import { SymbolView } from "../../../../components/AppSymbol";
-import { useCallback, useEffect, useMemo, useRef } from "react";
-import { View, type AccessibilityActionEvent } from "react-native";
-import { Gesture, GestureDetector } from "react-native-gesture-handler";
-import Animated, {
- runOnJS,
- useAnimatedStyle,
- useSharedValue,
- withTiming,
-} from "react-native-reanimated";
-import type { ComponentProps } from "react";
-
-import { AppText as Text } from "../../../../components/AppText";
-
-type SymbolName = ComponentProps<typeof SymbolView>["name"];
-
-const THUMB_SIZE = 26;
-const TRACK_HEIGHT = 4;
-const SNAP_ANIMATION = { duration: 120 } as const;
-
-function clampFraction(value: number): number {
- "worklet";
- return Math.min(1, Math.max(0, value));
-}
-
-export function FontSizeSliderRow(props: {
- readonly disabled?: boolean;
- readonly icon: SymbolName;
- readonly label: string;
- readonly valueLabel: string;
- readonly min: number;
- readonly max: number;
- readonly step: number;
- readonly value: number;
- readonly onChange: (value: number) => void;
-}) {
- const latest = useRef(props);
- latest.current = props;
-
- const { min, max, step, value, disabled } = props;
- const fraction = (value - min) / (max - min);
-
- const progress = useSharedValue(clampFraction(fraction));
- const trackWidth = useSharedValue(0);
- const dragging = useSharedValue(false);
-
- useEffect(() => {
- if (!dragging.value) {
- progress.value = withTiming(clampFraction(fraction), SNAP_ANIMATION);
- }
- }, [dragging, fraction, progress]);
-
- const commit = useCallback((next: number) => {
- const current = latest.current;
- if (next === current.value) {
- return;
- }
- Haptics.selectionAsync().catch(() => undefined);
- current.onChange(next);
- }, []);
-
- const gesture = useMemo(() => {
- const snapValue = (raw: number): number => {
- "worklet";
- const stepped = Math.round((raw - min) / step) * step + min;
- return Math.min(max, Math.max(min, stepped));
- };
- const fractionAt = (x: number): number => {
- "worklet";
- const usable = trackWidth.value - THUMB_SIZE;
- if (usable <= 0) {
- return 0;
- }
- return clampFraction((x - THUMB_SIZE / 2) / usable);
- };
- const valueAtFraction = (f: number): number => {
- "worklet";
- return snapValue(min + f * (max - min));
- };
- const fractionOfValue = (v: number): number => {
- "worklet";
- return clampFraction((v - min) / (max - min));
- };
-
- const pan = Gesture.Pan()
- .enabled(!disabled)
- .activeOffsetX([-8, 8])
- .failOffsetY([-12, 12])
- .onUpdate((event) => {
- dragging.value = true;
- const f = fractionAt(event.x);
- progress.value = f;
- })
- .onFinalize((_event, success) => {
- if (!dragging.value) {
- return;
- }
- dragging.value = false;
- if (!success) {
- progress.value = withTiming(fractionOfValue(value), SNAP_ANIMATION);
- return;
- }
- const next = valueAtFraction(progress.value);
- progress.value = withTiming(fractionOfValue(next), SNAP_ANIMATION);
- runOnJS(commit)(next);
- });
-
- const tap = Gesture.Tap()
- .enabled(!disabled)
- .onEnd((event) => {
- const next = valueAtFraction(fractionAt(event.x));
- progress.value = withTiming(fractionOfValue(next), SNAP_ANIMATION);
- runOnJS(commit)(next);
- });
-
- return Gesture.Race(pan, tap);
- }, [commit, disabled, dragging, max, min, progress, step, trackWidth, value]);
-
- const fillStyle = useAnimatedStyle(() => ({
- width: THUMB_SIZE / 2 + progress.value * Math.max(0, trackWidth.value - THUMB_SIZE),
- }));
- const thumbStyle = useAnimatedStyle(() => ({
- transform: [{ translateX: progress.value * Math.max(0, trackWidth.value - THUMB_SIZE) }],
- }));
-
- const handleAccessibilityAction = (event: AccessibilityActionEvent) => {
- if (event.nativeEvent.actionName === "increment") {
- commit(Math.min(max, value + step));
- } else if (event.nativeEvent.actionName === "decrement") {
- commit(Math.max(min, value - step));
- }
- };
-
- return (
- <View className={disabled ? "gap-1 p-4 opacity-[0.45]" : "gap-1 p-4"}>
- <View className="flex-row items-center gap-4">
- <SymbolView
- name={props.icon}
- size={22}
- tintColorClassName={"accent-icon"}
- type="monochrome"
- weight="regular"
- />
- <Text className="flex-1 text-lg text-foreground">{props.label}</Text>
- <Text className="text-base font-t3-medium text-foreground-muted">{props.valueLabel}</Text>
- </View>
- <View className="flex-row items-center gap-3">
- <SymbolView
- name="textformat.size.smaller"
- size={15}
- tintColorClassName={"accent-icon-muted"}
- type="monochrome"
- weight="regular"
- />
- <GestureDetector gesture={gesture}>
- <View
- accessible
- accessibilityActions={[
- { name: "increment", label: `Increase ${props.label}` },
- { name: "decrement", label: `Decrease ${props.label}` },
- ]}
- accessibilityLabel={props.label}
- accessibilityRole="adjustable"
- accessibilityValue={{ min, max, now: value, text: props.valueLabel }}
- className="h-11 flex-1 justify-center"
- onAccessibilityAction={handleAccessibilityAction}
- onLayout={(event) => {
- trackWidth.value = event.nativeEvent.layout.width;
- }}
- >
- <View
- className="w-full rounded-full bg-secondary-border"
- style={{ height: TRACK_HEIGHT }}
- >
- <Animated.View
- className="absolute inset-y-0 left-0 rounded-full bg-primary"
- style={fillStyle}
- />
- </View>
- <Animated.View
- className="absolute left-0 rounded-full border-border bg-primary-foreground"
- style={[
- {
- borderWidth: 1,
- height: THUMB_SIZE,
- marginTop: -THUMB_SIZE / 2,
- shadowColor: "#000000",
- shadowOffset: { height: 2, width: 0 },
- shadowOpacity: 0.18,
- shadowRadius: 3,
- top: "50%",
- width: THUMB_SIZE,
- },
- thumbStyle,
- ]}
- />
- </View>
- </GestureDetector>
- <SymbolView
- name="textformat.size.larger"
- size={22}
- tintColorClassName={"accent-icon-muted"}
- type="monochrome"
- weight="regular"
- />
- </View>
- </View>
- );
-}
+export { FontSizeSliderRow } from "./FontSizeSliderRow.shared";
diff --git a/apps/mobile/src/features/settings/appearance/sections/ThemeAppearanceSection.tsx b/apps/mobile/src/features/settings/appearance/sections/ThemeAppearanceSection.tsx
index a677cc5707d..788d04b047b 100644
--- a/apps/mobile/src/features/settings/appearance/sections/ThemeAppearanceSection.tsx
+++ b/apps/mobile/src/features/settings/appearance/sections/ThemeAppearanceSection.tsx
@@ -1,5 +1,5 @@
import { memo, useId } from "react";
-import { Platform, Pressable, View } from "react-native";
+import { Pressable, View } from "react-native";
import Svg, { Circle, Defs, RadialGradient, Stop } from "react-native-svg";
import { ScopedTheme, ScopedVariables } from "uniwind";
@@ -19,9 +19,6 @@ import { getMobileUniwindThemeName } from "../../../../lib/mobileThemeRuntime";
import { cn } from "../../../../lib/cn";
import { useAppearancePreferences } from "../AppearancePreferencesProvider";
-import { SettingsSection } from "../../components/SettingsSection";
-import { SettingsSwitchRow } from "../../components/SettingsSwitchRow";
-
const APPEARANCE_MODES: ReadonlyArray<{
readonly id: MobileThemeMode;
readonly label: string;
@@ -293,25 +290,11 @@ export function ThemeAppearanceSection() {
setThemeMode,
themeIds,
themeMode,
- materialYouStyleLayoutEnabled,
- setMaterialYouStyleLayoutEnabled,
systemColorsAvailable,
} = useAppearancePreferences();
return (
<View className="gap-6">
- {Platform.OS === "android" ? (
- <SettingsSection card title="Android">
- <SettingsSwitchRow
- disabled={!isReady}
- icon="square.grid.2x2"
- label="Material You Layout"
- onValueChange={setMaterialYouStyleLayoutEnabled}
- subtitle="Use Material You surfaces, shapes, and component styling."
- value={materialYouStyleLayoutEnabled}
- />
- </SettingsSection>
- ) : null}
<View className="gap-2">
<SectionLabel>Color scheme</SectionLabel>
<View accessibilityRole="radiogroup" className="flex-row gap-2">
diff --git a/apps/mobile/src/features/settings/components/AutoSettleDaysField.android.tsx b/apps/mobile/src/features/settings/components/AutoSettleDaysField.android.tsx
new file mode 100644
index 00000000000..bc9ccafecf7
--- /dev/null
+++ b/apps/mobile/src/features/settings/components/AutoSettleDaysField.android.tsx
@@ -0,0 +1,50 @@
+import {
+ MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
+ MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
+} from "@t3tools/contracts";
+import { View } from "react-native";
+
+import { AppText } from "../../../components/AppText";
+import { MaterialIconButton } from "../../../components/MaterialIconButton";
+import type { AutoSettleDaysFieldProps } from "./AutoSettleDaysField";
+
+export function AutoSettleDaysField(props: AutoSettleDaysFieldProps) {
+ const adjust = (amount: number) => {
+ const next = Math.max(
+ MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
+ Math.min(MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS, props.value + amount),
+ );
+ if (next !== props.value) props.onValueChange(next);
+ };
+
+ return (
+ <View className="shrink-0 flex-row items-center">
+ {/* Match the 32dp switch track while retaining 48dp button touch targets. */}
+ <View
+ pointerEvents="none"
+ className="absolute inset-x-0 rounded-full bg-subtle"
+ style={{ height: 32 }}
+ />
+ <MaterialIconButton
+ icon="minus"
+ accessibilityLabel="Decrease days before auto-settle"
+ disabled={props.value <= MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS}
+ onPress={() => adjust(-1)}
+ />
+ <AppText
+ className="min-w-8 text-center text-base"
+ style={{ fontVariant: ["tabular-nums"] }}
+ accessibilityLabel={`${props.value} ${props.value === 1 ? "day" : "days"} before auto-settle`}
+ accessibilityLiveRegion="polite"
+ >
+ {props.value}
+ </AppText>
+ <MaterialIconButton
+ icon="plus"
+ accessibilityLabel="Increase days before auto-settle"
+ disabled={props.value >= MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS}
+ onPress={() => adjust(1)}
+ />
+ </View>
+ );
+}
diff --git a/apps/mobile/src/features/settings/components/AutoSettleDaysField.ios.tsx b/apps/mobile/src/features/settings/components/AutoSettleDaysField.ios.tsx
new file mode 100644
index 00000000000..19a8998084c
--- /dev/null
+++ b/apps/mobile/src/features/settings/components/AutoSettleDaysField.ios.tsx
@@ -0,0 +1,94 @@
+import { Button, Host, HStack, Picker, Popover, Text, VStack } from "@expo/ui/swift-ui";
+import {
+ accessibilityLabel,
+ buttonStyle,
+ font,
+ foregroundStyle,
+ frame,
+ padding,
+ pickerStyle,
+ presentationBackground,
+ tag,
+} from "@expo/ui/swift-ui/modifiers";
+import {
+ MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
+ MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
+} from "@t3tools/contracts";
+import { useState } from "react";
+
+import { useAppearancePreferences } from "../appearance/AppearancePreferencesProvider";
+import type { AutoSettleDaysFieldProps } from "./AutoSettleDaysField";
+
+const days = Array.from(
+ { length: MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS - MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS + 1 },
+ (_, index) => MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS + index,
+);
+
+export function AutoSettleDaysField(props: AutoSettleDaysFieldProps) {
+ const { themeAppearance, themeVariables: colors, appearance } = useAppearancePreferences();
+ const [open, setOpen] = useState(false);
+ const [draft, setDraft] = useState(props.value);
+ return (
+ <Host matchContents colorScheme={themeAppearance} seedColor={colors["--color-primary"]}>
+ <Popover isPresented={open} onIsPresentedChange={setOpen}>
+ <Popover.Trigger>
+ <Button
+ onPress={() => {
+ setDraft(props.value);
+ setOpen(true);
+ }}
+ modifiers={[
+ buttonStyle("bordered"),
+ accessibilityLabel(`Days before auto-settle: ${props.value}`),
+ frame({ minWidth: 64, minHeight: 44 }),
+ foregroundStyle(colors["--color-primary"]),
+ font({ size: appearance.baseFontSize }),
+ ]}
+ >
+ <Text>{String(props.value)}</Text>
+ </Button>
+ </Popover.Trigger>
+ <Popover.Content>
+ <VStack
+ modifiers={[
+ padding({ all: 12 }),
+ frame({ width: 240 }),
+ presentationBackground(colors["--color-sheet-solid"]),
+ ]}
+ >
+ <Picker
+ label="Days before auto-settle"
+ selection={draft}
+ onSelectionChange={setDraft}
+ modifiers={[pickerStyle("wheel"), frame({ height: 180 })]}
+ >
+ {days.map((value) => (
+ <Text
+ key={value}
+ modifiers={[tag(value), foregroundStyle(colors["--color-foreground"])]}
+ >
+ {`${value} ${value === 1 ? "day" : "days"}`}
+ </Text>
+ ))}
+ </Picker>
+ <HStack spacing={24}>
+ <Button
+ label="Cancel"
+ onPress={() => setOpen(false)}
+ modifiers={[foregroundStyle(colors["--color-primary"])]}
+ />
+ <Button
+ label="Done"
+ onPress={() => {
+ setOpen(false);
+ if (draft !== props.value) props.onValueChange(draft);
+ }}
+ modifiers={[foregroundStyle(colors["--color-primary"])]}
+ />
+ </HStack>
+ </VStack>
+ </Popover.Content>
+ </Popover>
+ </Host>
+ );
+}
diff --git a/apps/mobile/src/features/settings/components/AutoSettleDaysField.tsx b/apps/mobile/src/features/settings/components/AutoSettleDaysField.tsx
new file mode 100644
index 00000000000..096cbaa4f2f
--- /dev/null
+++ b/apps/mobile/src/features/settings/components/AutoSettleDaysField.tsx
@@ -0,0 +1,42 @@
+import { useState } from "react";
+import {
+ MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
+ MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
+} from "@t3tools/contracts";
+
+import { AppTextInput } from "../../../components/AppText";
+
+export interface AutoSettleDaysFieldProps {
+ readonly value: number;
+ readonly onValueChange: (value: number) => void;
+}
+
+export function AutoSettleDaysField(props: AutoSettleDaysFieldProps) {
+ const [draft, setDraft] = useState<string | null>(null);
+ const commit = () => {
+ const text = (draft ?? "").trim();
+ setDraft(null);
+ // Validate the whole input; decimals and trailing text must not become whole days.
+ const parsed = /^\d+$/.test(text) ? Number(text) : Number.NaN;
+ if (
+ Number.isInteger(parsed) &&
+ parsed >= MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS &&
+ parsed <= MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS &&
+ parsed !== props.value
+ ) {
+ props.onValueChange(parsed);
+ }
+ };
+ return (
+ <AppTextInput
+ className="min-h-10 w-20 rounded-xl px-3 py-2 text-center text-base"
+ keyboardType="number-pad"
+ returnKeyType="done"
+ value={draft ?? String(props.value)}
+ onChangeText={setDraft}
+ onBlur={commit}
+ onSubmitEditing={commit}
+ accessibilityLabel="Days before auto-settle"
+ />
+ );
+}
diff --git a/apps/mobile/src/features/settings/components/SettingsRow.tsx b/apps/mobile/src/features/settings/components/SettingsRow.tsx
index f15f21b9ac8..2aa457ceeca 100644
--- a/apps/mobile/src/features/settings/components/SettingsRow.tsx
+++ b/apps/mobile/src/features/settings/components/SettingsRow.tsx
@@ -1,11 +1,12 @@
+import { MaterialListRow } from "../../../components/MaterialListRow";
import { useNavigation } from "@react-navigation/native";
import type { ComponentProps } from "react";
-import { Pressable, View } from "react-native";
+import { Platform, Pressable, View } from "react-native";
import { SymbolView } from "../../../components/AppSymbol";
-
import { AppText as Text } from "../../../components/AppText";
import type { SettingsLegalDocumentTarget, SettingsSheetTarget } from "./settings-sheet-targets";
+import { cn } from "../../../lib/cn";
type SymbolName = ComponentProps<typeof SymbolView>["name"];
@@ -14,44 +15,77 @@ export function SettingsRow(props: {
readonly icon: SymbolName;
readonly label: string;
readonly value?: string;
+ readonly valuePosition?: "below" | "trailing";
readonly target?: SettingsSheetTarget;
readonly fullScreenTarget?: SettingsLegalDocumentTarget;
readonly onPress?: () => void;
}) {
const navigation = useNavigation();
+ if (Platform.OS === "android") {
+ return (
+ <MaterialListRow
+ title={props.label}
+ subtitle={props.valuePosition === "trailing" ? undefined : props.value}
+ accessibilityLabel={[props.label, props.value].filter(Boolean).join(", ")}
+ trailing={
+ props.valuePosition === "trailing" && props.value ? (
+ <View className="flex-row items-center gap-3">
+ <Text className="text-sm text-foreground-muted">{props.value}</Text>
+ <SymbolView name="chevron.right" size={16} tintColorClassName="accent-chevron" />
+ </View>
+ ) : undefined
+ }
+ disabled={props.disabled}
+ leading={
+ <SymbolView
+ name={props.icon}
+ size={24}
+ tintColorClassName="accent-icon"
+ type="monochrome"
+ weight="regular"
+ />
+ }
+ onPress={() => {
+ if (props.target)
+ navigation.navigate("SettingsSheet", {
+ screen: "SettingsContent",
+ params: { screen: props.target },
+ });
+ else if (props.fullScreenTarget) navigation.navigate(props.fullScreenTarget);
+ else props.onPress?.();
+ }}
+ />
+ );
+ }
const content = (
- <View
- className={
- props.disabled
- ? "flex-row items-center gap-4 p-4 opacity-[0.45]"
- : "flex-row items-center gap-4 p-4"
- }
- >
+ <View className={cn("flex-row items-center gap-4 p-4", props.disabled && "opacity-[0.45]")}>
<SymbolView
name={props.icon}
size={22}
- tintColorClassName={"accent-icon"}
+ tintColorClassName="accent-icon"
type="monochrome"
weight="regular"
/>
- <Text className="shrink-0 text-lg text-foreground" numberOfLines={1}>
- {props.label}
- </Text>
- <View className="min-w-0 flex-1 items-end">
- {props.value ? (
- <Text
- className="max-w-[180px] text-right text-base text-foreground-muted"
- ellipsizeMode="middle"
- numberOfLines={1}
- >
- {props.value}
- </Text>
- ) : null}
- </View>
+ <>
+ <Text className="shrink-0 text-lg text-foreground" numberOfLines={1}>
+ {props.label}
+ </Text>
+ <View className="min-w-0 flex-1 items-end">
+ {props.value ? (
+ <Text
+ className="max-w-[180px] text-right text-base text-foreground-muted"
+ ellipsizeMode="middle"
+ numberOfLines={1}
+ >
+ {props.value}
+ </Text>
+ ) : null}
+ </View>
+ </>
<SymbolView
name="chevron.right"
size={16}
- tintColorClassName={"accent-chevron"}
+ tintColorClassName="accent-chevron"
type="monochrome"
weight="semibold"
/>
@@ -92,7 +126,12 @@ export function SettingsRow(props: {
}
return (
- <Pressable accessibilityRole="button" disabled={props.disabled} onPress={props.onPress}>
+ <Pressable
+ accessibilityLabel={props.label}
+ accessibilityRole="button"
+ disabled={props.disabled}
+ onPress={props.onPress}
+ >
{content}
</Pressable>
);
diff --git a/apps/mobile/src/features/settings/components/SettingsScreen.tsx b/apps/mobile/src/features/settings/components/SettingsScreen.tsx
new file mode 100644
index 00000000000..bf30b0e8714
--- /dev/null
+++ b/apps/mobile/src/features/settings/components/SettingsScreen.tsx
@@ -0,0 +1,43 @@
+import { useNavigation } from "@react-navigation/native";
+import type { ComponentProps, ReactNode } from "react";
+import { Platform, View } from "react-native";
+
+import { AndroidScreenHeader } from "../../../components/AndroidScreenHeader";
+import { MaterialScreenContent as SettingsScreenContent } from "../../../components/MaterialScreenContent";
+import { NativeStackScreenOptions } from "../../../native/StackHeader";
+import { AndroidWorkspaceSidebarButton } from "../../layout/workspace-sidebar-toolbar";
+
+export { SettingsScreenContent };
+
+export function SettingsScreen(
+ props: Pick<ComponentProps<typeof AndroidScreenHeader>, "title" | "actions" | "trailing"> & {
+ readonly children: ReactNode;
+ /** A native form sheet already owns its rounded outer frame. */
+ readonly formSheet?: boolean;
+ },
+) {
+ const navigation = useNavigation();
+
+ return (
+ <View collapsable={false} className="flex-1 bg-sheet">
+ {Platform.OS === "android" ? (
+ <>
+ <NativeStackScreenOptions options={{ headerShown: false }} />
+ <AndroidScreenHeader
+ title={props.title}
+ leading={props.formSheet ? undefined : <AndroidWorkspaceSidebarButton />}
+ actions={props.actions}
+ trailing={props.trailing}
+ onBack={() => navigation.goBack()}
+ hideBottomBorder={!props.formSheet}
+ />
+ </>
+ ) : null}
+ {props.formSheet ? (
+ props.children
+ ) : (
+ <SettingsScreenContent>{props.children}</SettingsScreenContent>
+ )}
+ </View>
+ );
+}
diff --git a/apps/mobile/src/features/settings/components/SettingsSection.tsx b/apps/mobile/src/features/settings/components/SettingsSection.tsx
index 6bea4ffe24a..9dbdc166154 100644
--- a/apps/mobile/src/features/settings/components/SettingsSection.tsx
+++ b/apps/mobile/src/features/settings/components/SettingsSection.tsx
@@ -1,5 +1,5 @@
import type { ReactNode } from "react";
-import { View } from "react-native";
+import { Platform, View } from "react-native";
import { AppText as Text } from "../../../components/AppText";
@@ -12,13 +12,23 @@ export function SettingsSection(props: {
return (
<View className="gap-2">
{props.title ? (
- <Text className="px-2 text-sm font-t3-medium text-foreground-muted">{props.title}</Text>
+ <Text
+ className={
+ Platform.OS === "android"
+ ? "px-4 text-sm font-t3-medium text-primary"
+ : "px-2 text-sm font-t3-medium text-foreground-muted"
+ }
+ >
+ {props.title}
+ </Text>
) : null}
<View
className={
- props.card
- ? "overflow-hidden rounded-[24px] border-continuous bg-card"
- : "overflow-hidden rounded-[24px] border-continuous bg-card android:bg-transparent"
+ Platform.OS === "android"
+ ? "overflow-hidden rounded-[28px] bg-card"
+ : props.card
+ ? "overflow-hidden rounded-[24px] border-continuous bg-card"
+ : "overflow-hidden rounded-[24px] border-continuous bg-card android:bg-transparent"
}
>
{props.children}
diff --git a/apps/mobile/src/features/settings/components/SettingsSwitchRow.tsx b/apps/mobile/src/features/settings/components/SettingsSwitchRow.tsx
index baf00321bd9..99bf0114f39 100644
--- a/apps/mobile/src/features/settings/components/SettingsSwitchRow.tsx
+++ b/apps/mobile/src/features/settings/components/SettingsSwitchRow.tsx
@@ -1,5 +1,6 @@
+import { cn } from "../../../lib/cn";
import type { ComponentProps } from "react";
-import { View } from "react-native";
+import { Platform, View } from "react-native";
import { SymbolView } from "../../../components/AppSymbol";
import { AppText as Text } from "../../../components/AppText";
@@ -17,21 +18,28 @@ export function SettingsSwitchRow(props: {
}) {
return (
<View
- className={
- props.disabled
- ? "flex-row items-center gap-4 p-4 opacity-[0.45]"
- : "flex-row items-center gap-4 p-4"
- }
+ className={cn(
+ "flex-row items-center gap-4",
+ Platform.OS === "android" ? "min-h-14 px-4 py-3" : "p-4",
+ Platform.OS === "android" && props.subtitle && "min-h-18",
+ props.disabled && "opacity-[0.45]",
+ )}
>
<SymbolView
name={props.icon}
- size={22}
- tintColorClassName={"accent-icon"}
+ size={Platform.OS === "android" ? 24 : 22}
+ tintColorClassName="accent-icon"
type="monochrome"
weight="regular"
/>
- <View className="min-w-0 flex-1">
- <Text className="text-lg text-foreground">{props.label}</Text>
+ <View className={cn("min-w-0 flex-1", Platform.OS === "android" && "gap-1")}>
+ <Text
+ className={
+ Platform.OS === "android" ? "text-base text-foreground" : "text-lg text-foreground"
+ }
+ >
+ {props.label}
+ </Text>
{props.subtitle ? (
<Text className="text-sm text-foreground-muted">{props.subtitle}</Text>
) : null}
diff --git a/apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx b/apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx
index e1928f297e6..e490200acf8 100644
--- a/apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx
+++ b/apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx
@@ -1,4 +1,3 @@
-import { BlurTargetView } from "expo-blur";
import { DEFAULT_TERMINAL_ID, EnvironmentId, ThreadId } from "@t3tools/contracts";
import { type KnownTerminalSession } from "@t3tools/client-runtime/state/terminal";
import type { MenuAction } from "@react-native-menu/menu";
@@ -7,6 +6,7 @@ import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/Stac
import { StackActions, useNavigation, type StaticScreenProps } from "@react-navigation/native";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Alert, Platform, Pressable, View } from "react-native";
+import { useSafeAreaInsets } from "react-native-safe-area-context";
import { AppText as Text } from "../../components/AppText";
import { TerminalContextSheet } from "./TerminalContextSheet";
import { hasNativeTerminalSurface } from "./nativeTerminalModule";
@@ -29,6 +29,9 @@ import { ControlPillMenu } from "../../components/ControlPill";
import { EmptyState } from "../../components/EmptyState";
import { GlassSurface } from "../../components/GlassSurface";
import { LoadingScreen } from "../../components/LoadingScreen";
+import { MaterialScreenContent } from "../../components/MaterialScreenContent";
+import { MaterialButton } from "../../components/MaterialButton";
+import { MaterialIconButton } from "../../components/MaterialIconButton";
import { environmentCatalog } from "../../connection/catalog";
import { useEnvironmentPresentation } from "../../state/presentation";
import { terminalEnvironment } from "../../state/terminal";
@@ -50,6 +53,7 @@ import { useThreadSelection } from "../../state/use-thread-selection";
import { useSelectedThreadDetail } from "../../state/use-thread-detail";
import { EnvironmentConnectionNotice } from "../connection/EnvironmentConnectionNotice";
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
+import { AndroidWorkspaceSidebarButton } from "../layout/workspace-sidebar-toolbar";
import { TerminalSurface } from "./NativeTerminalSurface";
import { getMobileTerminalTheme } from "./terminalTheme";
import { terminalDebugLog } from "./terminalDebugLog";
@@ -158,7 +162,7 @@ type ThreadTerminalRouteScreenProps = StaticScreenProps<{
}>;
export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps) {
- const terminalBlurTarget = useRef<View>(null);
+ const insets = useSafeAreaInsets();
const navigation = useNavigation();
const writeTerminal = useAtomCommand(terminalEnvironment.write, "terminal write");
const resizeTerminal = useAtomCommand(terminalEnvironment.resize, "terminal resize");
@@ -190,6 +194,7 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
themeAppearance: appearanceScheme,
themeId,
setTerminalFontSize,
+ themeVariables,
} = useAppearancePreferences();
const fontSize = appearance.terminalFontSize;
const cachedRouteGridSize =
@@ -515,6 +520,12 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
isVisible: state.isVisible,
}));
const isAccessoryVisible = keyboardState.isVisible && !isAccessoryDismissed;
+ // Android's terminal owns an EditText; turning off autoFocus also clears its native focus.
+ const terminalAutoFocus =
+ Platform.OS === "android"
+ ? !isAccessoryDismissed &&
+ (!SHOWCASE_ENABLED || keyboardFocusRequest > 0 || keyboardState.isVisible)
+ : !SHOWCASE_ENABLED;
const terminalBottomInset =
(keyboardState.isVisible ? keyboardState.height : 0) +
(isAccessoryVisible ? TERMINAL_ACCESSORY_HEIGHT : 0);
@@ -1103,6 +1114,7 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
}, []);
const handleShowKeyboard = useCallback(() => {
+ setIsAccessoryDismissed(false);
setKeyboardFocusRequest((current) => current + 1);
}, []);
const handleRetryEnvironment = useCallback(() => {
@@ -1175,22 +1187,10 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
<AndroidScreenHeader
title="Terminal"
subtitle={headerSubtitle}
+ leading={<AndroidWorkspaceSidebarButton />}
onBack={handleCloseTerminal}
trailing={
<>
- {layout.usesSplitView ? (
- <AndroidHeaderIconButton
- accessibilityLabel={
- panes.primarySidebarVisible ? "Maximize terminal" : "Show threads"
- }
- icon={
- panes.primarySidebarVisible
- ? "arrow.up.left.and.arrow.down.right"
- : "sidebar.left"
- }
- onPress={togglePrimarySidebar}
- />
- ) : null}
{isEnvironmentReady ? (
<ControlPillMenu
actions={androidTerminalMenuActions}
@@ -1280,162 +1280,188 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
</NativeHeaderToolbar>
) : null}
- <View className="flex-1" style={{ backgroundColor: terminalTheme.background }}>
- {!isEnvironmentReady ? (
- <EnvironmentConnectionNotice
- environmentLabel={
- environment.presentation?.entry.target.label ??
- selectedEnvironmentConnection?.environmentLabel ??
- "Environment"
- }
- connection={
- environment.presentation?.connection ?? {
- phase: "available",
- error: null,
- traceId: null,
+ <MaterialScreenContent>
+ <View
+ className="flex-1"
+ style={{
+ backgroundColor:
+ Platform.OS === "android"
+ ? themeVariables["--color-card-alt"]
+ : terminalTheme.background,
+ paddingBottom:
+ Platform.OS === "android" && !keyboardState.isVisible ? insets.bottom : 0,
+ }}
+ >
+ {!isEnvironmentReady ? (
+ <EnvironmentConnectionNotice
+ environmentLabel={
+ environment.presentation?.entry.target.label ??
+ selectedEnvironmentConnection?.environmentLabel ??
+ "Environment"
}
- }
- resourceName="terminal"
- onRetry={handleRetryEnvironment}
- />
- ) : (
- <>
- <BlurTargetView
- ref={terminalBlurTarget}
- style={{
- flex: 1,
- paddingBottom: terminalBottomInset,
- }}
- >
+ connection={
+ environment.presentation?.connection ?? {
+ phase: "available",
+ error: null,
+ traceId: null,
+ }
+ }
+ resourceName="terminal"
+ onRetry={handleRetryEnvironment}
+ />
+ ) : (
+ <>
<View
- pointerEvents="none"
style={{
- position: "absolute",
- inset: 0,
- backgroundColor: terminalTheme.background,
- }}
- />
- <TerminalSurface
- autoFocus={!SHOWCASE_ENABLED}
- buffer={terminalSurfaceBuffer}
- fontSize={fontSize}
- isRunning={isRunning}
- keyboardFocusRequest={keyboardFocusRequest}
- captureRequest={captureRequest}
- onCapture={(text) => {
- if (text.trim()) setCapturedOutput(text);
- else Alert.alert("No terminal output", "There is no visible output to attach.");
+ flex: 1,
+ paddingBottom: terminalBottomInset,
}}
- onInput={handleInput}
- onResize={handleResize}
- style={{ flex: 1 }}
- terminalKey={terminalKey}
- theme={terminalTheme}
- />
- </BlurTargetView>
-
- {selectedThread && hasNativeTerminalSurface() ? (
- <Pressable
- accessibilityRole="button"
- onPress={() => {
- KeyboardController.dismiss();
- setCaptureRequest((value) => value + 1);
- }}
- className="px-4 py-2"
- >
- <Text style={{ color: terminalTheme.foreground }}>Attach visible output</Text>
- </Pressable>
- ) : null}
- {isAccessoryVisible ? (
- <KeyboardStickyView
- style={{ position: "absolute", bottom: 0, left: 0, right: 0 }}
- offset={{ closed: 0, opened: 0 }}
>
<View
- className="border-t"
+ pointerEvents="none"
style={{
+ position: "absolute",
+ inset: 0,
backgroundColor: terminalTheme.background,
- borderTopColor: terminalTheme.border,
- minHeight: TERMINAL_ACCESSORY_HEIGHT,
}}
- >
- <ComposerToolbarRow paddingBottom={4} paddingHorizontal={8} paddingTop={4}>
- <ComposerToolbarScroller
- contentPaddingRight={2}
- fadeOpaque={terminalTheme.background}
- fadeTransparent={`${terminalTheme.background}00`}
- >
- {terminalToolbarActions.map((action) => {
- const active =
- action.kind === "modifier" && pendingModifier === action.modifier;
-
- return (
- <ComposerToolbarButton
- key={action.key}
- active={active}
- label={action.label}
- maxWidth={120}
- minWidth={action.label.length > 1 ? 56 : 44}
- onPress={() => handleToolbarActionPress(action)}
- showChevron={false}
- textTransform={
- action.kind === "modifier" || action.kind === "clear"
- ? "uppercase"
- : "none"
- }
- />
- );
- })}
- </ComposerToolbarScroller>
- <ComposerToolbarButton
- accessibilityLabel="Dismiss keyboard"
- icon={{ ios: "keyboard.chevron.compact.down", android: "keyboard_hide" }}
- onPress={handleDismissKeyboard}
- showChevron={false}
+ />
+ <TerminalSurface
+ autoFocus={terminalAutoFocus}
+ buffer={terminalSurfaceBuffer}
+ fontSize={fontSize}
+ isRunning={isRunning}
+ keyboardFocusRequest={keyboardFocusRequest}
+ captureRequest={captureRequest}
+ onCapture={(text) => {
+ if (text.trim()) setCapturedOutput(text);
+ else Alert.alert("No terminal output", "There is no visible output to attach.");
+ }}
+ onInput={handleInput}
+ onResize={handleResize}
+ style={{ flex: 1 }}
+ terminalKey={terminalKey}
+ theme={terminalTheme}
+ />
+ </View>
+
+ {Platform.OS === "android" && !keyboardState.isVisible ? (
+ <View className="min-h-14 flex-row items-center gap-2 bg-card-alt px-2">
+ {selectedThread && hasNativeTerminalSurface() ? (
+ <MaterialButton
+ label="Attach output"
+ tone="text"
+ onPress={() => setCaptureRequest((value) => value + 1)}
/>
- </ComposerToolbarRow>
+ ) : null}
+ <View className="flex-1" />
+ <MaterialIconButton
+ accessibilityLabel="Show keyboard"
+ icon="keyboard"
+ onPress={handleShowKeyboard}
+ />
</View>
- </KeyboardStickyView>
- ) : !keyboardState.isVisible ? (
- <Pressable
- accessibilityLabel="Show keyboard"
- accessibilityRole="button"
- onPress={handleShowKeyboard}
- style={({ pressed }) => ({
- bottom: 16,
- borderRadius: 28,
- opacity: pressed ? 0.72 : 1,
- position: "absolute",
- right: 16,
- })}
- >
- <GlassSurface
- chrome="none"
- blurTarget={terminalBlurTarget}
- fallbackColor={terminalTheme.background}
- glassEffectStyle="regular"
- tintColor="transparent"
- style={{
- alignItems: "center",
- borderRadius: 24,
- height: 48,
- justifyContent: "center",
- width: 48,
+ ) : Platform.OS !== "android" && selectedThread && hasNativeTerminalSurface() ? (
+ <Pressable
+ accessibilityRole="button"
+ onPress={() => {
+ KeyboardController.dismiss();
+ setCaptureRequest((value) => value + 1);
}}
- pointerEvents="none"
+ className="px-4 py-2"
>
- <SymbolView
- name={{ ios: "keyboard", android: "keyboard" }}
- size={20}
- tintColor={terminalTheme.foreground}
- type="monochrome"
- />
- </GlassSurface>
- </Pressable>
- ) : null}
- </>
- )}
- </View>
+ <Text style={{ color: terminalTheme.foreground }}>Attach visible output</Text>
+ </Pressable>
+ ) : null}
+ {isAccessoryVisible ? (
+ <KeyboardStickyView
+ style={{ position: "absolute", bottom: 0, left: 0, right: 0 }}
+ offset={{ closed: 0, opened: 0 }}
+ >
+ <View
+ className="border-t"
+ style={{
+ backgroundColor: terminalTheme.background,
+ borderTopColor: terminalTheme.border,
+ minHeight: TERMINAL_ACCESSORY_HEIGHT,
+ }}
+ >
+ <ComposerToolbarRow paddingBottom={4} paddingHorizontal={8} paddingTop={4}>
+ <ComposerToolbarScroller
+ contentPaddingRight={2}
+ fadeOpaque={terminalTheme.background}
+ fadeTransparent={`${terminalTheme.background}00`}
+ >
+ {terminalToolbarActions.map((action) => {
+ const active =
+ action.kind === "modifier" && pendingModifier === action.modifier;
+
+ return (
+ <ComposerToolbarButton
+ key={action.key}
+ active={active}
+ label={action.label}
+ maxWidth={120}
+ minWidth={action.label.length > 1 ? 56 : 44}
+ onPress={() => handleToolbarActionPress(action)}
+ showChevron={false}
+ textTransform={
+ action.kind === "modifier" || action.kind === "clear"
+ ? "uppercase"
+ : "none"
+ }
+ />
+ );
+ })}
+ </ComposerToolbarScroller>
+ <ComposerToolbarButton
+ accessibilityLabel="Dismiss keyboard"
+ icon={{ ios: "keyboard.chevron.compact.down", android: "keyboard_hide" }}
+ onPress={handleDismissKeyboard}
+ showChevron={false}
+ />
+ </ComposerToolbarRow>
+ </View>
+ </KeyboardStickyView>
+ ) : !keyboardState.isVisible && Platform.OS !== "android" ? (
+ <Pressable
+ accessibilityLabel="Show keyboard"
+ accessibilityRole="button"
+ onPress={handleShowKeyboard}
+ style={({ pressed }) => ({
+ bottom: 16,
+ borderRadius: 28,
+ opacity: pressed ? 0.72 : 1,
+ position: "absolute",
+ right: 16,
+ })}
+ >
+ <GlassSurface
+ chrome="none"
+ fallbackColor={terminalTheme.background}
+ glassEffectStyle="regular"
+ tintColor="transparent"
+ style={{
+ alignItems: "center",
+ borderRadius: 24,
+ height: 48,
+ justifyContent: "center",
+ width: 48,
+ }}
+ pointerEvents="none"
+ >
+ <SymbolView
+ name={{ ios: "keyboard", android: "keyboard" }}
+ size={20}
+ tintColor={terminalTheme.foreground}
+ type="monochrome"
+ />
+ </GlassSurface>
+ </Pressable>
+ ) : null}
+ </>
+ )}
+ </View>
+ </MaterialScreenContent>
</>
);
}
diff --git a/apps/mobile/src/features/threads/CustomSnoozeSheet.android.tsx b/apps/mobile/src/features/threads/CustomSnoozeSheet.android.tsx
new file mode 100644
index 00000000000..85600838881
--- /dev/null
+++ b/apps/mobile/src/features/threads/CustomSnoozeSheet.android.tsx
@@ -0,0 +1,287 @@
+import { MaterialSegmentedButtons } from "../../components/MaterialSegmentedButtons.android";
+import {
+ BasicAlertDialog,
+ Button,
+ Column,
+ DateTimePicker,
+ Host,
+ FilledTonalIconButton,
+ Row,
+ Shape,
+ Surface,
+ Text,
+ TextButton,
+} from "@expo/ui/jetpack-compose";
+import {
+ padding,
+ size,
+ width,
+ fillMaxWidth,
+ testID,
+ verticalScroll,
+} from "@expo/ui/jetpack-compose/modifiers";
+import {
+ localSnoozeDate,
+ localSnoozeTime,
+ resolveCustomSnooze,
+ type CustomSnoozeInput,
+} from "@t3tools/client-runtime/state/thread-settled";
+import { requireNativeModule } from "expo";
+import { useEffect, useState } from "react";
+import { AppState, useWindowDimensions } from "react-native";
+
+import { OverlayPortal } from "../../components/OverlayPortal";
+import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
+import { useScaledTextRole } from "../settings/appearance/useScaledTextRole";
+import type { CustomSnoozeSheet as SharedCustomSnoozeSheet } from "./CustomSnoozeSheet.shared";
+import {
+ applySnoozePickerDate,
+ applySnoozePickerTime,
+ snoozeDateToPickerDate,
+} from "./customSnoozeDate";
+
+type Props = Parameters<typeof SharedCustomSnoozeSheet>[0];
+
+const roundedCorner = Shape.RoundedCorner;
+
+const modes = [
+ { value: "date", label: "Date and time" },
+ { value: "duration", label: "Duration" },
+] as const;
+const units = [
+ { value: "minutes", label: "Minutes" },
+ { value: "hours", label: "Hours" },
+ { value: "days", label: "Days" },
+] as const;
+
+function systemUses24HourClock() {
+ return requireNativeModule<{ is24HourFormat(): boolean }>("T3NativeControls").is24HourFormat();
+}
+
+export function CustomSnoozeSheet(props: Props) {
+ const { themeAppearance, themeVariables: colors } = useAppearancePreferences();
+ const [is24Hour, setIs24Hour] = useState(systemUses24HourClock);
+ useEffect(() => {
+ const subscription = AppState.addEventListener("change", (state) => {
+ if (state === "active") setIs24Hour(systemUses24HourClock());
+ });
+ return () => subscription.remove();
+ }, []);
+ const titleTypography = useScaledTextRole("title");
+ const bodyTypography = useScaledTextRole("footnote");
+ const { width: windowWidth } = useWindowDimensions();
+ const [mode, setMode] = useState<CustomSnoozeInput["mode"]>("date");
+ const [date, setDate] = useState(() => new Date(Date.now() + 3_600_000));
+ const [picker, setPicker] = useState<"date" | "time">("date");
+ const [amount, setAmount] = useState(2);
+ const [unit, setUnit] = useState<"minutes" | "hours" | "days">("hours");
+ const [error, setError] = useState<string | null>(null);
+ const submit = () => {
+ const input: CustomSnoozeInput =
+ mode === "date"
+ ? { mode, date: localSnoozeDate(date), time: localSnoozeTime(date) }
+ : { mode, amount: String(amount), unit };
+ const snoozedUntil = resolveCustomSnooze(input, new Date());
+ if (!snoozedUntil) {
+ setError(
+ mode === "date" ? "Choose a date and time in the future." : "Enter a positive duration.",
+ );
+ return;
+ }
+ props.onSnooze(snoozedUntil);
+ props.onClose();
+ };
+ const pickerColors = {
+ containerColor: colors["--color-card-alt"],
+ titleContentColor: colors["--color-foreground-secondary"],
+ headlineContentColor: colors["--color-foreground"],
+ weekdayContentColor: colors["--color-foreground-secondary"],
+ subheadContentColor: colors["--color-foreground"],
+ navigationContentColor: colors["--color-foreground"],
+ yearContentColor: colors["--color-foreground"],
+ dayContentColor: colors["--color-foreground"],
+ currentYearContentColor: colors["--color-primary"],
+ selectedYearContainerColor: colors["--color-primary"],
+ selectedYearContentColor: colors["--color-primary-foreground"],
+ selectedDayContainerColor: colors["--color-primary"],
+ selectedDayContentColor: colors["--color-primary-foreground"],
+ todayContentColor: colors["--color-primary"],
+ todayDateBorderColor: colors["--color-primary"],
+ dividerColor: colors["--color-border"],
+ clockDialColor: colors["--color-secondary"],
+ clockDialSelectedContentColor: colors["--color-primary-foreground"],
+ clockDialUnselectedContentColor: colors["--color-secondary-foreground"],
+ selectorColor: colors["--color-primary"],
+ periodSelectorSelectedContainerColor: colors["--color-secondary"],
+ periodSelectorSelectedContentColor: colors["--color-secondary-foreground"],
+ periodSelectorUnselectedContentColor: colors["--color-foreground"],
+ timeSelectorSelectedContainerColor: colors["--color-secondary"],
+ timeSelectorSelectedContentColor: colors["--color-secondary-foreground"],
+ timeSelectorUnselectedContainerColor: colors["--color-card"],
+ timeSelectorUnselectedContentColor: colors["--color-foreground"],
+ };
+ return (
+ // Recycled thread rows can detach a zero-sized native dialog host.
+ <OverlayPortal>
+ <Host colorScheme={themeAppearance} style={{ height: 0, width: 0 }}>
+ <BasicAlertDialog
+ onDismissRequest={props.onClose}
+ properties={{ usePlatformDefaultWidth: false }}
+ modifiers={[width(Math.min(360, windowWidth - 32))]}
+ >
+ <Surface
+ color={colors["--color-card-alt"]}
+ contentColor={colors["--color-foreground"]}
+ shape={roundedCorner({
+ cornerRadii: { topStart: 28, topEnd: 28, bottomStart: 28, bottomEnd: 28 },
+ })}
+ >
+ <Column modifiers={[fillMaxWidth(), verticalScroll()]}>
+ <Column
+ verticalArrangement={{ spacedBy: 16 }}
+ modifiers={[fillMaxWidth(), padding(24, 24, 24, 16)]}
+ >
+ <Text style={titleTypography}>Custom snooze</Text>
+ <MaterialSegmentedButtons
+ options={modes}
+ selected={mode}
+ onSelect={(value) => {
+ setMode(value);
+ setError(null);
+ }}
+ />
+ {mode === "date" ? (
+ <MaterialSegmentedButtons
+ options={[
+ {
+ value: "date",
+ label: date.toLocaleDateString([], { month: "short", day: "numeric" }),
+ },
+ {
+ value: "time",
+ label: date.toLocaleTimeString([], {
+ hour: "numeric",
+ minute: "2-digit",
+ hourCycle: is24Hour ? "h23" : "h12",
+ }),
+ },
+ ]}
+ selected={picker}
+ onSelect={setPicker}
+ />
+ ) : null}
+ </Column>
+ {mode === "date" ? (
+ <Column horizontalAlignment="center" modifiers={[fillMaxWidth()]}>
+ <SnoozeDateTimePicker
+ key={picker}
+ date={date}
+ picker={picker}
+ is24Hour={is24Hour}
+ colors={pickerColors}
+ onChange={(selected) => {
+ setDate((current) =>
+ picker === "date"
+ ? applySnoozePickerDate(current, selected)
+ : applySnoozePickerTime(current, selected),
+ );
+ setError(null);
+ }}
+ />
+ </Column>
+ ) : (
+ <Column
+ verticalArrangement={{ spacedBy: 16 }}
+ modifiers={[fillMaxWidth(), padding(24, 8, 24, 16)]}
+ >
+ <Row
+ horizontalArrangement="spaceEvenly"
+ verticalAlignment="center"
+ modifiers={[fillMaxWidth()]}
+ >
+ <FilledTonalIconButton
+ enabled={amount > 1}
+ onClick={() => setAmount((current) => Math.max(1, current - 1))}
+ colors={{
+ containerColor: colors["--color-secondary"],
+ contentColor: colors["--color-secondary-foreground"],
+ }}
+ modifiers={[size(48, 48), testID("snooze-decrease-duration")]}
+ >
+ <Text style={titleTypography}>−</Text>
+ </FilledTonalIconButton>
+ <Text style={titleTypography} modifiers={[testID("snooze-duration")]}>
+ {String(amount)}
+ </Text>
+ <FilledTonalIconButton
+ enabled={amount < 99}
+ onClick={() => setAmount((current) => Math.min(99, current + 1))}
+ colors={{
+ containerColor: colors["--color-secondary"],
+ contentColor: colors["--color-secondary-foreground"],
+ }}
+ modifiers={[size(48, 48), testID("snooze-increase-duration")]}
+ >
+ <Text style={titleTypography}>+</Text>
+ </FilledTonalIconButton>
+ </Row>
+ <MaterialSegmentedButtons options={units} selected={unit} onSelect={setUnit} />
+ </Column>
+ )}
+ <Column
+ verticalArrangement={{ spacedBy: 16 }}
+ modifiers={[fillMaxWidth(), padding(24, 8, 24, 24)]}
+ >
+ {error ? (
+ <Text style={bodyTypography} color={colors["--color-danger-foreground"]}>
+ {error}
+ </Text>
+ ) : null}
+ <Row horizontalArrangement="end" modifiers={[fillMaxWidth()]}>
+ <TextButton
+ onClick={props.onClose}
+ colors={{ contentColor: colors["--color-primary"] }}
+ >
+ <Text style={bodyTypography}>Cancel</Text>
+ </TextButton>
+ <Button
+ onClick={submit}
+ colors={{
+ containerColor: colors["--color-primary"],
+ contentColor: colors["--color-primary-foreground"],
+ }}
+ >
+ <Text style={bodyTypography}>Snooze</Text>
+ </Button>
+ </Row>
+ </Column>
+ </Column>
+ </Surface>
+ </BasicAlertDialog>
+ </Host>
+ </OverlayPortal>
+ );
+}
+
+function SnoozeDateTimePicker(props: {
+ readonly date: Date;
+ readonly picker: "date" | "time";
+ readonly is24Hour: boolean;
+ readonly colors: React.ComponentProps<typeof DateTimePicker>["elementColors"];
+ readonly onChange: (date: Date) => void;
+}) {
+ // Changing initialDate resets Compose's picker state, including its active clock dial.
+ const [initialDate] = useState(() =>
+ props.picker === "date" ? snoozeDateToPickerDate(props.date) : props.date.toISOString(),
+ );
+ return (
+ <DateTimePicker
+ initialDate={initialDate}
+ displayedComponents={props.picker === "date" ? "date" : "hourAndMinute"}
+ is24Hour={props.is24Hour}
+ showVariantToggle={false}
+ elementColors={props.colors}
+ onDateSelected={props.onChange}
+ />
+ );
+}
diff --git a/apps/mobile/src/features/threads/CustomSnoozeSheet.ios.tsx b/apps/mobile/src/features/threads/CustomSnoozeSheet.ios.tsx
index 7f5b69ed224..20176064be5 100644
--- a/apps/mobile/src/features/threads/CustomSnoozeSheet.ios.tsx
+++ b/apps/mobile/src/features/threads/CustomSnoozeSheet.ios.tsx
@@ -3,7 +3,6 @@ import {
DatePicker,
Host,
HStack,
- Menu,
Picker,
Popover,
Spacer,
@@ -11,16 +10,20 @@ import {
VStack,
} from "@expo/ui/swift-ui";
import {
- background,
+ accessibilityAddTraits,
+ accessibilityHidden,
+ buttonBorderShape,
buttonStyle,
- datePickerStyle,
+ clipped,
+ controlSize,
font,
+ datePickerStyle,
foregroundStyle,
frame,
+ labelsHidden,
+ labelStyle,
padding,
pickerStyle,
- presentationBackground,
- shapes,
tag,
} from "@expo/ui/swift-ui/modifiers";
import {
@@ -30,9 +33,8 @@ import {
type CustomSnoozeInput,
} from "@t3tools/client-runtime/state/thread-settled";
import { useState } from "react";
-import { Modal, Pressable, ScrollView, View } from "react-native";
-import { AppText } from "../../components/AppText";
-import { SegmentedControl } from "../../components/SegmentedControl";
+import { useWindowDimensions } from "react-native";
+import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
const durationAmounts = Array.from({ length: 99 }, (_, index) => index + 1);
@@ -50,13 +52,13 @@ export function CustomSnoozeSheet(props: {
readonly onClose: () => void;
readonly onSnooze: (snoozedUntil: string) => void;
}) {
+ const { width } = useWindowDimensions();
const [mode, setMode] = useState<CustomSnoozeInput["mode"]>("date");
const [date, setDate] = useState(() => new Date(Date.now() + 3_600_000));
const [amount, setAmount] = useState(2);
- const [amountOpen, setAmountOpen] = useState(false);
const [unit, setUnit] = useState<"minutes" | "hours" | "days">("hours");
const [error, setError] = useState<string | null>(null);
- const { themeVariables: colors, themeAppearance, appearance } = useAppearancePreferences();
+ const { themeVariables: colors, themeAppearance } = useAppearancePreferences();
const updateDate = (value: Date) => {
setDate(value);
setError(null);
@@ -79,190 +81,150 @@ export function CustomSnoozeSheet(props: {
};
return (
- <Modal visible transparent animationType="fade" onRequestClose={props.onClose}>
- <View className="flex-1 items-center justify-center bg-black/40 px-6">
- <ScrollView
- className="max-h-[80%] w-full max-w-sm grow-0 rounded-3xl border border-border bg-sheet-solid"
- contentContainerStyle={{ padding: 20, gap: 16 }}
- >
- <View className="flex-row items-center justify-between gap-2">
- <Pressable accessibilityRole="button" onPress={props.onClose} hitSlop={10}>
- <AppText className="text-base">Cancel</AppText>
- </Pressable>
- <AppText accessibilityRole="header" className="text-base font-t3-semibold">
- Custom snooze
- </AppText>
- <Pressable accessibilityRole="button" onPress={submit} hitSlop={10}>
- <AppText className="text-base text-primary">Snooze</AppText>
- </Pressable>
- </View>
- <SegmentedControl
- options={modes}
- selected={mode}
- onSelect={(value) => {
- setMode(value);
- setError(null);
- }}
- role="tab"
+ <Host
+ style={{ position: "absolute", top: 0, right: 0, bottom: 0, left: 0 }}
+ colorScheme={themeAppearance}
+ seedColor={colors["--color-primary"]}
+ >
+ <Popover
+ isPresented
+ onIsPresentedChange={(presented) => {
+ if (!presented) props.onClose();
+ }}
+ >
+ <Popover.Trigger>
+ <Spacer
+ modifiers={[frame({ maxWidth: Infinity, maxHeight: Infinity }), accessibilityHidden()]}
/>
- <Host
- matchContents={{ vertical: true }}
- style={{ width: "100%" }}
- colorScheme={themeAppearance}
- seedColor={colors["--color-primary"]}
+ </Popover.Trigger>
+ <Popover.Content>
+ <VStack
+ spacing={16}
+ modifiers={[padding({ all: 16 }), frame({ width: Math.min(360, width - 32) })]}
>
- <HStack
- spacing={6}
- modifiers={[
- frame({ minHeight: 44 }),
- foregroundStyle(colors["--color-foreground"]),
- font({ size: appearance.baseFontSize }),
- ]}
- >
- <Text>{mode === "date" ? "Until" : "Snooze for"}</Text>
- <Spacer />
- {mode === "date" ? (
- <>
- <SnoozeDateField date={date} component="date" onChange={updateDate} />
- <SnoozeDateField date={date} component="hourAndMinute" onChange={updateDate} />
- </>
- ) : (
- <>
- <Popover isPresented={amountOpen} onIsPresentedChange={setAmountOpen}>
- <Popover.Trigger>
- <Button
- onPress={() => setAmountOpen(true)}
- modifiers={[buttonStyle("plain")]}
- >
- <FieldLabel label={String(amount)} />
- </Button>
- </Popover.Trigger>
- <Popover.Content>
- <VStack
- modifiers={[
- padding({ all: 12 }),
- frame({ width: 180 }),
- presentationBackground(colors["--color-sheet-solid"]),
- ]}
- >
- <Picker
- label="Duration"
- selection={amount}
- onSelectionChange={(value: number) => {
- setAmount(value);
- setError(null);
- }}
- modifiers={[pickerStyle("wheel"), frame({ height: 160 })]}
- >
- {durationAmounts.map((value) => (
- <Text
- key={value}
- modifiers={[
- tag(value),
- foregroundStyle(colors["--color-foreground"]),
- ]}
- >
- {String(value)}
- </Text>
- ))}
- </Picker>
- <Button
- label="Done"
- onPress={() => setAmountOpen(false)}
- modifiers={[foregroundStyle(colors["--color-primary"])]}
- />
- </VStack>
- </Popover.Content>
- </Popover>
- <Menu
- label={
- <FieldLabel
- label={unit === "minutes" ? "Minutes" : unit === "hours" ? "Hours" : "Days"}
- />
- }
- >
- {units.map((option) => (
- <Button
- key={option.value}
- label={option.label}
- onPress={() => {
- setUnit(option.value);
- setError(null);
- }}
- />
- ))}
- </Menu>
- </>
- )}
+ <HStack spacing={12}>
+ <Button
+ label="Cancel"
+ systemImage="xmark"
+ role="cancel"
+ onPress={props.onClose}
+ modifiers={[
+ labelStyle("iconOnly"),
+ buttonStyle(NATIVE_LIQUID_GLASS_SUPPORTED ? "glass" : "bordered"),
+ buttonBorderShape("circle"),
+ controlSize("large"),
+ ]}
+ />
+ <Text
+ modifiers={[
+ font({ textStyle: "headline" }),
+ frame({ maxWidth: Infinity, alignment: "leading" }),
+ accessibilityAddTraits(["isHeader"]),
+ ]}
+ >
+ Custom snooze
+ </Text>
+ <Button
+ label="Snooze"
+ onPress={submit}
+ modifiers={[
+ buttonStyle(
+ NATIVE_LIQUID_GLASS_SUPPORTED ? "glassProminent" : "borderedProminent",
+ ),
+ controlSize("large"),
+ ]}
+ />
</HStack>
- </Host>
- {error && <AppText className="text-sm text-danger-foreground">{error}</AppText>}
- </ScrollView>
- </View>
- </Modal>
- );
-}
-
-function FieldLabel(props: { readonly label: string }) {
- const { themeVariables: colors } = useAppearancePreferences();
- return (
- <Text
- modifiers={[
- padding({ horizontal: 12, vertical: 8 }),
- foregroundStyle(colors["--color-foreground"]),
- background(colors["--color-card"], shapes.capsule()),
- ]}
- >
- {props.label}
- </Text>
- );
-}
-
-function SnoozeDateField(props: {
- readonly date: Date;
- readonly component: "date" | "hourAndMinute";
- readonly onChange: (date: Date) => void;
-}) {
- const [open, setOpen] = useState(false);
- const { themeVariables: colors } = useAppearancePreferences();
- return (
- <Popover isPresented={open} onIsPresentedChange={setOpen}>
- <Popover.Trigger>
- <Button onPress={() => setOpen(true)} modifiers={[buttonStyle("plain")]}>
- <FieldLabel
- label={
- props.component === "date"
- ? props.date.toLocaleDateString(undefined, {
- month: "short",
- day: "numeric",
- year: "numeric",
- })
- : props.date.toLocaleTimeString(undefined, { hour: "numeric", minute: "2-digit" })
- }
- />
- </Button>
- </Popover.Trigger>
- <Popover.Content>
- <VStack
- modifiers={[
- padding({ all: 12 }),
- frame({ width: props.component === "date" ? 340 : 300 }),
- presentationBackground(colors["--color-sheet-solid"]),
- ]}
- >
- <DatePicker
- selection={props.date}
- displayedComponents={[props.component]}
- onDateChange={props.onChange}
- modifiers={[datePickerStyle(props.component === "date" ? "graphical" : "wheel")]}
- />
- <Button
- label="Done"
- onPress={() => setOpen(false)}
- modifiers={[foregroundStyle(colors["--color-primary"])]}
- />
- </VStack>
- </Popover.Content>
- </Popover>
+ <Picker
+ label="Snooze mode"
+ selection={mode}
+ onSelectionChange={(value: CustomSnoozeInput["mode"]) => {
+ setMode(value);
+ setError(null);
+ }}
+ modifiers={[pickerStyle("segmented")]}
+ >
+ {modes.map((option) => (
+ <Text key={option.value} modifiers={[tag(option.value)]}>
+ {option.label}
+ </Text>
+ ))}
+ </Picker>
+ {mode === "date" ? (
+ <DatePicker
+ title="Snooze until"
+ selection={date}
+ displayedComponents={["date", "hourAndMinute"]}
+ onDateChange={updateDate}
+ modifiers={[
+ datePickerStyle("wheel"),
+ labelsHidden(),
+ frame({ maxWidth: Infinity, height: 180 }),
+ ]}
+ />
+ ) : (
+ <HStack spacing={0}>
+ <Picker
+ label="Duration amount"
+ selection={amount}
+ onSelectionChange={(value: number) => {
+ setAmount(value);
+ setError(null);
+ }}
+ modifiers={[
+ pickerStyle("wheel"),
+ labelsHidden(),
+ frame({ minWidth: 0, maxWidth: Infinity, height: 180 }),
+ clipped(),
+ ]}
+ >
+ {durationAmounts.map((value) => (
+ <Text
+ key={value}
+ modifiers={[tag(value), foregroundStyle(colors["--color-foreground"])]}
+ >
+ {String(value)}
+ </Text>
+ ))}
+ </Picker>
+ <Picker
+ label="Duration unit"
+ selection={unit}
+ onSelectionChange={(value: typeof unit) => {
+ setUnit(value);
+ setError(null);
+ }}
+ modifiers={[
+ pickerStyle("wheel"),
+ labelsHidden(),
+ frame({ minWidth: 0, maxWidth: Infinity, height: 180 }),
+ clipped(),
+ ]}
+ >
+ {units.map((option) => (
+ <Text
+ key={option.value}
+ modifiers={[tag(option.value), foregroundStyle(colors["--color-foreground"])]}
+ >
+ {option.label}
+ </Text>
+ ))}
+ </Picker>
+ </HStack>
+ )}
+ {error ? (
+ <Text
+ modifiers={[
+ font({ textStyle: "footnote" }),
+ foregroundStyle(colors["--color-danger-foreground"]),
+ ]}
+ >
+ {error}
+ </Text>
+ ) : null}
+ </VStack>
+ </Popover.Content>
+ </Popover>
+ </Host>
);
}
diff --git a/apps/mobile/src/features/threads/CustomSnoozeSheet.shared.tsx b/apps/mobile/src/features/threads/CustomSnoozeSheet.shared.tsx
new file mode 100644
index 00000000000..9278bb6b941
--- /dev/null
+++ b/apps/mobile/src/features/threads/CustomSnoozeSheet.shared.tsx
@@ -0,0 +1,181 @@
+import { DateTimePicker } from "@expo/ui/community/datetime-picker";
+import {
+ localSnoozeDate,
+ localSnoozeTime,
+ resolveCustomSnooze,
+ type CustomSnoozeInput,
+} from "@t3tools/client-runtime/state/thread-settled";
+import { useState } from "react";
+import {
+ KeyboardAvoidingView,
+ Modal,
+ Platform,
+ Pressable,
+ ScrollView,
+ TextInput,
+ View,
+} from "react-native";
+import { AppText } from "../../components/AppText";
+import { SegmentedControl } from "../../components/SegmentedControl";
+
+export function CustomSnoozeSheet(props: {
+ readonly onClose: () => void;
+ readonly onSnooze: (snoozedUntil: string) => void;
+}) {
+ const [mode, setMode] = useState<CustomSnoozeInput["mode"]>("date");
+ const [date, setDate] = useState(() => new Date(Date.now() + 3_600_000));
+ const [picker, setPicker] = useState<"date" | "time" | null>(null);
+ const [amount, setAmount] = useState("2");
+ const [unit, setUnit] = useState<"minutes" | "hours" | "days">("hours");
+ const [error, setError] = useState<string | null>(null);
+ return (
+ <Modal visible transparent animationType="fade" onRequestClose={props.onClose}>
+ <KeyboardAvoidingView
+ className="flex-1 items-center justify-center bg-black/40 px-6"
+ behavior={Platform.OS === "ios" ? "padding" : undefined}
+ >
+ <ScrollView
+ className="max-h-[80%] w-full max-w-md grow-0 rounded-3xl bg-screen"
+ keyboardShouldPersistTaps="handled"
+ contentInsetAdjustmentBehavior="automatic"
+ contentContainerStyle={{ padding: 24, paddingBottom: 24, gap: 20 }}
+ >
+ <AppText accessibilityRole="header" className="text-xl font-t3-semibold">
+ Custom snooze
+ </AppText>
+ <AppText className="text-base text-foreground-secondary">
+ Choose when snoozed threads return to your inbox.
+ </AppText>
+ <SegmentedControl
+ options={
+ [
+ { value: "date", label: "Date and time" },
+ { value: "duration", label: "Duration" },
+ ] as const
+ }
+ selected={mode}
+ onSelect={(value) => {
+ setMode(value);
+ setPicker(null);
+ setError(null);
+ }}
+ role="tab"
+ />
+ {mode === "date" ? (
+ <View className="gap-3">
+ {(["date", "time"] as const).map((value) => (
+ <Pressable
+ key={value}
+ accessibilityRole="button"
+ accessibilityLabel={value === "date" ? "Choose date" : "Choose time"}
+ className="min-h-12 flex-row items-center justify-between rounded-xl bg-subtle px-3"
+ onPress={() => setPicker(value)}
+ >
+ <AppText>{value === "date" ? "Date" : "Time"}</AppText>
+ <AppText>
+ {value === "date"
+ ? date.toLocaleDateString()
+ : date.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" })}
+ </AppText>
+ </Pressable>
+ ))}
+ {picker && (
+ <DateTimePicker
+ value={date}
+ mode={picker}
+ display={Platform.OS === "ios" ? "spinner" : "default"}
+ onDismiss={() => setPicker(null)}
+ onValueChange={(_, selected) => {
+ const next = new Date(date);
+ if (picker === "date")
+ next.setFullYear(
+ selected.getFullYear(),
+ selected.getMonth(),
+ selected.getDate(),
+ );
+ else next.setHours(selected.getHours(), selected.getMinutes(), 0, 0);
+ setDate(next);
+ setError(null);
+ }}
+ />
+ )}
+ </View>
+ ) : (
+ <View className="gap-3">
+ <AppText>Snooze for</AppText>
+ <TextInput
+ accessibilityLabel="Duration"
+ className="min-h-12 rounded-xl bg-subtle px-3 text-base text-foreground"
+ keyboardType="decimal-pad"
+ value={amount}
+ onChangeText={(value) => {
+ setAmount(value);
+ setError(null);
+ }}
+ />
+ <View className="flex-row gap-2">
+ {(["minutes", "hours", "days"] as const).map((value) => (
+ <Pressable
+ key={value}
+ accessibilityRole="radio"
+ accessibilityState={{ checked: unit === value }}
+ className={
+ unit === value
+ ? "min-h-12 flex-1 items-center justify-center rounded-xl bg-subtle"
+ : "min-h-12 flex-1 items-center justify-center rounded-xl"
+ }
+ onPress={() => {
+ setUnit(value);
+ setError(null);
+ }}
+ >
+ <AppText>
+ {value === "minutes" ? "Minutes" : value === "hours" ? "Hours" : "Days"}
+ </AppText>
+ </Pressable>
+ ))}
+ </View>
+ </View>
+ )}
+ {error && (
+ <AppText accessibilityRole="alert" className="text-danger-foreground">
+ {error}
+ </AppText>
+ )}
+ <View className="flex-row justify-end gap-3">
+ <Pressable
+ accessibilityRole="button"
+ className="min-h-12 justify-center px-3"
+ onPress={props.onClose}
+ >
+ <AppText>Cancel</AppText>
+ </Pressable>
+ <Pressable
+ accessibilityRole="button"
+ className="min-h-12 justify-center rounded-xl bg-primary px-3"
+ onPress={() => {
+ const input: CustomSnoozeInput =
+ mode === "date"
+ ? { mode, date: localSnoozeDate(date), time: localSnoozeTime(date) }
+ : { mode, amount: amount.replace(",", "."), unit };
+ const snoozedUntil = resolveCustomSnooze(input, new Date());
+ if (!snoozedUntil) {
+ setError(
+ mode === "date"
+ ? "Choose a date and time in the future."
+ : "Enter a positive duration.",
+ );
+ return;
+ }
+ props.onSnooze(snoozedUntil);
+ props.onClose();
+ }}
+ >
+ <AppText className="text-primary-foreground">Snooze</AppText>
+ </Pressable>
+ </View>
+ </ScrollView>
+ </KeyboardAvoidingView>
+ </Modal>
+ );
+}
diff --git a/apps/mobile/src/features/threads/CustomSnoozeSheet.tsx b/apps/mobile/src/features/threads/CustomSnoozeSheet.tsx
index 6d35adb0624..6ffc8054c5c 100644
--- a/apps/mobile/src/features/threads/CustomSnoozeSheet.tsx
+++ b/apps/mobile/src/features/threads/CustomSnoozeSheet.tsx
@@ -1,182 +1 @@
-import { DateTimePicker } from "@expo/ui/community/datetime-picker";
-import {
- localSnoozeDate,
- localSnoozeTime,
- resolveCustomSnooze,
- type CustomSnoozeInput,
-} from "@t3tools/client-runtime/state/thread-settled";
-import { useState } from "react";
-import {
- KeyboardAvoidingView,
- Modal,
- Platform,
- Pressable,
- ScrollView,
- TextInput,
- View,
-} from "react-native";
-import { AppText } from "../../components/AppText";
-import { SegmentedControl } from "../../components/SegmentedControl";
-
-export function CustomSnoozeSheet(props: {
- readonly onClose: () => void;
- readonly onSnooze: (snoozedUntil: string) => void;
-}) {
- const [mode, setMode] = useState<CustomSnoozeInput["mode"]>("date");
- const [date, setDate] = useState(() => new Date(Date.now() + 3_600_000));
- const [picker, setPicker] = useState<"date" | "time" | null>(null);
- const [amount, setAmount] = useState("2");
- const [unit, setUnit] = useState<"minutes" | "hours" | "days">("hours");
- const [error, setError] = useState<string | null>(null);
- return (
- <Modal visible transparent animationType="fade" onRequestClose={props.onClose}>
- <KeyboardAvoidingView
- className="flex-1 items-center justify-center bg-black/40 px-6"
- behavior={Platform.OS === "ios" ? "padding" : undefined}
- >
- <ScrollView
- className="max-h-[80%] w-full max-w-md grow-0 rounded-3xl bg-screen"
- keyboardShouldPersistTaps="handled"
- contentInsetAdjustmentBehavior="automatic"
- contentContainerStyle={{ padding: 24, paddingBottom: 24, gap: 20 }}
- >
- <AppText accessibilityRole="header" className="text-xl font-t3-semibold">
- Custom snooze
- </AppText>
- <AppText className="text-base text-foreground-secondary">
- Choose when snoozed threads return to your inbox.
- </AppText>
- <SegmentedControl
- options={
- [
- { value: "date", label: "Date and time" },
- { value: "duration", label: "Duration" },
- ] as const
- }
- selected={mode}
- onSelect={(value) => {
- setMode(value);
- setPicker(null);
- setError(null);
- }}
- role="tab"
- />
- {mode === "date" ? (
- <View className="gap-3">
- {(["date", "time"] as const).map((value) => (
- <Pressable
- key={value}
- accessibilityRole="button"
- accessibilityLabel={value === "date" ? "Choose date" : "Choose time"}
- className="min-h-12 flex-row items-center justify-between rounded-xl bg-subtle px-3"
- onPress={() => setPicker(value)}
- >
- <AppText>{value === "date" ? "Date" : "Time"}</AppText>
- <AppText>
- {value === "date"
- ? date.toLocaleDateString()
- : date.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" })}
- </AppText>
- </Pressable>
- ))}
- {picker && (
- <DateTimePicker
- value={date}
- mode={picker}
- display={Platform.OS === "ios" ? "spinner" : "default"}
- onDismiss={() => setPicker(null)}
- onValueChange={(_, selected) => {
- const next = new Date(date);
- if (picker === "date")
- next.setFullYear(
- selected.getFullYear(),
- selected.getMonth(),
- selected.getDate(),
- );
- else next.setHours(selected.getHours(), selected.getMinutes(), 0, 0);
- setDate(next);
- setError(null);
- if (Platform.OS === "android") setPicker(null);
- }}
- />
- )}
- </View>
- ) : (
- <View className="gap-3">
- <AppText>Snooze for</AppText>
- <TextInput
- accessibilityLabel="Duration"
- className="min-h-12 rounded-xl bg-subtle px-3 text-base text-foreground"
- keyboardType="decimal-pad"
- value={amount}
- onChangeText={(value) => {
- setAmount(value);
- setError(null);
- }}
- />
- <View className="flex-row gap-2">
- {(["minutes", "hours", "days"] as const).map((value) => (
- <Pressable
- key={value}
- accessibilityRole="radio"
- accessibilityState={{ checked: unit === value }}
- className={
- unit === value
- ? "min-h-12 flex-1 items-center justify-center rounded-xl bg-subtle"
- : "min-h-12 flex-1 items-center justify-center rounded-xl"
- }
- onPress={() => {
- setUnit(value);
- setError(null);
- }}
- >
- <AppText>
- {value === "minutes" ? "Minutes" : value === "hours" ? "Hours" : "Days"}
- </AppText>
- </Pressable>
- ))}
- </View>
- </View>
- )}
- {error && (
- <AppText accessibilityRole="alert" className="text-danger-foreground">
- {error}
- </AppText>
- )}
- <View className="flex-row justify-end gap-3">
- <Pressable
- accessibilityRole="button"
- className="min-h-12 justify-center px-3"
- onPress={props.onClose}
- >
- <AppText>Cancel</AppText>
- </Pressable>
- <Pressable
- accessibilityRole="button"
- className="min-h-12 justify-center rounded-xl bg-primary px-3"
- onPress={() => {
- const input: CustomSnoozeInput =
- mode === "date"
- ? { mode, date: localSnoozeDate(date), time: localSnoozeTime(date) }
- : { mode, amount: amount.replace(",", "."), unit };
- const snoozedUntil = resolveCustomSnooze(input, new Date());
- if (!snoozedUntil) {
- setError(
- mode === "date"
- ? "Choose a date and time in the future."
- : "Enter a positive duration.",
- );
- return;
- }
- props.onSnooze(snoozedUntil);
- props.onClose();
- }}
- >
- <AppText className="text-primary-foreground">Snooze</AppText>
- </Pressable>
- </View>
- </ScrollView>
- </KeyboardAvoidingView>
- </Modal>
- );
-}
+export { CustomSnoozeSheet } from "./CustomSnoozeSheet.shared";
diff --git a/apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx b/apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx
index ef066feca5b..b677a9353eb 100644
--- a/apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx
+++ b/apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx
@@ -1,3 +1,4 @@
+import { MaterialListRow } from "../../components/MaterialListRow";
import type { VcsRef } from "@t3tools/client-runtime/state/vcs";
import { resolveEnvironmentMachineKind } from "@t3tools/contracts";
import { LegendList } from "@legendapp/list/react-native";
@@ -20,6 +21,7 @@ import {
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
+import { MaterialScreenContent } from "../../components/MaterialScreenContent";
import { SymbolView } from "../../components/AppSymbol";
import { AppText as Text } from "../../components/AppText";
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
@@ -46,6 +48,34 @@ function SelectionRow(props: {
readonly subtitle?: string;
readonly title: string;
}) {
+ if (Platform.OS === "android") {
+ return (
+ <MaterialListRow
+ title={props.title}
+ subtitle={props.subtitle}
+ leading={
+ props.icon === "arrow.triangle.branch" ? (
+ <SymbolView
+ name="arrow.triangle.branch"
+ size={24}
+ tintColorClassName="accent-icon-muted"
+ />
+ ) : (
+ props.icon
+ )
+ }
+ trailing={
+ props.selected ? (
+ <SymbolView name="checkmark" size={20} tintColorClassName="accent-primary" />
+ ) : null
+ }
+ accessibilityRole="radio"
+ accessibilityState={{ checked: props.selected }}
+ disabled={props.disabled}
+ onPress={props.onPress}
+ />
+ );
+ }
return (
<Pressable
accessibilityLabel={[props.title, props.subtitle].filter(Boolean).join(", ")}
@@ -63,7 +93,7 @@ function SelectionRow(props: {
<SymbolView
name="arrow.triangle.branch"
size={17}
- tintColorClassName={"accent-icon-muted"}
+ tintColorClassName="accent-icon-muted"
type="monochrome"
/>
) : (
@@ -83,7 +113,7 @@ function SelectionRow(props: {
<SymbolView
name="checkmark"
size={16}
- tintColorClassName={"accent-icon"}
+ tintColorClassName="accent-icon"
type="monochrome"
weight="semibold"
/>
@@ -99,7 +129,13 @@ function ToggleRow(props: {
}) {
return (
<View className="min-h-14 flex-row items-center gap-3 bg-card px-4 py-3">
- <Text className="min-w-0 flex-1 text-base font-t3-medium text-foreground" numberOfLines={1}>
+ <Text
+ className={cn(
+ "min-w-0 flex-1 text-base text-foreground",
+ Platform.OS !== "android" && "font-t3-medium",
+ )}
+ numberOfLines={1}
+ >
{props.title}
</Text>
<ThemedSwitch
@@ -125,8 +161,14 @@ function BranchSelectionRow(props: {
return (
<View
className={cn(
- props.isFirst && "overflow-hidden rounded-t-2xl",
- props.isLast && "overflow-hidden rounded-b-2xl",
+ props.isFirst &&
+ (Platform.OS === "android"
+ ? "overflow-hidden rounded-t-[28px]"
+ : "overflow-hidden rounded-t-2xl"),
+ props.isLast &&
+ (Platform.OS === "android"
+ ? "overflow-hidden rounded-b-[28px]"
+ : "overflow-hidden rounded-b-2xl"),
)}
>
<SelectionRow
@@ -143,7 +185,17 @@ function BranchSelectionRow(props: {
}
function PickerSurface(props: { readonly children: ReactNode }) {
- return <View className="overflow-hidden rounded-2xl bg-card">{props.children}</View>;
+ return (
+ <View
+ className={
+ Platform.OS === "android"
+ ? "overflow-hidden rounded-[28px] bg-card"
+ : "overflow-hidden rounded-2xl bg-card"
+ }
+ >
+ {props.children}
+ </View>
+ );
}
export function NewTaskEnvironmentPickerRouteScreen() {
@@ -161,42 +213,48 @@ export function NewTaskEnvironmentPickerRouteScreen() {
}}
/>
{Platform.OS === "android" ? (
- <AndroidScreenHeader title="Environment" onBack={() => navigation.goBack()} />
+ <AndroidScreenHeader
+ title="Environment"
+ hideBottomBorder
+ onBack={() => navigation.goBack()}
+ />
) : null}
- <ScrollView
- contentInsetAdjustmentBehavior="automatic"
- contentContainerStyle={{
- paddingBottom: Math.max(insets.bottom, 16) + 16,
- paddingHorizontal: 16,
- paddingTop: 16,
- }}
- showsVerticalScrollIndicator={false}
- >
- <PickerSurface>
- {flow.environments.map((environment, index) => (
- <SelectionRow
- key={String(environment.environmentId)}
- icon={
- <EnvironmentMachineSymbol
- kind={resolveEnvironmentMachineKind(
- serverConfigs.get(environment.environmentId) ?? null,
- )}
- size={17}
- tintColorClassName="accent-icon-muted"
- />
- }
- isLast={index === flow.environments.length - 1}
- onPress={() => {
- void Haptics.selectionAsync();
- flow.selectEnvironment(environment.environmentId);
- navigation.goBack();
- }}
- selected={flow.selectedEnvironmentId === environment.environmentId}
- title={environment.environmentLabel}
- />
- ))}
- </PickerSurface>
- </ScrollView>
+ <MaterialScreenContent>
+ <ScrollView
+ contentInsetAdjustmentBehavior="automatic"
+ contentContainerStyle={{
+ paddingBottom: Math.max(insets.bottom, 16) + 16,
+ paddingHorizontal: 16,
+ paddingTop: 16,
+ }}
+ showsVerticalScrollIndicator={false}
+ >
+ <PickerSurface>
+ {flow.environments.map((environment, index) => (
+ <SelectionRow
+ key={String(environment.environmentId)}
+ icon={
+ <EnvironmentMachineSymbol
+ kind={resolveEnvironmentMachineKind(
+ serverConfigs.get(environment.environmentId) ?? null,
+ )}
+ size={Platform.OS === "android" ? 24 : 17}
+ tintColorClassName="accent-icon-muted"
+ />
+ }
+ isLast={index === flow.environments.length - 1}
+ onPress={() => {
+ void Haptics.selectionAsync();
+ flow.selectEnvironment(environment.environmentId);
+ navigation.goBack();
+ }}
+ selected={flow.selectedEnvironmentId === environment.environmentId}
+ title={environment.environmentLabel}
+ />
+ ))}
+ </PickerSurface>
+ </ScrollView>
+ </MaterialScreenContent>
</View>
);
}
@@ -225,7 +283,7 @@ export function NewTaskBranchPickerRouteScreen() {
? 16
: Math.max(insets.bottom, 16) + 16,
paddingHorizontal: 16,
- paddingTop: 12,
+ paddingTop: 16,
}),
[insets.bottom, usesNativeMailSearchToolbar],
);
@@ -327,7 +385,12 @@ export function NewTaskBranchPickerRouteScreen() {
const branchListHeader =
flow.workspaceMode === "worktree" ? (
- <View className="mb-3 overflow-hidden rounded-2xl">
+ <View
+ className={cn(
+ "mb-3 overflow-hidden",
+ Platform.OS === "android" ? "rounded-[28px]" : "rounded-2xl",
+ )}
+ >
<ToggleRow
onValueChange={flow.setStartFromOrigin}
title="Start from origin"
@@ -339,9 +402,9 @@ export function NewTaskBranchPickerRouteScreen() {
const branchContent =
flow.filteredBranches.length === 0 ? (
<ScrollView
- className="flex-1 bg-sheet"
+ className={Platform.OS === "android" ? "flex-1 bg-sheet-solid" : "flex-1 bg-sheet"}
contentInsetAdjustmentBehavior="automatic"
- contentContainerStyle={{ flexGrow: 1, paddingHorizontal: 16, paddingTop: 12 }}
+ contentContainerStyle={{ flexGrow: 1, paddingHorizontal: 16, paddingTop: 16 }}
scrollEnabled={false}
showsVerticalScrollIndicator={false}
>
@@ -380,7 +443,7 @@ export function NewTaskBranchPickerRouteScreen() {
alwaysBounceVertical={false}
automaticallyAdjustsScrollIndicatorInsets
automaticallyAdjustKeyboardInsets={Platform.OS === "ios"}
- className="flex-1 bg-sheet"
+ className={Platform.OS === "android" ? "flex-1 bg-sheet-solid" : "flex-1 bg-sheet"}
contentInsetAdjustmentBehavior="automatic"
contentContainerStyle={branchListContentStyle}
data={flow.filteredBranches}
@@ -408,19 +471,27 @@ export function NewTaskBranchPickerRouteScreen() {
return (
<View className="flex-1 bg-sheet" collapsable={false}>
<NativeStackScreenOptions options={{ headerShown: false }} />
- <AndroidScreenHeader title={screenTitle} onBack={() => navigation.goBack()} />
- <View className="px-4 pb-2 pt-3">
+ <AndroidScreenHeader
+ title={screenTitle}
+ hideBottomBorder
+ onBack={() => navigation.goBack()}
+ />
+ <View className="bg-header px-4 pb-3 pt-1">
<TextInput
autoCapitalize="none"
autoCorrect={false}
- className="h-11 rounded-xl bg-card px-4 font-sans text-base text-foreground"
+ accessibilityLabel="Find a branch"
+ className="h-12 rounded-full border border-input-border bg-input px-4 font-sans text-base text-foreground"
+ selectionColorClassName="accent-primary/32"
+ cursorColorClassName="accent-primary"
+ selectionHandleColorClassName="accent-primary"
onChangeText={flow.setBranchQuery}
placeholder="Find a branch"
- placeholderTextColorClassName={"accent-placeholder"}
+ placeholderTextColorClassName="accent-placeholder"
value={flow.branchQuery}
/>
</View>
- {branchContent}
+ <MaterialScreenContent>{branchContent}</MaterialScreenContent>
</View>
);
}
diff --git a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
index 6badb4da33e..9732ed6865f 100644
--- a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+++ b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
@@ -27,12 +27,10 @@ import Animated from "react-native-reanimated";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { useUniwindTheme } from "../../lib/useUniwindTheme";
import { useFontFamily } from "../../lib/useFontFamily";
-
import {
PROVIDER_SEND_TURN_MAX_ATTACHMENTS,
PROVIDER_SEND_TURN_MAX_INPUT_CHARS,
resolveEnvironmentMachineKind,
- type EnvironmentId,
} from "@t3tools/contracts";
import {
@@ -51,6 +49,7 @@ import {
ComposerToolbarRow,
} from "../../components/ComposerToolbar";
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
+import { MaterialScreenContent } from "../../components/MaterialScreenContent";
import { ComposerAttachmentButton } from "../../components/ComposerAttachmentButton";
import { ComposerAttachmentStrip } from "../../components/ComposerAttachmentStrip";
import { composerStripAttachments } from "../../lib/composerImages";
@@ -81,7 +80,6 @@ import {
useThreadSettingsSheetPresentation,
type NavigationWithFinishTransitioning,
} from "./use-thread-settings-sheet-presentation";
-
import { makeTurnCommandMetadata } from "../../lib/commandMetadata";
import {
convertPastedImagesToAttachments,
@@ -140,7 +138,7 @@ function NewTaskWorkspaceIcon(props: {
<SymbolView
name="folder"
size={16}
- tintColorClassName={"accent-icon-muted"}
+ tintColorClassName="accent-icon-muted"
type="monochrome"
/>
);
@@ -151,14 +149,14 @@ function NewTaskWorkspaceIcon(props: {
<SymbolView
name="folder"
size={16}
- tintColorClassName={"accent-icon-muted"}
+ tintColorClassName="accent-icon-muted"
type="monochrome"
/>
<View className="absolute -right-1 -bottom-1">
<SymbolView
name="arrow.triangle.branch"
size={9}
- tintColorClassName={"accent-icon-muted"}
+ tintColorClassName="accent-icon-muted"
type="monochrome"
/>
</View>
@@ -1322,7 +1320,11 @@ export function NewTaskDraftScreen(props: {
{Platform.OS === "android" ? (
<>
<NativeStackScreenOptions options={{ headerShown: false }} />
- <AndroidScreenHeader title="New Thread" onBack={() => navigation.goBack()} />
+ <AndroidScreenHeader
+ title="New thread"
+ hideBottomBorder
+ onBack={() => navigation.goBack()}
+ />
</>
) : (
<NativeStackScreenOptions options={{ title: "Loading task" }} />
@@ -1540,7 +1542,12 @@ export function NewTaskDraftScreen(props: {
);
const composerDock = (
- <View className="bg-sheet px-[12px] pt-1" style={{ paddingBottom: controlsBottomPadding }}>
+ <View
+ className={
+ Platform.OS === "android" ? "bg-sheet-solid px-[12px] pt-1" : "bg-sheet px-[12px] pt-1"
+ }
+ style={{ paddingBottom: controlsBottomPadding }}
+ >
{!voiceInput.isBusy &&
composerMenu.trigger &&
(composerMenu.items.length > 0 || composerMenu.trigger.kind === "pull-request") ? (
@@ -1754,15 +1761,17 @@ export function NewTaskDraftScreen(props: {
return (
<View className="flex-1 bg-sheet" collapsable={false}>
<NativeStackScreenOptions options={{ headerShown: false }} />
- <AndroidScreenHeader title="New task" onBack={closeNewTask} />
- {heroViewport}
+ <AndroidScreenHeader title="New thread" hideBottomBorder onBack={closeNewTask} />
+ <MaterialScreenContent>
+ {heroViewport}
- <KeyboardStickyView
- style={{ position: "absolute", bottom: 0, left: 0, right: 0 }}
- offset={{ closed: 0, opened: keyboardOpenedOffset }}
- >
- {composerDock}
- </KeyboardStickyView>
+ <KeyboardStickyView
+ style={{ position: "absolute", bottom: 0, left: 0, right: 0 }}
+ offset={{ closed: 0, opened: keyboardOpenedOffset }}
+ >
+ {composerDock}
+ </KeyboardStickyView>
+ </MaterialScreenContent>
</View>
);
}
diff --git a/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx b/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
index e9bcb1291e3..4b987bbb142 100644
--- a/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
+++ b/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
@@ -1,3 +1,4 @@
+import { MaterialListRow } from "../../components/MaterialListRow";
import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
import {
StackActions,
@@ -8,11 +9,13 @@ import {
import { SymbolView } from "../../components/AppSymbol";
import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell";
import { useEffect, useRef } from "react";
-import { ActivityIndicator, Alert, Platform, Pressable, ScrollView, View } from "react-native";
+import { ActivityIndicator, Alert, Platform, Pressable, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { cn } from "../../lib/cn";
-
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
+import { MaterialScreenContent } from "../../components/MaterialScreenContent";
+import { MaterialButton } from "../../components/MaterialButton";
+import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
import { AppText as Text } from "../../components/AppText";
import { ProjectFavicon } from "../../components/ProjectFavicon";
import { useProjects } from "../../state/entities";
@@ -183,8 +186,9 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
<NativeStackScreenOptions options={{ headerShown: false }} />
<AndroidScreenHeader
title={screenTitle}
+ hideBottomBorder
subtitle={incomingShareSubtitle}
- onBack={layout.usesSplitView ? () => navigation.goBack() : undefined}
+ onBack={() => navigation.goBack()}
actions={
catalogState.hasReadyEnvironment
? [
@@ -226,97 +230,156 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
</>
)}
- <ScrollView
- contentInsetAdjustmentBehavior="automatic"
- showsVerticalScrollIndicator={false}
- className="flex-1"
- contentContainerStyle={{
- gap: 12,
- paddingBottom: Math.max(insets.bottom, 18) + 18,
- paddingHorizontal: 20,
- paddingTop: 8,
- }}
- >
- {projectScopes.length === 0 ? (
- <View collapsable={false} className="items-center gap-3 rounded-[24px] bg-card px-6 py-8">
- {projectEmptyState.loading ? (
- <ActivityIndicator colorClassName={"accent-icon-muted"} />
- ) : null}
- <Text className="text-center text-lg font-t3-bold text-foreground">
- {projectEmptyState.title}
- </Text>
- <Text className="text-center text-sm leading-normal text-foreground-muted">
- {projectEmptyState.detail}
- </Text>
- {!catalogState.hasReadyEnvironment ? (
- <Pressable
- className="mt-1 rounded-full bg-primary px-4 py-2.5 active:opacity-70"
- onPress={() => navigation.navigate("ConnectionsNew")}
- >
- <Text className="text-sm font-t3-bold text-primary-foreground">
- Add environment
- </Text>
- </Pressable>
- ) : (
- <Pressable
- className="mt-1 rounded-full bg-primary px-4 py-2.5 active:opacity-70"
- onPress={() => navigation.dispatch(StackActions.push("AddProject"))}
- >
- <Text className="text-sm font-t3-bold text-primary-foreground">
- Add new project
- </Text>
- </Pressable>
- )}
- </View>
- ) : (
- <View collapsable={false} className="overflow-hidden rounded-[24px] bg-card">
- {projectScopes.map((scope, scopeIndex) => {
- const hasMultipleProjects = scope.projects.length > 1;
- const selectionTarget = getProjectScopeSelectionTarget(scope, selectedEnvironmentId);
- return (
- <View
- key={scope.key}
- className={cn(scopeIndex > 0 && "border-t border-border-subtle")}
+ <MaterialScreenContent>
+ <ScrollView
+ contentInsetAdjustmentBehavior="automatic"
+ showsVerticalScrollIndicator={false}
+ className="flex-1"
+ contentContainerStyle={{
+ gap: Platform.OS === "android" ? 8 : 12,
+ paddingBottom: Math.max(insets.bottom, 18) + 18,
+ paddingHorizontal: Platform.OS === "android" ? 16 : 20,
+ paddingTop: Platform.OS === "android" ? 16 : 8,
+ ...(Platform.OS === "android" && projectScopes.length === 0
+ ? { flexGrow: 1, justifyContent: "center" as const }
+ : {}),
+ }}
+ >
+ {projectScopes.length === 0 ? (
+ <View
+ collapsable={false}
+ className={cn(
+ "items-center gap-3 px-6 py-8",
+ Platform.OS !== "android" && "rounded-[24px] bg-card",
+ )}
+ >
+ {projectEmptyState.loading ? (
+ <ActivityIndicator colorClassName="accent-icon-muted" />
+ ) : null}
+ <Text className="text-center text-lg font-t3-bold text-foreground">
+ {projectEmptyState.title}
+ </Text>
+ <Text className="text-center text-sm leading-normal text-foreground-muted">
+ {projectEmptyState.detail}
+ </Text>
+ {Platform.OS === "android" ? (
+ <MaterialButton
+ label={catalogState.hasReadyEnvironment ? "Add new project" : "Add environment"}
+ tone="primary"
+ onPress={() =>
+ catalogState.hasReadyEnvironment
+ ? navigation.dispatch(StackActions.push("AddProject"))
+ : navigation.navigate("ConnectionsNew")
+ }
+ />
+ ) : !catalogState.hasReadyEnvironment ? (
+ <Pressable
+ className="mt-1 rounded-full bg-primary px-4 py-2.5 active:opacity-70"
+ onPress={() => navigation.navigate("ConnectionsNew")}
>
- <Pressable
- disabled={reservedDestinationProject !== null}
- onPress={() => void selectProject(selectionTarget)}
- className="flex-row items-center gap-3 bg-card px-4 py-3.5"
- >
- <View className="h-7 w-7 items-center justify-center">
- <ProjectFavicon
- environmentId={scope.representative.environmentId}
- faviconPath={scope.representative.faviconPath}
- size={20}
- projectTitle={scope.title}
- workspaceRoot={scope.representative.workspaceRoot}
- />
- </View>
- <View className="min-w-0 flex-1">
- <Text className="text-base leading-snug font-t3-bold">{scope.title}</Text>
- <Text
- className="text-xs leading-snug text-foreground-muted"
- ellipsizeMode="middle"
- numberOfLines={1}
- >
- {hasMultipleProjects
+ <Text className="text-sm font-t3-bold text-primary-foreground">
+ Add environment
+ </Text>
+ </Pressable>
+ ) : (
+ <Pressable
+ className="mt-1 rounded-full bg-primary px-4 py-2.5 active:opacity-70"
+ onPress={() => navigation.dispatch(StackActions.push("AddProject"))}
+ >
+ <Text className="text-sm font-t3-bold text-primary-foreground">
+ Add new project
+ </Text>
+ </Pressable>
+ )}
+ </View>
+ ) : (
+ <View
+ collapsable={false}
+ className={
+ Platform.OS === "android"
+ ? "overflow-hidden rounded-[28px] bg-card"
+ : "overflow-hidden rounded-[24px] bg-card"
+ }
+ >
+ {projectScopes.map((scope, scopeIndex) => {
+ const hasMultipleProjects = scope.projects.length > 1;
+ const selectionTarget = getProjectScopeSelectionTarget(
+ scope,
+ selectedEnvironmentId,
+ );
+ if (Platform.OS === "android") {
+ return (
+ <MaterialListRow
+ key={scope.key}
+ title={scope.title}
+ subtitle={
+ hasMultipleProjects
? `${scope.projects.length} workspaces`
- : selectionTarget.workspaceRoot}
- </Text>
- </View>
- <SymbolView
- name="chevron.right"
- size={14}
- tintColorClassName={"accent-chevron"}
- type="monochrome"
+ : selectionTarget.workspaceRoot
+ }
+ disabled={reservedDestinationProject !== null}
+ onPress={() => void selectProject(selectionTarget)}
+ leading={
+ <ProjectFavicon
+ environmentId={scope.representative.environmentId}
+ faviconPath={scope.representative.faviconPath}
+ size={24}
+ projectTitle={scope.title}
+ workspaceRoot={scope.representative.workspaceRoot}
+ />
+ }
/>
- </Pressable>
- </View>
- );
- })}
- </View>
- )}
- </ScrollView>
+ );
+ }
+ return (
+ <View
+ key={scope.key}
+ className={cn(scopeIndex > 0 && "border-t border-border-subtle")}
+ >
+ <Pressable
+ accessibilityRole="button"
+ accessibilityLabel={scope.title}
+ disabled={reservedDestinationProject !== null}
+ onPress={() => void selectProject(selectionTarget)}
+ className="flex-row items-center gap-3 bg-card px-4 py-3.5"
+ >
+ <View className="h-7 w-7 items-center justify-center">
+ <ProjectFavicon
+ environmentId={scope.representative.environmentId}
+ faviconPath={scope.representative.faviconPath}
+ size={20}
+ projectTitle={scope.title}
+ workspaceRoot={scope.representative.workspaceRoot}
+ />
+ </View>
+ <View className="min-w-0 flex-1">
+ <Text className={cn("text-base leading-snug", "font-t3-bold")}>
+ {scope.title}
+ </Text>
+ <Text
+ className="text-xs leading-snug text-foreground-muted"
+ ellipsizeMode="middle"
+ numberOfLines={1}
+ >
+ {hasMultipleProjects
+ ? `${scope.projects.length} workspaces`
+ : selectionTarget.workspaceRoot}
+ </Text>
+ </View>
+ <SymbolView
+ name="chevron.right"
+ size={14}
+ tintColorClassName="accent-chevron"
+ type="monochrome"
+ />
+ </Pressable>
+ </View>
+ );
+ })}
+ </View>
+ )}
+ </ScrollView>
+ </MaterialScreenContent>
</View>
);
}
diff --git a/apps/mobile/src/features/threads/ThreadComposer.tsx b/apps/mobile/src/features/threads/ThreadComposer.tsx
index 680c9cf0bab..7fd517c4f3b 100644
--- a/apps/mobile/src/features/threads/ThreadComposer.tsx
+++ b/apps/mobile/src/features/threads/ThreadComposer.tsx
@@ -49,6 +49,7 @@ import Animated, {
withTiming,
} from "react-native-reanimated";
import { useUniwindTheme } from "../../lib/useUniwindTheme";
+import { themeColorWithAlpha } from "../../lib/mobileTheme";
import { armAgentAwarenessLiveActivityForLocalWork } from "../agent-awareness/remoteRegistration";
import { scopedThreadKey } from "../../lib/scopedEntities";
import {
@@ -208,7 +209,6 @@ export function ComposerSurface(props: {
/** Morphs between the compact and expanded composer layouts. */
readonly animateLayout?: boolean;
}) {
- const { materialYouStyleLayoutActive } = useAppearancePreferences();
const colors = useUniwindTheme();
const targetBorderRadius =
typeof props.style.borderRadius === "number" ? props.style.borderRadius : 0;
@@ -232,27 +232,23 @@ export function ComposerSurface(props: {
return (
<Animated.View
className={
- materialYouStyleLayoutActive
- ? undefined
- : "shadow-[0_6px_28px] shadow-adaptive-black-a15-a35"
+ Platform.OS === "android" ? undefined : "shadow-[0_6px_28px] shadow-adaptive-black-a15-a35"
}
layout={layoutTransition}
style={[
animatedShapeStyle,
{
overflow: "hidden",
- // Android versions before 9 do not support outset box shadows.
- elevation: Platform.OS === "android" && Platform.Version < 28 ? 10 : undefined,
},
]}
>
<AnimatedGlassSurface
chrome="none"
fallbackColor={
- materialYouStyleLayoutActive ? colors["--color-composer-surface"] : colors["--color-card"]
+ Platform.OS === "android" ? colors["--color-composer-surface"] : colors["--color-card"]
}
fallbackClassName={
- materialYouStyleLayoutActive ? "border border-composer-border" : "border border-border"
+ Platform.OS === "android" ? "border border-composer-border" : "border border-border"
}
glassEffectStyle="regular"
// The composer is a passive material containing interactive controls.
@@ -277,8 +273,7 @@ export function ComposerSurface(props: {
export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposerProps) {
const project = useProject(scopeProjectRef(props.environmentId, props.selectedThread.projectId));
- const { materialYouStyleLayoutActive, themeVariables: materialTheme } =
- useAppearancePreferences();
+ const { themeVariables: materialTheme } = useAppearancePreferences();
const composerPanel = materialTheme["--color-composer-panel"];
const navigation = useNavigation();
const foregroundColor = useUniwindTheme()["--color-foreground"];
@@ -627,7 +622,8 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer
style={{
paddingTop: isExpanded ? 8 : 6,
paddingBottom: (props.bottomInset ?? 0) + (isExpanded ? 8 : 6),
- backgroundColor: materialYouStyleLayoutActive ? composerPanel : undefined,
+ backgroundColor:
+ Platform.OS === "android" ? themeColorWithAlpha(composerPanel, 1) : undefined,
}}
>
{/* The backdrop gradient lives on a plain View: Reanimated's Animated.View
@@ -635,7 +631,7 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer
strip fully transparent and the feed text legible through the composer. */}
<View
className={
- materialYouStyleLayoutActive
+ Platform.OS === "android"
? "hidden"
: "absolute inset-0 bg-linear-to-b from-screen/0 via-screen/60 to-screen/90"
}
diff --git a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx
index 2f4ee67a187..4f631eb2a1b 100644
--- a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+++ b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx
@@ -27,8 +27,6 @@ import type {
UserInputQuestion,
} from "@t3tools/contracts";
import * as Haptics from "expo-haptics";
-import { BlurTargetView } from "expo-blur";
-import { GlassBlurTargetContext } from "../../lib/glassBlurTarget";
import {
memo,
useCallback,
@@ -65,7 +63,6 @@ import Animated, {
} from "react-native-reanimated";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { useWorkspaceContentWidth } from "../layout/workspace-content-width";
-
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import { collectProviderUsageLimits } from "@t3tools/shared/usageLimits";
import type { ComposerEditorHandle } from "../../components/ComposerEditor";
@@ -819,7 +816,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
}, [freeze, scrollMessageToEnd]);
const showScrollToEndButton = contentPresentationKind === "ready" && !endFollowEnabled;
- const { themeAppearance, materialYouStyleLayoutActive } = useAppearancePreferences();
+ const { themeAppearance } = useAppearancePreferences();
const isDarkMode = themeAppearance === "dark";
const handleFeedTouchStart = useCallback((event: GestureResponderEvent) => {
@@ -851,13 +848,11 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
const handleFeedTouchCancel = useCallback(() => {
feedTouchStartRef.current = null;
}, []);
- const feedBlurTarget = useRef<View>(null);
return (
<View className="flex-1">
{showContent ? (
- <BlurTargetView
- ref={feedBlurTarget}
+ <View
style={{ flex: 1 }}
onTouchStart={handleFeedTouchStart}
onTouchMove={handleFeedTouchMove}
@@ -867,7 +862,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
<View
pointerEvents="none"
className={
- materialYouStyleLayoutActive
+ Platform.OS === "android"
? "absolute inset-0 bg-thread-canvas"
: "absolute inset-0 bg-screen"
}
@@ -903,7 +898,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
onUseArtifactTemplate={handleUseArtifactTemplate}
loadEarlier={props.loadEarlier ?? null}
/>
- </BlurTargetView>
+ </View>
) : (
<View className="flex-1" />
)}
@@ -1025,44 +1020,42 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
: undefined
}
>
- <GlassBlurTargetContext value={feedBlurTarget}>
- <ThreadComposer
- editorRef={composerEditorRef}
- draftMessage={props.draftMessage}
- draftAttachments={props.draftAttachments}
- placeholder="Ask the repo agent, or run a command…"
- contentMaxWidth={contentMaxWidth}
- connectionState={props.connectionStateLabel}
- environmentLabel={props.environmentLabel}
- selectedThread={props.selectedThread}
- hasCompactableConversation={hasCompactableConversation && !props.isCompacting}
- serverConfig={props.serverConfig}
- queueCount={props.selectedThreadQueueCount}
- environmentId={props.environmentId}
- projectCwd={props.threadCwd ?? props.projectWorkspaceRoot}
- // Follow-ups typed during setup wait in the draft: queueing
- // them against a thread id the server may still reject
- // would strand them in the outbox.
- sendBlockedReason={
- props.creationState?.kind === "preparing" ? "Starting the task…" : null
- }
- bottomInset={composerBottomInset}
- onChangeDraftMessage={props.onChangeDraftMessage}
- onPickDraftMedia={props.onPickDraftMedia}
- onPickDraftFiles={props.onPickDraftFiles}
- onNativePasteImages={props.onNativePasteImages}
- onNativePasteText={props.onNativePasteText}
- onRemoveDraftImage={props.onRemoveDraftImage}
- onStopThread={props.onStopThread}
- onSendMessage={handleSendMessage}
- onShowUsageLimits={showUsageLimits}
- onUpdateModelSelection={props.onUpdateThreadModelSelection}
- onUpdateRuntimeMode={props.onUpdateThreadRuntimeMode}
- onUpdateInteractionMode={props.onUpdateThreadInteractionMode}
- onExpandedChange={setComposerExpanded}
- onEditorFocusChange={handleComposerFocusChange}
- />
- </GlassBlurTargetContext>
+ <ThreadComposer
+ editorRef={composerEditorRef}
+ draftMessage={props.draftMessage}
+ draftAttachments={props.draftAttachments}
+ placeholder="Ask the repo agent, or run a command…"
+ contentMaxWidth={contentMaxWidth}
+ connectionState={props.connectionStateLabel}
+ environmentLabel={props.environmentLabel}
+ selectedThread={props.selectedThread}
+ hasCompactableConversation={hasCompactableConversation && !props.isCompacting}
+ serverConfig={props.serverConfig}
+ queueCount={props.selectedThreadQueueCount}
+ environmentId={props.environmentId}
+ projectCwd={props.threadCwd ?? props.projectWorkspaceRoot}
+ // Follow-ups typed during setup wait in the draft: queueing
+ // them against a thread id the server may still reject
+ // would strand them in the outbox.
+ sendBlockedReason={
+ props.creationState?.kind === "preparing" ? "Starting the task…" : null
+ }
+ bottomInset={composerBottomInset}
+ onChangeDraftMessage={props.onChangeDraftMessage}
+ onPickDraftMedia={props.onPickDraftMedia}
+ onPickDraftFiles={props.onPickDraftFiles}
+ onNativePasteImages={props.onNativePasteImages}
+ onNativePasteText={props.onNativePasteText}
+ onRemoveDraftImage={props.onRemoveDraftImage}
+ onStopThread={props.onStopThread}
+ onSendMessage={handleSendMessage}
+ onShowUsageLimits={showUsageLimits}
+ onUpdateModelSelection={props.onUpdateThreadModelSelection}
+ onUpdateRuntimeMode={props.onUpdateThreadRuntimeMode}
+ onUpdateInteractionMode={props.onUpdateThreadInteractionMode}
+ onExpandedChange={setComposerExpanded}
+ onEditorFocusChange={handleComposerFocusChange}
+ />
</View>
</View>
</Animated.View>
diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsx
index 4cafbd6d8e1..ce94ebe8cab 100644
--- a/apps/mobile/src/features/threads/ThreadFeed.tsx
+++ b/apps/mobile/src/features/threads/ThreadFeed.tsx
@@ -880,6 +880,7 @@ function MarkdownCodeBlock(props: {
>
<NativeText
selectable
+ selectionColorClassName={Platform.OS === "android" ? "accent-primary/32" : undefined}
className="font-mono"
style={{
color: props.textColor,
diff --git a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
index 26093e87536..df04439a94b 100644
--- a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
+++ b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
@@ -65,6 +65,9 @@ import {
WorkspaceConnectionTitle,
} from "../home/WorkspaceConnectionTitle";
import { SidebarHeaderActions } from "./sidebar-header-actions";
+import { MaterialThreadListToolbar } from "../home/MaterialThreadListToolbar";
+import { useMaterialToolbarHeight } from "../../components/useMaterialToolbarHeight";
+import { useMaterialFabScroll } from "../home/MaterialFabScrollContext";
import { SidebarFilterButton } from "./sidebar-filter-button";
import { createSidebarHeaderItems } from "./sidebar-native-header-items";
import { SidebarNavigationShell } from "./sidebar-navigation-shell";
@@ -147,10 +150,8 @@ function NativeSidebarContainer(props: ThreadNavigationSidebarProps) {
function ThreadNavigationSidebarPane(
props: ThreadNavigationSidebarProps & { readonly nativeChrome: boolean },
) {
- const { materialYouStyleLayoutActive, themeVariables: materialTheme } =
- useAppearancePreferences();
+ const { themeVariables: materialTheme } = useAppearancePreferences();
const screenColor = materialTheme["--color-screen"];
- const mutedColor = materialTheme["--color-foreground-muted"];
const insets = useSafeAreaInsets();
const projects = useProjects();
@@ -747,13 +748,18 @@ function ThreadNavigationSidebarPane(
);
const [measuredHeaderHeight, setMeasuredHeaderHeight] = useState<number | null>(null);
+ const materialToolbarHeight = useMaterialToolbarHeight();
// The sticky header (title row, search field, optional connection status)
// is measured so the list inset always matches its real height — no
// hardcoded per-variant constants.
- const stickyHeaderHeight = measuredHeaderHeight ?? insets.top + SIDEBAR_STICKY_HEADER_HEIGHT;
+ const stickyHeaderHeight =
+ measuredHeaderHeight ??
+ (Platform.OS === "android"
+ ? Math.max(insets.top, 12) + materialToolbarHeight + 8
+ : insets.top + SIDEBAR_STICKY_HEADER_HEIGHT);
const topListInset = stickyHeaderHeight + 6;
const handleStickyHeaderLayout = useCallback((event: LayoutChangeEvent) => {
- const nextHeight = Math.round(event.nativeEvent.layout.height);
+ const nextHeight = event.nativeEvent.layout.height;
setMeasuredHeaderHeight((current) => (current === nextHeight ? current : nextHeight));
}, []);
const handleSwipeableWillOpen = useCallback((methods: SwipeableMethods) => {
@@ -777,7 +783,9 @@ function ThreadNavigationSidebarPane(
const handleScrollBeginDrag = useCallback(() => {
openSwipeableRef.current?.close();
}, []);
+ const onMaterialFabScroll = useMaterialFabScroll();
const { swipeEnabled, scrollGateHandlers } = useSwipeableScrollGate({
+ onScroll: onMaterialFabScroll,
onScrollBeginDrag: handleScrollBeginDrag,
});
// Project shells load after the first rows draw, so the maps they feed have
@@ -850,6 +858,7 @@ function ThreadNavigationSidebarPane(
[],
);
const focusSearch = useCallback(() => {
+ if (Platform.OS === "android") return false;
const focus = () => {
if (props.nativeChrome) {
searchBarRef.current?.focus();
@@ -925,7 +934,7 @@ function ThreadNavigationSidebarPane(
}),
)}
searchQuery={props.searchQuery}
- pane={materialYouStyleLayoutActive ? "screen" : "sidebar"}
+ pane={Platform.OS === "android" ? "screen" : "sidebar"}
selected={
scopedThreadKey(thread.environmentId, thread.id) === props.selectedThreadKey
}
@@ -966,7 +975,7 @@ function ThreadNavigationSidebarPane(
disabled={!shelfPreferencesLoaded}
expanded={item.expanded}
onToggle={toggleSnoozedShelf}
- pane={materialYouStyleLayoutActive ? "screen" : "sidebar"}
+ pane={Platform.OS === "android" ? "screen" : "sidebar"}
/>
);
case "v2-settled-shelf":
@@ -976,7 +985,7 @@ function ThreadNavigationSidebarPane(
disabled={!shelfPreferencesLoaded}
expanded={item.expanded}
onToggle={toggleSettledShelf}
- pane={materialYouStyleLayoutActive ? "screen" : "sidebar"}
+ pane={Platform.OS === "android" ? "screen" : "sidebar"}
/>
);
case "v2-show-more":
@@ -996,7 +1005,7 @@ function ThreadNavigationSidebarPane(
case "header":
return (
<ThreadListGroupHeader
- variant={materialYouStyleLayoutActive ? "compact" : "sidebar"}
+ variant={Platform.OS === "android" ? "compact" : "sidebar"}
collapsed={item.collapsed}
isFirst={item.isFirst}
groupKey={item.group.key}
@@ -1014,7 +1023,7 @@ function ThreadNavigationSidebarPane(
case "pending-task":
return (
<PendingTaskListRow
- variant={materialYouStyleLayoutActive ? "compact" : "sidebar"}
+ variant={Platform.OS === "android" ? "compact" : "sidebar"}
pendingTask={item.pendingTask}
environmentLabel={
savedConnectionsById[item.pendingTask.environmentId]?.environmentLabel ?? null
@@ -1064,7 +1073,7 @@ function ThreadNavigationSidebarPane(
case "show-more":
return (
<ThreadListShowMoreRow
- variant={materialYouStyleLayoutActive ? "compact" : "sidebar"}
+ variant={Platform.OS === "android" ? "compact" : "sidebar"}
hiddenCount={item.hiddenCount}
canShowLess={item.canShowLess}
groupKey={item.groupKey}
@@ -1074,7 +1083,6 @@ function ThreadNavigationSidebarPane(
}
},
[
- materialYouStyleLayoutActive,
archiveThread,
activeReorderEnvironmentIds,
threadMovePlanners,
@@ -1166,16 +1174,24 @@ function ThreadNavigationSidebarPane(
// Snoozed threads need no special case: the shelf header is a list row
// even while collapsed.
const listEmpty = (
- <Text className="px-2 py-4 text-sm text-foreground-muted">
+ <Text
+ className={
+ Platform.OS === "android"
+ ? "px-4 py-4 text-center text-sm text-foreground-muted"
+ : "px-2 py-4 text-sm text-foreground-muted"
+ }
+ >
{catalogState.isLoadingConnections
? "Loading threads…"
- : props.searchQuery.trim().length > 0
- ? threadSearch.isPending
- ? "Searching thread messages…"
- : "No matching threads"
- : selectedProjectScope !== null
- ? `No threads in ${selectedProjectScope.title}`
- : "No threads yet"}
+ : Platform.OS === "android" && !catalogState.hasConnections
+ ? "No environments connected"
+ : props.searchQuery.trim().length > 0
+ ? threadSearch.isPending
+ ? "Searching thread messages…"
+ : "No matching threads"
+ : selectedProjectScope !== null
+ ? `No threads in ${selectedProjectScope.title}`
+ : "No threads yet"}
</Text>
);
@@ -1232,7 +1248,7 @@ function ThreadNavigationSidebarPane(
}
contentContainerStyle={[
styles.threadListContent,
- materialYouStyleLayoutActive ? { paddingHorizontal: 0 } : null,
+ Platform.OS === "android" ? { paddingHorizontal: 0 } : null,
{
paddingBottom: Math.max(insets.bottom, 16) + 16,
paddingTop: 6,
@@ -1257,15 +1273,18 @@ function ThreadNavigationSidebarPane(
return (
<View
testID="thread-navigation-sidebar"
- className="flex-1 border-r border-border bg-drawer"
+ className={
+ Platform.OS === "android" ? "flex-1 bg-header" : "flex-1 border-r border-border bg-drawer"
+ }
style={{ width: props.width }}
>
<View
className="flex-1"
style={
- materialYouStyleLayoutActive
+ Platform.OS === "android"
? {
marginTop: stickyHeaderHeight,
+ marginHorizontal: 4,
paddingBottom: insets.bottom,
backgroundColor: screenColor,
borderTopLeftRadius: 28,
@@ -1275,116 +1294,117 @@ function ThreadNavigationSidebarPane(
: { paddingBottom: insets.bottom }
}
>
- <SwipeableScrollGateProvider enabled={swipeEnabled}>
- <GestureDetector gesture={sidebarScrollGesture}>
- <LegendList
- data={listItems}
- drawDistance={500}
- estimatedItemSize={64}
- extraData={listExtraData}
- getItemType={(item) => item.type}
- itemsAreEqual={sidebarItemsAreEqual}
- keyExtractor={(item) => item.key}
- renderItem={renderListItem}
- contentContainerStyle={[
- styles.threadListContent,
- materialYouStyleLayoutActive ? { paddingHorizontal: 0 } : null,
- {
- paddingBottom:
- Platform.OS === "android"
- ? Math.max(insets.bottom, 16) + 88 - insets.bottom
- : 16 + insets.bottom,
- paddingTop: materialYouStyleLayoutActive ? 6 : topListInset,
- },
- ]}
- keyboardDismissMode="on-drag"
- keyboardShouldPersistTaps="handled"
- {...scrollGateHandlers}
- recycleItems
- scrollEventThrottle={16}
- showsVerticalScrollIndicator={false}
- style={styles.threadList}
- ListEmptyComponent={listEmpty}
- />
- </GestureDetector>
- </SwipeableScrollGateProvider>
+ {Platform.OS === "android" && listItems.length === 0 ? (
+ <View className="flex-1 items-center justify-center">{listEmpty}</View>
+ ) : (
+ <SwipeableScrollGateProvider enabled={swipeEnabled}>
+ <GestureDetector gesture={sidebarScrollGesture}>
+ <LegendList
+ data={listItems}
+ drawDistance={500}
+ estimatedItemSize={64}
+ extraData={listExtraData}
+ getItemType={(item) => item.type}
+ itemsAreEqual={sidebarItemsAreEqual}
+ keyExtractor={(item) => item.key}
+ renderItem={renderListItem}
+ contentContainerStyle={[
+ styles.threadListContent,
+ Platform.OS === "android" ? { paddingHorizontal: 0 } : null,
+ {
+ paddingBottom:
+ Platform.OS === "android"
+ ? Math.max(insets.bottom, 16) + 148 - insets.bottom
+ : 16 + insets.bottom,
+ paddingTop: Platform.OS === "android" ? 6 : topListInset,
+ },
+ ]}
+ keyboardDismissMode="on-drag"
+ keyboardShouldPersistTaps="handled"
+ {...scrollGateHandlers}
+ recycleItems
+ scrollEventThrottle={16}
+ showsVerticalScrollIndicator={false}
+ style={styles.threadList}
+ ListEmptyComponent={listEmpty}
+ />
+ </GestureDetector>
+ </SwipeableScrollGateProvider>
+ )}
</View>
- <View
- className="absolute inset-x-0 top-0 z-[4] bg-drawer"
- collapsable={false}
- onLayout={handleStickyHeaderLayout}
- pointerEvents="auto"
- style={{ paddingTop: insets.top }}
- >
- <View className="h-[50px] flex-row items-end gap-0.5 pr-2 pl-5">
- {/* Title slot doubles as the connection status surface: while an
+ {Platform.OS === "android" ? (
+ <MaterialThreadListToolbar
+ sidebar
+ onLayout={handleStickyHeaderLayout}
+ searchQuery={props.searchQuery}
+ onSearchQueryChange={props.onSearchQueryChange}
+ filterActions={listMenuActions}
+ filterCustomized={filterCustomized}
+ onFilterAction={handleListMenuAction}
+ onOpenSettings={props.onOpenSettings}
+ onOpenEnvironments={props.onOpenEnvironmentSettings}
+ onRequestVisibility={props.onRequestVisibility}
+ />
+ ) : (
+ <View
+ className="absolute inset-x-0 top-0 z-[4] bg-drawer"
+ collapsable={false}
+ onLayout={handleStickyHeaderLayout}
+ pointerEvents="auto"
+ style={{ paddingTop: insets.top }}
+ >
+ <View className="h-[50px] flex-row items-end gap-0.5 pr-2 pl-5">
+ {/* Title slot doubles as the connection status surface: while an
environment reconnects, the brand fades to a status label in
place (no layout shift in the list below). */}
- <WorkspaceConnectionTitle
- grow
- onPress={props.onOpenEnvironmentSettings}
- size="pageTitle"
- brand={
- <View className="h-11 flex-1 justify-center">
- <CompactBrandTitle allowFontScaling={false} />
- </View>
- }
- />
- <View className="flex-row items-center gap-2.5">
- <ControlPillMenu actions={listMenuActions} onPressAction={handleListMenuAction}>
- <SidebarFilterButton accessibilityLabel="Filter and sort threads" icon={filterIcon} />
- </ControlPillMenu>
- <SidebarHeaderActions onOpenSettings={props.onOpenSettings} />
+ <WorkspaceConnectionTitle
+ grow
+ onPress={props.onOpenEnvironmentSettings}
+ size="pageTitle"
+ brand={
+ <View className="h-11 flex-1 justify-center">
+ <CompactBrandTitle allowFontScaling={false} />
+ </View>
+ }
+ />
+ <View className="flex-row items-center gap-2.5">
+ <ControlPillMenu actions={listMenuActions} onPressAction={handleListMenuAction}>
+ <SidebarFilterButton
+ accessibilityLabel="Filter and sort threads"
+ icon={filterIcon}
+ />
+ </ControlPillMenu>
+ <SidebarHeaderActions onOpenSettings={props.onOpenSettings} />
+ </View>
</View>
- </View>
- <View
- className={
- materialYouStyleLayoutActive
- ? "mx-4 mt-[9px] min-h-12 flex-row items-center gap-2.5 rounded-full border border-input-border bg-input px-3.5"
- : "mx-4 mt-[9px] h-[38px] flex-row items-center gap-1.5 rounded-xl bg-sidebar-search pr-2.5 pl-[11px]"
- }
- >
- <SymbolView
- name="magnifyingglass"
- size={15}
- tintColorClassName={"accent-foreground-muted"}
- type="monochrome"
- />
- <TextInput
- ref={searchInputRef}
- accessibilityLabel="Search threads"
- autoCapitalize="none"
- autoCorrect={false}
- clearButtonMode={materialYouStyleLayoutActive ? "never" : "while-editing"}
- onChangeText={props.onSearchQueryChange}
- placeholder="Search"
- placeholderTextColorClassName={"accent-placeholder"}
- returnKeyType="search"
- className={
- materialYouStyleLayoutActive
- ? "flex-1 px-0 py-2.5 font-sans text-base text-foreground"
- : "h-[34px] flex-1 px-0 py-0 font-sans text-base text-foreground"
- }
- value={props.searchQuery}
- />
- {materialYouStyleLayoutActive && props.searchQuery.length > 0 ? (
- <Pressable
- accessibilityLabel="Clear search"
- hitSlop={10}
- onPress={() => props.onSearchQueryChange("")}
- >
- <SymbolView
- name="xmark.circle.fill"
- size={17}
- tintColor={mutedColor}
- type="monochrome"
- />
- </Pressable>
- ) : null}
+ <View className="mx-4 mt-[9px] h-[38px] flex-row items-center gap-1.5 rounded-xl bg-sidebar-search pr-2.5 pl-[11px]">
+ <SymbolView
+ name="magnifyingglass"
+ size={15}
+ tintColorClassName="accent-foreground-muted"
+ type="monochrome"
+ />
+ <TextInput
+ ref={searchInputRef}
+ accessibilityLabel="Search threads"
+ autoCapitalize="none"
+ autoCorrect={false}
+ clearButtonMode="while-editing"
+ onChangeText={props.onSearchQueryChange}
+ placeholder="Search"
+ placeholderTextColorClassName="accent-placeholder"
+ selectionColorClassName={undefined}
+ cursorColorClassName={undefined}
+ selectionHandleColorClassName={undefined}
+ returnKeyType="search"
+ className="h-[34px] flex-1 px-0 py-0 font-sans text-base text-foreground"
+ value={props.searchQuery}
+ />
+ </View>
</View>
- </View>
+ )}
</View>
);
}
diff --git a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx
index f78553dbb7e..aee64d006f2 100644
--- a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx
+++ b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx
@@ -32,17 +32,17 @@ import { recoverFailedThreadDraft } from "../../state/recover-failed-thread-draf
import { useEnvironmentQuery } from "../../state/query";
import { dismissGitActionResult, useGitActionProgress } from "../../state/use-vcs-action-state";
import { vcsEnvironment } from "../../state/vcs";
-
import { EmptyState } from "../../components/EmptyState";
import {
+ AndroidHeaderIconButton,
AndroidScreenHeader,
type AndroidHeaderAction,
} from "../../components/AndroidScreenHeader";
+import { AndroidWorkspaceSidebarButton } from "../layout/workspace-sidebar-toolbar";
import { LoadingScreen } from "../../components/LoadingScreen";
import { scopedThreadKey } from "../../lib/scopedEntities";
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
import { connectionTone } from "../connection/connectionTone";
-
import {
useRemoteConnections,
useRemoteConnectionStatus,
@@ -225,7 +225,7 @@ function ThreadRouteContent(
readonly selectedThreadDetailState: ReturnType<typeof useSelectedThreadDetailState>;
},
) {
- const { materialYouStyleLayoutActive, themeVariables } = useAppearancePreferences();
+ const { themeVariables } = useAppearancePreferences();
const headerColor = themeVariables["--color-header"];
const {
fileInspector,
@@ -746,10 +746,12 @@ function ThreadRouteContent(
});
}
if (selectedThreadCwd !== null) {
+ const filesVisible = inspectorMode === "files" && panes.auxiliaryPaneVisible;
actions.push({
- accessibilityLabel: "Open files",
+ accessibilityLabel: filesVisible ? "Close files" : "Open files",
+ selected: filesVisible,
icon: "folder",
- onPress: handleOpenFilesInspector,
+ onPress: filesVisible ? toggleAuxiliaryPane : handleOpenFilesInspector,
});
}
if (selectedThreadProject?.workspaceRoot) {
@@ -764,20 +766,14 @@ function ThreadRouteContent(
icon: "point.topleft.down.curvedto.point.bottomright.up",
onPress: handleOpenGitInspector,
});
- if (fileInspector.supported && selectedThreadCwd !== null) {
- actions.push({
- accessibilityLabel: "Toggle inspector",
- icon: "sidebar.right",
- onPress: handleToggleInspector,
- });
- }
return actions;
}, [
- fileInspector.supported,
+ inspectorMode,
+ panes.auxiliaryPaneVisible,
handleOpenFilesInspector,
handleOpenTerminal,
handleOpenGitInspector,
- handleToggleInspector,
+ toggleAuxiliaryPane,
props.onReturnToThread,
selectedThreadCwd,
selectedThreadProject?.workspaceRoot,
@@ -891,13 +887,12 @@ function ThreadRouteContent(
<GitActionProgressOverlay progress={gitActionProgress} onDismiss={dismissGitActionResult} />
<View
- className={materialYouStyleLayoutActive ? "flex-1 bg-thread-canvas" : "flex-1 bg-screen"}
+ className={Platform.OS === "android" ? "flex-1 bg-thread-canvas" : "flex-1 bg-screen"}
style={
- materialYouStyleLayoutActive
+ Platform.OS === "android"
? {
borderTopLeftRadius: 28,
borderTopRightRadius: 28,
- marginRight: layout.usesSplitView ? 8 : 0,
overflow: "hidden",
}
: undefined
@@ -996,9 +991,7 @@ function ThreadRouteContent(
: undefined,
unstable_headerSubtitle: usesNativeHeaderGlass ? headerSubtitle : undefined,
contentStyle:
- Platform.OS === "android" && materialYouStyleLayoutActive
- ? { backgroundColor: headerColor }
- : undefined,
+ Platform.OS === "android" && true ? { backgroundColor: headerColor } : undefined,
}}
/>
@@ -1006,6 +999,21 @@ function ThreadRouteContent(
<AndroidScreenHeader
title={selectedThread.title}
subtitle={headerSubtitle}
+ leading={<AndroidWorkspaceSidebarButton />}
+ trailing={
+ fileInspector.supported && selectedThreadCwd !== null ? (
+ <AndroidHeaderIconButton
+ accessibilityLabel={
+ inspectorMode !== null && panes.auxiliaryPaneVisible
+ ? "Hide inspector"
+ : "Show inspector"
+ }
+ icon="sidebar.right"
+ selected={inspectorMode !== null && panes.auxiliaryPaneVisible}
+ onPress={handleToggleInspector}
+ />
+ ) : null
+ }
onBack={
layout.usesSplitView
? undefined
@@ -1017,7 +1025,7 @@ function ThreadRouteContent(
}
}
actions={androidHeaderActions}
- hideBottomBorder={materialYouStyleLayoutActive}
+ hideBottomBorder
/>
) : null}
diff --git a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
index 2d4276606ec..f0f29529f4a 100644
--- a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
+++ b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
@@ -36,6 +36,9 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
import { SymbolView } from "../../components/AppSymbol";
import { AppText as Text } from "../../components/AppText";
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
+import { MaterialButton } from "../../components/MaterialButton";
+import { MaterialIconButton } from "../../components/MaterialIconButton";
+import { MaterialRadioIndicator } from "../../components/MaterialRadioIndicator";
import { ProviderIcon } from "../../components/ProviderIcon";
import { ThemedSwitch } from "../../components/ThemedSwitch";
import { cn } from "../../lib/cn";
@@ -52,7 +55,7 @@ import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
import { serverEnvironment } from "../../state/server";
import { useAtomCommand } from "../../state/use-atom-command";
import { useNewTaskFlow } from "./new-task-flow-provider";
-import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
+import { MaterialScreenContent } from "../../components/MaterialScreenContent";
import {
createProviderCatalogRefreshRunner,
providerCatalogRefreshError,
@@ -105,8 +108,7 @@ function ModelRow(props: {
readonly isFirst: boolean;
readonly isLast: boolean;
}) {
- const { materialYouStyleLayoutActive } = useAppearancePreferences();
- const selectedMaterialRow = materialYouStyleLayoutActive && props.selected;
+ const selectedMaterialRow = Platform.OS === "android" && props.selected;
return (
<Pressable
accessibilityLabel={[props.option.label, props.option.subtitle].filter(Boolean).join(", ")}
@@ -117,6 +119,7 @@ function ModelRow(props: {
}}
disabled={props.option.isUnavailable}
onPress={props.onPress}
+ style={Platform.OS === "android" ? { minHeight: 56, paddingVertical: 12 } : undefined}
className={cn(
"mx-4 min-h-11 flex-row items-center gap-2 bg-card px-4 py-2 active:bg-subtle",
selectedMaterialRow && "bg-thread-selected",
@@ -124,11 +127,12 @@ function ModelRow(props: {
props.isLast ? "rounded-b-2xl" : "border-b border-border-subtle",
)}
>
+ {Platform.OS === "android" ? <MaterialRadioIndicator selected={props.selected} /> : null}
<View className="min-w-0 flex-1">
<View className="flex-row items-center gap-2">
<Text
className="min-w-0 shrink text-base font-t3-medium text-foreground"
- numberOfLines={1}
+ numberOfLines={Platform.OS === "android" ? 2 : 1}
>
{props.option.label}
</Text>
@@ -147,16 +151,19 @@ function ModelRow(props: {
) : null}
</View>
{props.option.subtitle ? (
- <Text className="text-xs text-foreground-muted" numberOfLines={1}>
+ <Text
+ className="text-xs text-foreground-muted"
+ numberOfLines={Platform.OS === "android" ? 2 : 1}
+ >
{props.option.subtitle}
</Text>
) : null}
</View>
- {props.selected ? (
+ {props.selected && Platform.OS !== "android" ? (
<SymbolView
name="checkmark"
size={16}
- tintColorClassName={"accent-icon"}
+ tintColorClassName="accent-icon"
type="monochrome"
weight="semibold"
/>
@@ -189,7 +196,7 @@ function ProviderHeader(props: {
<SymbolView
name={props.collapsed ? "chevron.down" : "chevron.up"}
size={12}
- tintColorClassName={"accent-icon-subtle"}
+ tintColorClassName="accent-icon-subtle"
type="monochrome"
/>
</>
@@ -205,6 +212,7 @@ function ProviderHeader(props: {
accessibilityState={{ expanded: !props.collapsed }}
className="mx-4 mt-1 min-h-11 flex-row items-center gap-2 rounded-xl px-1 pt-2 active:opacity-60"
onPress={props.onToggle}
+ style={Platform.OS === "android" ? { minHeight: 48 } : undefined}
>
{content}
</Pressable>
@@ -229,6 +237,7 @@ function DisclosureRow(props: {
<Pressable
accessibilityRole="button"
onPress={props.onPress}
+ style={Platform.OS === "android" ? { minHeight: 56 } : undefined}
className={cn(
"min-h-11 flex-row items-center gap-2 bg-card px-4 py-2 active:bg-subtle",
!props.isLast && "border-b border-border-subtle",
@@ -244,7 +253,7 @@ function DisclosureRow(props: {
<SymbolView
name="chevron.right"
size={12}
- tintColorClassName={"accent-icon-subtle"}
+ tintColorClassName="accent-icon-subtle"
type="monochrome"
/>
</Pressable>
@@ -265,22 +274,24 @@ function ChoiceRow(props: {
accessibilityRole="radio"
accessibilityState={{ checked: props.selected }}
onPress={props.onPress}
+ style={Platform.OS === "android" ? { minHeight: 56 } : undefined}
className={cn(
"min-h-14 flex-row items-center gap-3 bg-card px-4 py-3 active:bg-subtle",
!props.isLast && "border-b border-border-subtle",
)}
>
+ {Platform.OS === "android" ? <MaterialRadioIndicator selected={props.selected} /> : null}
<View className="min-w-0 flex-1 gap-0.5">
<Text className="text-base font-t3-medium text-foreground">{props.label}</Text>
{props.description ? (
<Text className="text-sm leading-5 text-foreground-muted">{props.description}</Text>
) : null}
</View>
- {props.selected ? (
+ {props.selected && Platform.OS !== "android" ? (
<SymbolView
name="checkmark"
size={16}
- tintColorClassName={"accent-icon"}
+ tintColorClassName="accent-icon"
type="monochrome"
weight="semibold"
/>
@@ -853,10 +864,15 @@ function ThreadSettingsMainContent(props: {
<AnimatedLegendList
automaticallyAdjustsScrollIndicatorInsets
className="flex-1 bg-sheet"
+ style={
+ Platform.OS === "android"
+ ? { width: "100%", maxWidth: 720, alignSelf: "center" }
+ : undefined
+ }
contentContainerStyle={{ paddingTop: 4 }}
contentInsetAdjustmentBehavior={usesTransparentNativeHeader ? "never" : "automatic"}
data={listItems}
- estimatedItemSize={48}
+ estimatedItemSize={Platform.OS === "android" ? 56 : 48}
extraData={animationsReady}
getItemType={(item) => item.kind}
itemLayoutAnimation={THREAD_SETTINGS_CATALOG_LAYOUT_TRANSITION}
@@ -869,16 +885,39 @@ function ThreadSettingsMainContent(props: {
{usesTransparentNativeHeader ? <View style={{ height: nativeHeaderHeight }} /> : null}
{Platform.OS === "android" ? (
<View className="px-4 pb-2 pt-3">
- <TextInput
- accessibilityLabel="Find a model"
- autoCapitalize="none"
- autoCorrect={false}
- className="h-11 rounded-xl bg-card px-4 text-base text-foreground"
- onChangeText={session.setSearchQuery}
- placeholder="Find a model"
- placeholderTextColorClassName="accent-placeholder"
- value={session.searchQuery}
- />
+ <View
+ className="flex-row items-center rounded-full bg-input px-2"
+ style={{ minHeight: 56 }}
+ >
+ <View pointerEvents="none" className="px-2">
+ <SymbolView
+ name="magnifyingglass"
+ size={24}
+ tintColorClassName="accent-icon-subtle"
+ />
+ </View>
+ <TextInput
+ accessibilityLabel="Find a model"
+ autoCapitalize="none"
+ autoCorrect={false}
+ className="min-w-0 flex-1 px-2 py-0 text-base text-foreground"
+ style={{ minHeight: 56, includeFontPadding: false, textAlignVertical: "center" }}
+ onChangeText={session.setSearchQuery}
+ placeholder="Find a model"
+ placeholderTextColorClassName="accent-placeholder"
+ selectionColorClassName="accent-primary/32"
+ cursorColorClassName="accent-primary"
+ selectionHandleColorClassName="accent-primary"
+ value={session.searchQuery}
+ />
+ {session.searchQuery.length > 0 ? (
+ <MaterialIconButton
+ accessibilityLabel="Clear model search"
+ icon="xmark"
+ onPress={() => session.setSearchQuery("")}
+ />
+ ) : null}
+ </View>
</View>
) : null}
</>
@@ -945,6 +984,11 @@ function ThreadSettingsChoiceContent(props: {
return (
<ScrollView
className="flex-1 bg-sheet"
+ style={
+ Platform.OS === "android"
+ ? { width: "100%", maxWidth: 720, alignSelf: "center" }
+ : undefined
+ }
contentContainerStyle={{
paddingBottom: insets.bottom + 12,
paddingHorizontal: 16,
@@ -1068,14 +1112,15 @@ function ThreadSettingsModelsScreen() {
icon: "arrow.clockwise",
onPress: refreshProviders,
},
- {
- accessibilityLabel: session.pendingModel ? "Save thread settings" : "Done",
- icon: "checkmark",
- onPress: commitAndClose,
- },
]}
+ trailing={
+ session.pendingModel ? (
+ <MaterialButton label="Save" tone="text" onPress={commitAndClose} />
+ ) : undefined
+ }
onBack={presentation.onClose}
title="Thread settings"
+ hideBottomBorder
/>
) : null}
<NativeStackScreenOptions
@@ -1114,17 +1159,19 @@ function ThreadSettingsModelsScreen() {
: undefined,
}}
/>
- <ThreadSettingsMainContent
- onOpenSubmenu={(submenu) => {
- const title =
- submenu.kind === "runtime"
- ? "Runtime"
- : (session.displayedDescriptors.find(
- (descriptor) => descriptor.type === "select" && descriptor.id === submenu.id,
- )?.label ?? "Option");
- navigation.navigate("ThreadSettingsChoice", { ...submenu, title });
- }}
- />
+ <MaterialScreenContent>
+ <ThreadSettingsMainContent
+ onOpenSubmenu={(submenu) => {
+ const title =
+ submenu.kind === "runtime"
+ ? "Runtime"
+ : (session.displayedDescriptors.find(
+ (descriptor) => descriptor.type === "select" && descriptor.id === submenu.id,
+ )?.label ?? "Option");
+ navigation.navigate("ThreadSettingsChoice", { ...submenu, title });
+ }}
+ />
+ </MaterialScreenContent>
<NativeHeaderToolbar placement="left">
<NativeHeaderToolbar.Button
accessibilityLabel="Cancel thread settings"
@@ -1199,9 +1246,18 @@ function ThreadSettingsChoiceScreen() {
<>
<NativeStackScreenOptions options={{ headerShown: Platform.OS !== "android" }} />
{Platform.OS === "android" ? (
- <AndroidScreenHeader title={route.params.title} onBack={() => navigation.goBack()} />
+ <AndroidScreenHeader
+ title={route.params.title}
+ onBack={() => navigation.goBack()}
+ hideBottomBorder
+ />
) : null}
- <ThreadSettingsChoiceContent submenu={route.params} onSelected={() => navigation.goBack()} />
+ <MaterialScreenContent>
+ <ThreadSettingsChoiceContent
+ submenu={route.params}
+ onSelected={() => navigation.goBack()}
+ />
+ </MaterialScreenContent>
</>
);
}
@@ -1222,11 +1278,12 @@ function ThreadSettingsPickerNavigator(props: ThreadSettingsPickerPresentation)
<ThreadSettingsPickerStack.Navigator
initialRouteName="ThreadSettingsModels"
screenOptions={{
- animation: "slide_from_right",
+ animation: Platform.OS === "android" ? "default" : "slide_from_right",
contentStyle: { backgroundColor: solidSheetBackground },
gestureEnabled: true,
headerBackButtonDisplayMode: "minimal",
headerBackTitle: "",
+ headerShown: Platform.OS !== "android",
headerShadowVisible: false,
headerStyle: {
backgroundColor: NATIVE_LIQUID_GLASS_SUPPORTED ? "transparent" : solidSheetBackground,
diff --git a/apps/mobile/src/features/threads/customSnoozeDate.test.ts b/apps/mobile/src/features/threads/customSnoozeDate.test.ts
new file mode 100644
index 00000000000..4486d2b7c7b
--- /dev/null
+++ b/apps/mobile/src/features/threads/customSnoozeDate.test.ts
@@ -0,0 +1,36 @@
+import { describe, expect, it } from "vite-plus/test";
+
+import {
+ applySnoozePickerDate,
+ applySnoozePickerTime,
+ snoozeDateToPickerDate,
+} from "./customSnoozeDate";
+
+describe("custom snooze calendar conversion", () => {
+ it("passes the local calendar day to Compose without shifting it across time zones", () => {
+ const date = new Date(2026, 8, 17, 0, 30);
+ expect(snoozeDateToPickerDate(date)).toBe("2026-09-17T00:00:00.000Z");
+ });
+
+ it("applies Compose's UTC calendar day while retaining the local time", () => {
+ const date = new Date(2026, 8, 16, 23, 45);
+ const next = applySnoozePickerDate(date, new Date("2026-09-20T00:00:00Z"));
+ expect([
+ next.getFullYear(),
+ next.getMonth(),
+ next.getDate(),
+ next.getHours(),
+ next.getMinutes(),
+ ]).toEqual([2026, 8, 20, 23, 45]);
+ expect(date.getDate()).toBe(16);
+ });
+
+ it("applies a picked local time without changing the chosen calendar day", () => {
+ const date = new Date(2026, 8, 20, 23, 45);
+ const next = applySnoozePickerTime(date, new Date(2026, 8, 16, 8, 15, 30));
+ expect([next.getDate(), next.getHours(), next.getMinutes(), next.getSeconds()]).toEqual([
+ 20, 8, 15, 0,
+ ]);
+ expect(date.getHours()).toBe(23);
+ });
+});
diff --git a/apps/mobile/src/features/threads/customSnoozeDate.ts b/apps/mobile/src/features/threads/customSnoozeDate.ts
new file mode 100644
index 00000000000..7e193401af9
--- /dev/null
+++ b/apps/mobile/src/features/threads/customSnoozeDate.ts
@@ -0,0 +1,16 @@
+/** Compose calendars exchange calendar days at UTC midnight, not local instants. */
+export function snoozeDateToPickerDate(date: Date): string {
+ return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())).toISOString();
+}
+
+export function applySnoozePickerDate(date: Date, selected: Date): Date {
+ const next = new Date(date);
+ next.setFullYear(selected.getUTCFullYear(), selected.getUTCMonth(), selected.getUTCDate());
+ return next;
+}
+
+export function applySnoozePickerTime(date: Date, selected: Date): Date {
+ const next = new Date(date);
+ next.setHours(selected.getHours(), selected.getMinutes(), 0, 0);
+ return next;
+}
diff --git a/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx b/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx
index c66fc788762..7ca5085965f 100644
--- a/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx
+++ b/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx
@@ -1,10 +1,12 @@
import { sanitizeFeatureBranchName } from "@t3tools/shared/git";
import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
import { useState } from "react";
-import { Platform, Pressable, ScrollView, View } from "react-native";
+import { Platform, Pressable, ScrollView, useWindowDimensions, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { AndroidSheetHeader } from "../../../components/AndroidScreenHeader";
+import { MaterialScreenContent } from "../../../components/MaterialScreenContent";
+import { NativeStackScreenOptions } from "../../../native/StackHeader";
import { AppText as Text, AppTextInput as TextInput } from "../../../components/AppText";
import { cn } from "../../../lib/cn";
import { useEnvironmentQuery } from "../../../state/query";
@@ -23,6 +25,7 @@ type GitBranchesSheetProps = StaticScreenProps<{
export function GitBranchesSheet(_props: GitBranchesSheetProps) {
const navigation = useNavigation();
const insets = useSafeAreaInsets();
+ const { height: windowHeight } = useWindowDimensions();
const { selectedThread } = useThreadSelection();
const { selectedThreadCwd, selectedThreadWorktreePath } = useSelectedThreadWorktree();
const gitState = useSelectedThreadGitState();
@@ -58,125 +61,219 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {
const disabledExistingBranches = new Set(disabledExistingBranchNames);
return (
- <View collapsable={false} className="flex-1 bg-sheet">
+ <View
+ collapsable={false}
+ className={Platform.OS === "android" ? "bg-sheet" : "flex-1 bg-sheet"}
+ style={Platform.OS === "android" ? { maxHeight: windowHeight * 0.92 } : undefined}
+ >
{Platform.OS === "android" ? (
- <AndroidSheetHeader title="Branches & worktrees" onBack={() => navigation.goBack()} />
+ <NativeStackScreenOptions
+ options={{
+ sheetCornerRadius: 28,
+ sheetAllowedDetents: "fitToContents",
+ }}
+ />
) : null}
- <ScrollView
- className="flex-1"
- showsVerticalScrollIndicator={false}
- contentInset={{ bottom: Math.max(insets.bottom, 18) + 18 }}
- contentContainerClassName="gap-4 px-5 pt-2"
- >
- <View className="gap-2 rounded-[18px] border border-border bg-card px-4 py-4">
- <Text className="text-foreground-secondary text-2xs font-t3-bold tracking-[1px] uppercase">
- New branch
- </Text>
- <TextInput
- value={newBranchName}
- onChangeText={setNewBranchName}
- placeholder="feature/mobile-polish"
- className="rounded-[18px]"
- />
- <SheetActionButton
- icon="plus"
- label="Create & checkout"
- tone="primary"
- disabled={busy || newBranchName.trim().length === 0}
- onPress={() => {
- const branch = sanitizeFeatureBranchName(newBranchName.trim());
- if (branch.length === 0) return;
- void gitActions.onCreateSelectedThreadBranch(branch).then(() => {
- setNewBranchName("");
- navigation.goBack();
- });
- }}
- />
- </View>
-
- <View className="gap-2 rounded-[18px] border border-border bg-card px-4 py-4">
- <Text className="text-foreground-secondary text-2xs font-t3-bold tracking-[1px] uppercase">
- New worktree
- </Text>
- <TextInput
- value={worktreeBaseBranch}
- onChangeText={setWorktreeBaseBranch}
- placeholder="main"
- className="rounded-[18px]"
- />
- <TextInput
- value={worktreeBranchName}
- onChangeText={setWorktreeBranchName}
- placeholder="feature/mobile-thread"
- className="rounded-[18px]"
- />
- <SheetActionButton
- icon="square.split.2x1"
- label="Create worktree"
- tone="primary"
- disabled={
- busy ||
- worktreeBaseBranch.trim().length === 0 ||
- worktreeBranchName.trim().length === 0
+ {Platform.OS === "android" ? (
+ <AndroidSheetHeader
+ title="Branches & worktrees"
+ onBack={() => navigation.goBack()}
+ hideBottomBorder
+ />
+ ) : null}
+ <MaterialScreenContent fitToContents>
+ <ScrollView
+ className={Platform.OS === "android" ? "shrink grow-0" : "flex-1"}
+ keyboardShouldPersistTaps="handled"
+ showsVerticalScrollIndicator={false}
+ contentInset={{ bottom: Math.max(insets.bottom, 18) + 18 }}
+ contentContainerClassName={Platform.OS === "android" ? "gap-2 p-2" : "gap-4 px-5 pt-2"}
+ contentContainerStyle={
+ Platform.OS === "android"
+ ? { paddingBottom: Math.max(insets.bottom, 18) + 18 }
+ : undefined
+ }
+ >
+ <View
+ className={
+ Platform.OS === "android"
+ ? "gap-3 rounded-[20px] bg-card p-4"
+ : "gap-2 rounded-[18px] border border-border bg-card px-4 py-4"
}
- onPress={() => {
- const baseBranch = worktreeBaseBranch.trim();
- const newBranch = worktreeBranchName.trim();
- if (baseBranch.length === 0 || newBranch.length === 0) return;
- void gitActions.onCreateSelectedThreadWorktree({ baseBranch, newBranch }).then(() => {
- setWorktreeBranchName("");
- navigation.goBack();
- });
- }}
- />
- </View>
-
- <View className="gap-2">
- <Text className="text-foreground-secondary text-2xs font-t3-bold tracking-[1px] uppercase">
- Existing branches
- </Text>
- {branchesLoading ? (
- <Text className="text-foreground-secondary text-sm font-medium">
- Loading branches...
+ >
+ <Text
+ className={
+ Platform.OS === "android"
+ ? "text-foreground text-base font-t3-medium"
+ : "text-foreground-secondary text-2xs font-t3-bold tracking-[1px] uppercase"
+ }
+ >
+ New branch
</Text>
- ) : null}
- {!branchesLoading && availableBranches.length === 0 ? (
- <Text className="text-foreground-secondary text-sm font-medium">
- No local branches found.
+ <TextInput
+ value={newBranchName}
+ onChangeText={setNewBranchName}
+ placeholder="feature/mobile-polish"
+ accessibilityLabel="New branch name"
+ className={Platform.OS === "android" ? "rounded-xl bg-sheet-solid" : "rounded-[18px]"}
+ />
+ <SheetActionButton
+ icon="plus"
+ label="Create & checkout"
+ tone="primary"
+ disabled={busy || newBranchName.trim().length === 0}
+ onPress={() => {
+ const branch = sanitizeFeatureBranchName(newBranchName.trim());
+ if (branch.length === 0) return;
+ void gitActions.onCreateSelectedThreadBranch(branch).then(() => {
+ setNewBranchName("");
+ navigation.goBack();
+ });
+ }}
+ />
+ </View>
+
+ <View
+ className={
+ Platform.OS === "android"
+ ? "gap-3 rounded-[20px] bg-card p-4"
+ : "gap-2 rounded-[18px] border border-border bg-card px-4 py-4"
+ }
+ >
+ <Text
+ className={
+ Platform.OS === "android"
+ ? "text-foreground text-base font-t3-medium"
+ : "text-foreground-secondary text-2xs font-t3-bold tracking-[1px] uppercase"
+ }
+ >
+ New worktree
</Text>
- ) : null}
- {availableBranches.map((branch) => {
- const disabled = disabledExistingBranches.has(branch.name);
- const subtitle = branch.worktreePath
- ? branch.worktreePath === currentWorktreePath
- ? "Checked out in this thread"
- : "Checked out in another worktree"
- : branch.isDefault
- ? "Default branch"
- : "Local branch";
+ {Platform.OS === "android" ? (
+ <Text className="text-foreground-secondary text-sm">Base branch</Text>
+ ) : null}
+ <TextInput
+ value={worktreeBaseBranch}
+ onChangeText={setWorktreeBaseBranch}
+ placeholder="main"
+ accessibilityLabel="Worktree base branch"
+ className={Platform.OS === "android" ? "rounded-xl bg-sheet-solid" : "rounded-[18px]"}
+ />
+ {Platform.OS === "android" ? (
+ <Text className="text-foreground-secondary text-sm">New branch</Text>
+ ) : null}
+ <TextInput
+ value={worktreeBranchName}
+ onChangeText={setWorktreeBranchName}
+ placeholder="feature/mobile-thread"
+ accessibilityLabel="Worktree branch name"
+ className={Platform.OS === "android" ? "rounded-xl bg-sheet-solid" : "rounded-[18px]"}
+ />
+ <SheetActionButton
+ icon="square.split.2x1"
+ label="Create worktree"
+ tone="primary"
+ disabled={
+ busy ||
+ worktreeBaseBranch.trim().length === 0 ||
+ worktreeBranchName.trim().length === 0
+ }
+ onPress={() => {
+ const baseBranch = worktreeBaseBranch.trim();
+ const newBranch = worktreeBranchName.trim();
+ if (baseBranch.length === 0 || newBranch.length === 0) return;
+ void gitActions
+ .onCreateSelectedThreadWorktree({ baseBranch, newBranch })
+ .then(() => {
+ setWorktreeBranchName("");
+ navigation.goBack();
+ });
+ }}
+ />
+ </View>
- return (
- <Pressable
- key={branch.name}
+ <View className="gap-2">
+ <Text
+ className={
+ Platform.OS === "android"
+ ? "px-4 pb-1 pt-3 text-foreground-secondary text-sm font-t3-medium"
+ : "text-foreground-secondary text-2xs font-t3-bold tracking-[1px] uppercase"
+ }
+ >
+ Existing branches
+ </Text>
+ {branchesLoading ? (
+ <Text
className={cn(
- "gap-1 rounded-[18px] border px-4 py-3 disabled:opacity-[0.45]",
- branch.current ? "border-subtle-strong" : "border-border",
+ "text-foreground-secondary text-sm font-medium",
+ Platform.OS === "android" && "px-4",
)}
- disabled={busy || disabled}
- onPress={() => {
- void gitActions.onCheckoutSelectedThreadBranch(branch.name).then(() => {
- navigation.goBack();
- });
- }}
>
- <View className="absolute inset-0 rounded-[18px] bg-card" />
- <Text className="text-foreground text-base font-t3-bold">{branch.name}</Text>
- <Text className="text-foreground-secondary text-xs font-medium">{subtitle}</Text>
- </Pressable>
- );
- })}
- </View>
- </ScrollView>
+ Loading branches...
+ </Text>
+ ) : null}
+ {!branchesLoading && availableBranches.length === 0 ? (
+ <Text
+ className={cn(
+ "text-foreground-secondary text-sm font-medium",
+ Platform.OS === "android" && "px-4",
+ )}
+ >
+ No local branches found.
+ </Text>
+ ) : null}
+ {availableBranches.map((branch) => {
+ const disabled = disabledExistingBranches.has(branch.name);
+ const subtitle = branch.worktreePath
+ ? branch.worktreePath === currentWorktreePath
+ ? "Checked out in this thread"
+ : "Checked out in another worktree"
+ : branch.isDefault
+ ? "Default branch"
+ : "Local branch";
+
+ return (
+ <Pressable
+ key={branch.name}
+ className={cn(
+ "gap-1 px-4 py-3 disabled:opacity-[0.45]",
+ Platform.OS === "android"
+ ? cn(
+ "rounded-[20px] active:bg-subtle",
+ branch.current ? "bg-secondary" : "bg-card",
+ )
+ : cn(
+ "rounded-[18px] border",
+ branch.current ? "border-subtle-strong" : "border-border",
+ ),
+ )}
+ accessibilityRole="button"
+ accessibilityState={{ selected: branch.current, disabled: busy || disabled }}
+ disabled={busy || disabled}
+ onPress={() => {
+ void gitActions.onCheckoutSelectedThreadBranch(branch.name).then(() => {
+ navigation.goBack();
+ });
+ }}
+ >
+ {Platform.OS !== "android" ? (
+ <View className="absolute inset-0 rounded-[18px] bg-card" />
+ ) : null}
+ <Text
+ className={cn(
+ "text-foreground text-base",
+ Platform.OS === "android" ? "font-t3-medium" : "font-t3-bold",
+ )}
+ >
+ {branch.name}
+ </Text>
+ <Text className="text-foreground-secondary text-xs font-medium">{subtitle}</Text>
+ </Pressable>
+ );
+ })}
+ </View>
+ </ScrollView>
+ </MaterialScreenContent>
</View>
);
}
diff --git a/apps/mobile/src/features/threads/git/GitCommitSheet.tsx b/apps/mobile/src/features/threads/git/GitCommitSheet.tsx
index e76672de20f..7a64ac562b6 100644
--- a/apps/mobile/src/features/threads/git/GitCommitSheet.tsx
+++ b/apps/mobile/src/features/threads/git/GitCommitSheet.tsx
@@ -1,9 +1,12 @@
import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
import { useCallback, useState } from "react";
-import { Platform, Pressable, ScrollView, View } from "react-native";
+import { Platform, Pressable, ScrollView, useWindowDimensions, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { AndroidSheetHeader } from "../../../components/AndroidScreenHeader";
+import { SymbolView } from "../../../components/AppSymbol";
+import { MaterialScreenContent } from "../../../components/MaterialScreenContent";
+import { NativeStackScreenOptions } from "../../../native/StackHeader";
import { AppText as Text, AppTextInput as TextInput } from "../../../components/AppText";
import { cn } from "../../../lib/cn";
import { useEnvironmentQuery } from "../../../state/query";
@@ -22,6 +25,7 @@ type GitCommitSheetProps = StaticScreenProps<{
export function GitCommitSheet(_props: GitCommitSheetProps) {
const navigation = useNavigation();
const insets = useSafeAreaInsets();
+ const { height: windowHeight } = useWindowDimensions();
const { selectedThread } = useThreadSelection();
const { selectedThreadCwd } = useSelectedThreadWorktree();
const gitState = useSelectedThreadGitState();
@@ -66,168 +70,284 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
);
return (
- <View collapsable={false} className="flex-1 bg-sheet">
+ <View
+ collapsable={false}
+ className={Platform.OS === "android" ? "bg-sheet" : "flex-1 bg-sheet"}
+ style={Platform.OS === "android" ? { maxHeight: windowHeight * 0.92 } : undefined}
+ >
{Platform.OS === "android" ? (
- <AndroidSheetHeader title="Commit changes" onBack={() => navigation.goBack()} />
+ <NativeStackScreenOptions
+ options={{
+ sheetCornerRadius: 28,
+ sheetAllowedDetents: "fitToContents",
+ }}
+ />
) : null}
- <ScrollView
- className="flex-1"
- keyboardShouldPersistTaps="handled"
- showsVerticalScrollIndicator={false}
- contentInset={{ bottom: Math.max(insets.bottom, 18) + 18 }}
- contentContainerClassName="gap-4 px-5 pt-2"
- >
- <View className="gap-3 rounded-[22px] border border-border bg-card px-4 py-4">
- <View className="flex-row items-center justify-between gap-3">
- <Text className="text-foreground-muted text-sm font-medium">Branch</Text>
- <Text className="text-foreground text-base font-t3-bold">
- {gitStatus.data?.refName ?? "(detached HEAD)"}
- </Text>
- </View>
- {isDefaultRef ? (
- <Text className="text-xs leading-normal text-warning-foreground">
- Warning: this is the default branch.
- </Text>
- ) : null}
- </View>
-
- <View className="gap-3 rounded-[22px] border border-border bg-card px-4 py-4">
- <View className="flex-row items-center justify-between gap-3">
- <View className="gap-1">
- <Text className="text-foreground text-base font-t3-bold">Files</Text>
- <Text className="text-foreground-muted text-xs leading-normal">
- {selectedFiles.length} selected · +{selectedInsertions} / -{selectedDeletions}
- </Text>
- </View>
- <View className="flex-row items-center gap-2">
- {!allSelected && isEditingFiles ? (
- <Pressable
- className="bg-subtle rounded-full px-3 py-2"
- onPress={() => setExcludedFiles(new Set())}
- >
- <Text className="text-foreground text-2xs font-t3-bold uppercase">Reset</Text>
- </Pressable>
- ) : null}
- <Pressable
- className="bg-subtle rounded-full px-3 py-2"
- onPress={() => setIsEditingFiles((current) => !current)}
+ {Platform.OS === "android" ? (
+ <AndroidSheetHeader
+ title="Commit changes"
+ onBack={() => navigation.goBack()}
+ hideBottomBorder
+ />
+ ) : null}
+ <MaterialScreenContent fitToContents>
+ <ScrollView
+ className={Platform.OS === "android" ? "shrink grow-0" : "flex-1"}
+ keyboardShouldPersistTaps="handled"
+ showsVerticalScrollIndicator={false}
+ contentInset={{ bottom: Math.max(insets.bottom, 18) + 18 }}
+ contentContainerClassName={Platform.OS === "android" ? "gap-2 p-2" : "gap-4 px-5 pt-2"}
+ contentContainerStyle={
+ Platform.OS === "android"
+ ? { paddingBottom: Math.max(insets.bottom, 18) + 18 }
+ : undefined
+ }
+ >
+ <View
+ className={cn(
+ "gap-3 bg-card p-4",
+ Platform.OS === "android" ? "rounded-[20px]" : "rounded-[22px] border border-border",
+ )}
+ >
+ <View
+ className={
+ Platform.OS === "android" ? "gap-1" : "flex-row items-center justify-between gap-3"
+ }
+ >
+ <Text className="text-foreground-muted text-sm font-medium">Branch</Text>
+ <Text
+ className={cn(
+ "text-foreground text-base",
+ Platform.OS === "android" ? "font-t3-medium" : "font-t3-bold",
+ )}
>
- <Text className="text-foreground text-2xs font-t3-bold uppercase">
- {isEditingFiles ? "Done" : "Edit"}
- </Text>
- </Pressable>
+ {gitStatus.data?.refName ?? "(detached HEAD)"}
+ </Text>
</View>
+ {isDefaultRef ? (
+ <Text className="text-xs leading-normal text-warning-foreground">
+ Warning: this is the default branch.
+ </Text>
+ ) : null}
</View>
- {allFiles.length === 0 ? (
- <Text className="text-foreground-secondary text-sm leading-normal">
- No changed files are available to commit.
- </Text>
- ) : !isEditingFiles ? (
- <View className="gap-2">
- {selectedFilePreview.map((file) => (
- <View key={file.path} className="flex-row items-center justify-between gap-3">
- <Text className="text-foreground flex-1 text-sm font-medium" numberOfLines={1}>
- {file.path}
- </Text>
- <Text className="text-xs font-t3-bold text-emerald-500">+{file.insertions}</Text>
- <Text className="text-xs font-t3-bold text-rose-500">-{file.deletions}</Text>
- </View>
- ))}
- {selectedFiles.length > selectedFilePreview.length ? (
- <Text className="text-foreground-muted text-xs leading-snug">
- +{selectedFiles.length - selectedFilePreview.length} more files
+ <View
+ className={cn(
+ "gap-3 bg-card p-4",
+ Platform.OS === "android" ? "rounded-[20px]" : "rounded-[22px] border border-border",
+ )}
+ >
+ <View className="flex-row items-center justify-between gap-3">
+ <View className="gap-1">
+ <Text
+ className={cn(
+ "text-foreground text-base",
+ Platform.OS === "android" ? "font-t3-medium" : "font-t3-bold",
+ )}
+ >
+ Files
</Text>
- ) : null}
- </View>
- ) : (
- <View className="gap-2">
- {allFiles.map((file) => {
- const included = !excludedFiles.has(file.path);
- return (
+ <Text className="text-foreground-muted text-xs leading-normal">
+ {selectedFiles.length} selected · +{selectedInsertions} / -{selectedDeletions}
+ </Text>
+ </View>
+ <View className="flex-row items-center gap-2">
+ {!allSelected && isEditingFiles ? (
<Pressable
- key={file.path}
- className={cn(
- "rounded-[18px] border px-4 py-3",
- included ? "border-border" : "border-border-subtle",
- )}
- onPress={() => {
- setExcludedFiles((current) => {
- const next = new Set(current);
- if (next.has(file.path)) {
- next.delete(file.path);
- } else {
- next.add(file.path);
- }
- return next;
- });
- }}
+ className={
+ Platform.OS === "android"
+ ? "min-h-12 justify-center rounded-full px-3 active:bg-subtle"
+ : "bg-subtle rounded-full px-3 py-2"
+ }
+ onPress={() => setExcludedFiles(new Set())}
>
- <View
- className={`absolute inset-0 rounded-[18px] ${included ? "bg-card" : "bg-subtle"}`}
- />
- <View className="flex-row items-start justify-between gap-3">
- <View className="flex-1 gap-1">
- <Text
- selectable
- className={`text-sm font-t3-bold ${included ? "text-foreground" : "text-foreground-muted"}`}
- >
- {file.path}
- </Text>
- {!included ? (
- <Text className="text-foreground-muted text-2xs leading-normal">
- Excluded from this commit
- </Text>
- ) : null}
- </View>
- <View className="items-end gap-1">
- <Text className="text-xs font-t3-bold text-emerald-500">
- +{file.insertions}
- </Text>
- <Text className="text-xs font-t3-bold text-rose-500">
- -{file.deletions}
- </Text>
- </View>
- </View>
+ <Text
+ className={
+ Platform.OS === "android"
+ ? "text-primary text-sm font-t3-medium"
+ : "text-foreground text-2xs font-t3-bold uppercase"
+ }
+ >
+ Reset
+ </Text>
</Pressable>
- );
- })}
+ ) : null}
+ <Pressable
+ className={
+ Platform.OS === "android"
+ ? "min-h-12 justify-center rounded-full px-3 active:bg-subtle"
+ : "bg-subtle rounded-full px-3 py-2"
+ }
+ onPress={() => setIsEditingFiles((current) => !current)}
+ >
+ <Text
+ className={
+ Platform.OS === "android"
+ ? "text-primary text-sm font-t3-medium"
+ : "text-foreground text-2xs font-t3-bold uppercase"
+ }
+ >
+ {isEditingFiles ? "Done" : "Edit"}
+ </Text>
+ </Pressable>
+ </View>
</View>
- )}
- </View>
- <View className="gap-2">
- <Text className="text-foreground text-sm font-t3-bold">Commit message</Text>
- <TextInput
- multiline
- value={dialogCommitMessage}
- onChangeText={setDialogCommitMessage}
- placeholder="Leave empty to auto-generate"
- textAlignVertical="top"
- className="min-h-[128px] rounded-[20px] px-4 py-3.5"
- />
- </View>
+ {allFiles.length === 0 ? (
+ <Text className="text-foreground-secondary text-sm leading-normal">
+ No changed files are available to commit.
+ </Text>
+ ) : !isEditingFiles ? (
+ <View className="gap-2">
+ {selectedFilePreview.map((file) => (
+ <View key={file.path} className="flex-row items-center justify-between gap-3">
+ <Text className="text-foreground flex-1 text-sm font-medium" numberOfLines={1}>
+ {file.path}
+ </Text>
+ <Text className="text-xs font-t3-bold text-emerald-500">
+ +{file.insertions}
+ </Text>
+ <Text className="text-xs font-t3-bold text-rose-500">-{file.deletions}</Text>
+ </View>
+ ))}
+ {selectedFiles.length > selectedFilePreview.length ? (
+ <Text className="text-foreground-muted text-xs leading-snug">
+ +{selectedFiles.length - selectedFilePreview.length} more files
+ </Text>
+ ) : null}
+ </View>
+ ) : (
+ <View className="gap-2">
+ {allFiles.map((file) => {
+ const included = !excludedFiles.has(file.path);
+ return (
+ <Pressable
+ key={file.path}
+ className={cn(
+ "px-4 py-3",
+ Platform.OS === "android"
+ ? included
+ ? "rounded-xl bg-subtle"
+ : "rounded-xl"
+ : cn(
+ "rounded-[18px] border",
+ included ? "border-border" : "border-border-subtle",
+ ),
+ )}
+ accessibilityRole="checkbox"
+ accessibilityLabel={file.path}
+ accessibilityState={{ checked: included }}
+ onPress={() => {
+ setExcludedFiles((current) => {
+ const next = new Set(current);
+ if (next.has(file.path)) {
+ next.delete(file.path);
+ } else {
+ next.add(file.path);
+ }
+ return next;
+ });
+ }}
+ >
+ {Platform.OS !== "android" ? (
+ <View
+ className={`absolute inset-0 rounded-[18px] ${included ? "bg-card" : "bg-subtle"}`}
+ />
+ ) : null}
+ <View className="flex-row items-start justify-between gap-3">
+ {Platform.OS === "android" ? (
+ <View
+ className={cn(
+ "mt-0.5 size-5 items-center justify-center rounded-sm",
+ included ? "bg-primary" : "border border-input-border",
+ )}
+ >
+ {included ? (
+ <SymbolView
+ name="checkmark"
+ size={16}
+ tintColorClassName="accent-primary-foreground"
+ type="monochrome"
+ />
+ ) : null}
+ </View>
+ ) : null}
+ <View className="flex-1 gap-1">
+ <Text
+ selectable
+ className={`text-sm font-t3-bold ${included ? "text-foreground" : "text-foreground-muted"}`}
+ >
+ {file.path}
+ </Text>
+ {!included ? (
+ <Text className="text-foreground-muted text-2xs leading-normal">
+ Excluded from this commit
+ </Text>
+ ) : null}
+ </View>
+ <View className="items-end gap-1">
+ <Text className="text-xs font-t3-bold text-emerald-500">
+ +{file.insertions}
+ </Text>
+ <Text className="text-xs font-t3-bold text-rose-500">
+ -{file.deletions}
+ </Text>
+ </View>
+ </View>
+ </Pressable>
+ );
+ })}
+ </View>
+ )}
+ </View>
- <View className="flex-row gap-3">
- <View className="flex-1">
- <SheetActionButton
- icon="arrow.branch"
- label="Commit on new branch"
- disabled={noneSelected || busy}
- onPress={() => void runCommitAction(true)}
+ <View
+ className={Platform.OS === "android" ? "gap-3 rounded-[20px] bg-card p-4" : "gap-2"}
+ >
+ <Text
+ className={
+ Platform.OS === "android"
+ ? "text-foreground text-base font-t3-medium"
+ : "text-foreground text-sm font-t3-bold"
+ }
+ >
+ Commit message
+ </Text>
+ <TextInput
+ multiline
+ accessibilityLabel="Commit message"
+ value={dialogCommitMessage}
+ onChangeText={setDialogCommitMessage}
+ placeholder="Leave empty to auto-generate"
+ textAlignVertical="top"
+ className={cn(
+ "min-h-[128px] px-4 py-3.5",
+ Platform.OS === "android" ? "rounded-xl bg-sheet-solid" : "rounded-[20px]",
+ )}
/>
</View>
- <View className="flex-1">
- <SheetActionButton
- icon="checkmark.circle"
- label="Commit"
- tone="primary"
- disabled={noneSelected || busy}
- onPress={() => void runCommitAction(false)}
- />
+
+ <View className={Platform.OS === "android" ? "gap-2" : "flex-row gap-3"}>
+ <View className={Platform.OS === "android" ? undefined : "flex-1"}>
+ <SheetActionButton
+ icon="arrow.branch"
+ label="Commit on new branch"
+ disabled={noneSelected || busy}
+ onPress={() => void runCommitAction(true)}
+ />
+ </View>
+ <View className={Platform.OS === "android" ? undefined : "flex-1"}>
+ <SheetActionButton
+ icon="checkmark.circle"
+ label="Commit"
+ tone="primary"
+ disabled={noneSelected || busy}
+ onPress={() => void runCommitAction(false)}
+ />
+ </View>
</View>
- </View>
- </ScrollView>
+ </ScrollView>
+ </MaterialScreenContent>
</View>
);
}
diff --git a/apps/mobile/src/features/threads/git/GitConfirmSheet.tsx b/apps/mobile/src/features/threads/git/GitConfirmSheet.tsx
index cddf1c614bd..bc5e88f3fd6 100644
--- a/apps/mobile/src/features/threads/git/GitConfirmSheet.tsx
+++ b/apps/mobile/src/features/threads/git/GitConfirmSheet.tsx
@@ -4,11 +4,13 @@ import * as Arr from "effect/Array";
import * as Result from "effect/Result";
import { StackActions, useNavigation, type StaticScreenProps } from "@react-navigation/native";
import { useCallback, useMemo } from "react";
-import { Platform, View } from "react-native";
+import { Platform, ScrollView, useWindowDimensions, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { AndroidSheetHeader } from "../../../components/AndroidScreenHeader";
+import { MaterialScreenContent } from "../../../components/MaterialScreenContent";
+import { NativeStackScreenOptions } from "../../../native/StackHeader";
import { AppText as Text } from "../../../components/AppText";
import { useSelectedThreadGitActions } from "../../../state/use-selected-thread-git-actions";
import { useSelectedThreadGitState } from "../../../state/use-selected-thread-git-state";
@@ -27,6 +29,7 @@ type GitConfirmSheetProps = StaticScreenProps<{
export function GitConfirmSheet(props: GitConfirmSheetProps) {
const navigation = useNavigation();
const insets = useSafeAreaInsets();
+ const { height: windowHeight } = useWindowDimensions();
const gitState = useSelectedThreadGitState();
const gitActions = useSelectedThreadGitActions();
@@ -102,38 +105,94 @@ export function GitConfirmSheet(props: GitConfirmSheetProps) {
]);
return (
- <View collapsable={false} className="flex-1 bg-sheet">
+ <View
+ collapsable={false}
+ className={Platform.OS === "android" ? "bg-sheet" : "flex-1 bg-sheet"}
+ style={Platform.OS === "android" ? { maxHeight: windowHeight * 0.92 } : undefined}
+ >
{Platform.OS === "android" ? (
- <AndroidSheetHeader title="Confirm action" onBack={() => navigation.goBack()} />
+ <NativeStackScreenOptions
+ options={{
+ sheetCornerRadius: 28,
+ sheetAllowedDetents: "fitToContents",
+ }}
+ />
+ ) : null}
+ {Platform.OS === "android" ? (
+ <AndroidSheetHeader
+ title="Confirm action"
+ onBack={() => navigation.goBack()}
+ hideBottomBorder
+ />
) : (
<View className="min-h-4 pt-2" />
)}
- <View className="items-center gap-1 px-5 pb-3 pt-4">
- <Text className="text-xs font-t3-bold tracking-[1px] uppercase text-foreground-muted">
- Confirm
- </Text>
- <Text className="text-center text-3xl font-t3-bold">
- {copy?.title ?? "Run action on default branch?"}
- </Text>
- <Text className="text-center text-foreground-secondary text-sm font-medium leading-normal">
- {copy?.description ?? "Choose how to continue."}
- </Text>
- </View>
+ <MaterialScreenContent fitToContents>
+ <ScrollView
+ className={Platform.OS === "android" ? "shrink grow-0" : "flex-1"}
+ showsVerticalScrollIndicator={false}
+ contentContainerClassName={Platform.OS === "android" ? "gap-2 p-2" : undefined}
+ contentContainerStyle={
+ Platform.OS === "android"
+ ? { paddingBottom: Math.max(insets.bottom, 18) + 8 }
+ : undefined
+ }
+ >
+ <View
+ className={
+ Platform.OS === "android"
+ ? "gap-2 rounded-[20px] bg-card p-3"
+ : "items-center gap-1 px-5 pb-3 pt-4"
+ }
+ >
+ {Platform.OS !== "android" ? (
+ <Text className="text-xs font-t3-bold tracking-[1px] uppercase text-foreground-muted">
+ Confirm
+ </Text>
+ ) : null}
+ <Text
+ className={
+ Platform.OS === "android"
+ ? "text-xl font-t3-medium"
+ : "text-center text-3xl font-t3-bold"
+ }
+ >
+ {copy?.title ?? "Run action on default branch?"}
+ </Text>
+ <Text
+ className={
+ Platform.OS === "android"
+ ? "text-foreground-secondary text-base leading-normal"
+ : "text-center text-foreground-secondary text-sm font-medium leading-normal"
+ }
+ >
+ {copy?.description ?? "Choose how to continue."}
+ </Text>
+ </View>
- <View className="gap-3 px-5 pt-2" style={{ paddingBottom: Math.max(insets.bottom, 18) + 8 }}>
- <SheetActionButton
- icon="arrow.right.circle"
- label={copy?.continueLabel ?? "Continue"}
- onPress={() => void continuePendingAction()}
- />
- <SheetActionButton
- icon="arrow.branch"
- label="Feature branch & continue"
- tone="primary"
- onPress={() => void movePendingActionToFeatureBranch()}
- />
- </View>
+ <View
+ className={Platform.OS === "android" ? "gap-2" : "gap-3 px-5 pt-2"}
+ style={
+ Platform.OS === "android"
+ ? undefined
+ : { paddingBottom: Math.max(insets.bottom, 18) + 8 }
+ }
+ >
+ <SheetActionButton
+ icon="arrow.right.circle"
+ label={copy?.continueLabel ?? "Continue"}
+ onPress={() => void continuePendingAction()}
+ />
+ <SheetActionButton
+ icon="arrow.branch"
+ label="Feature branch & continue"
+ tone="primary"
+ onPress={() => void movePendingActionToFeatureBranch()}
+ />
+ </View>
+ </ScrollView>
+ </MaterialScreenContent>
</View>
);
}
diff --git a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
index 881f461f29c..ace7a5a5cda 100644
--- a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
+++ b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
@@ -22,10 +22,17 @@ import { Alert, Platform, Pressable, RefreshControl, ScrollView, View } from "re
import { Screen, ScreenStack, ScreenStackHeaderConfig } from "react-native-screens";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { useUniwindTheme } from "../../../lib/useUniwindTheme";
-
-import { AndroidSheetHeader } from "../../../components/AndroidScreenHeader";
+import {
+ AndroidHeaderIconButton,
+ AndroidSheetHeader,
+} from "../../../components/AndroidScreenHeader";
+import { MaterialScreenContent } from "../../../components/MaterialScreenContent";
+import { useAdaptiveWorkspaceLayout } from "../../layout/AdaptiveWorkspaceLayout";
import { AppText as Text } from "../../../components/AppText";
-import { nativeHeaderScrollEdgeEffects } from "../../../native/StackHeader";
+import {
+ NativeStackScreenOptions,
+ nativeHeaderScrollEdgeEffects,
+} from "../../../native/StackHeader";
import { tryOpenExternalUrl } from "../../../lib/openExternalUrl";
import { useEnvironmentQuery } from "../../../state/query";
import { useThreadSelection } from "../../../state/use-thread-selection";
@@ -47,6 +54,7 @@ type GitOverviewSheetProps = StaticScreenProps<{
};
export function GitOverviewSheet(props: GitOverviewSheetProps) {
+ const { layout } = useAdaptiveWorkspaceLayout();
const navigation = useNavigation();
const insets = useSafeAreaInsets();
const presentation = props.presentation ?? "sheet";
@@ -224,14 +232,14 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {
const content = (
<ScrollView
- className="flex-1 bg-screen"
+ className={Platform.OS === "android" ? "flex-1 bg-sheet-solid" : "flex-1 bg-screen"}
contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
showsVerticalScrollIndicator={false}
contentInset={{ bottom: Math.max(insets.bottom, 18) + 18 }}
contentContainerStyle={{
- paddingHorizontal: isInspector ? 12 : 20,
+ paddingHorizontal: Platform.OS === "android" ? 8 : isInspector ? 12 : 20,
paddingTop: 8,
- gap: 14,
+ gap: Platform.OS === "android" ? 8 : 14,
}}
refreshControl={
<RefreshControl refreshing={isPullRefreshing} onRefresh={() => void handlePullRefresh()} />
@@ -239,14 +247,18 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {
>
<View
className={
- isInspector
- ? "overflow-hidden rounded-2xl border border-border bg-card px-3 py-1"
- : "overflow-hidden rounded-[22px] border border-border bg-card px-4 py-1"
+ Platform.OS === "android"
+ ? "overflow-hidden rounded-[20px] bg-card"
+ : isInspector
+ ? "overflow-hidden rounded-2xl border border-border bg-card px-3 py-1"
+ : "overflow-hidden rounded-[22px] border border-border bg-card px-4 py-1"
}
>
{sheetMenuItems.map(({ item, disabledReason }, index) => (
<View key={`${item.id}-${item.label}`}>
- {index > 0 ? <View className="ml-12 h-px bg-border" /> : null}
+ {index > 0 && Platform.OS !== "android" ? (
+ <View className="ml-12 h-px bg-border" />
+ ) : null}
<SheetListRow
icon={menuItemIconName(item.icon)}
title={item.label}
@@ -258,7 +270,7 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {
))}
{behindCount > 0 ? (
<>
- <View className="ml-12 h-px bg-border" />
+ {Platform.OS !== "android" ? <View className="ml-12 h-px bg-border" /> : null}
<SheetListRow
icon="arrow.down.circle"
title="Pull latest"
@@ -268,7 +280,7 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {
/>
</>
) : null}
- <View className="ml-12 h-px bg-border" />
+ {Platform.OS !== "android" ? <View className="ml-12 h-px bg-border" /> : null}
<SheetListRow
icon="text.bubble"
title="Review changes"
@@ -283,7 +295,7 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {
);
}}
/>
- <View className="ml-12 h-px bg-border" />
+ {Platform.OS !== "android" ? <View className="ml-12 h-px bg-border" /> : null}
<SheetListRow
icon="point.topleft.down.curvedto.point.bottomright.up"
title="Branches & worktrees"
@@ -306,7 +318,11 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {
{linkedPrChains.map((chain) => (
<View
key={threadPullRequestKeyOf(chain.layers[0]!)}
- className="overflow-hidden rounded-2xl border border-border bg-card px-3 py-1"
+ className={
+ Platform.OS === "android"
+ ? "overflow-hidden rounded-[20px] bg-card"
+ : "overflow-hidden rounded-2xl border border-border bg-card px-3 py-1"
+ }
>
{chain.layers.length > 1 ? (
<View className="flex-row items-center gap-2 px-1 pt-2 pb-1">
@@ -323,7 +339,9 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {
) : null}
{chain.layers.map((link, index) => (
<View key={threadPullRequestKeyOf(link)}>
- {index > 0 ? <View className="ml-12 h-px bg-border" /> : null}
+ {index > 0 && Platform.OS !== "android" ? (
+ <View className="ml-12 h-px bg-border" />
+ ) : null}
<SheetListRow
icon="arrow.triangle.pull"
title={`#${link.number} ${link.snapshot?.title ?? "Pull request"}`}
@@ -416,8 +434,19 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {
return (
<View
collapsable={false}
- className={isInspector ? "flex-1 border-l border-border bg-sheet" : "flex-1 bg-sheet"}
+ className={
+ Platform.OS === "android"
+ ? "flex-1 bg-header"
+ : isInspector
+ ? "flex-1 border-l border-border bg-sheet"
+ : "flex-1 bg-sheet"
+ }
>
+ {!isInspector ? (
+ <NativeStackScreenOptions
+ options={{ sheetCornerRadius: Platform.OS === "android" ? 28 : undefined }}
+ />
+ ) : null}
{isInspector ? (
<View
style={{
@@ -428,24 +457,41 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {
) : null}
{isInspector ? (
- <View className="gap-1 border-b border-border px-4 pb-4 pt-3">
- <Pressable
- className={
- busy
- ? "absolute right-3 top-4 z-[1] h-9 w-9 items-center justify-center rounded-full bg-subtle opacity-[0.45]"
- : "absolute right-3 top-4 z-[1] h-9 w-9 items-center justify-center rounded-full bg-subtle"
- }
- disabled={busy}
- onPress={() => void gitActions.refreshSelectedThreadGitStatus()}
- >
- <SymbolView
- name="arrow.clockwise"
- size={16}
- tintColorClassName={"accent-icon"}
- type="monochrome"
- weight="medium"
- />
- </Pressable>
+ <View
+ className={
+ Platform.OS === "android"
+ ? "gap-1 bg-header px-4 pb-4 pt-3"
+ : "gap-1 border-b border-border px-4 pb-4 pt-3"
+ }
+ >
+ {Platform.OS === "android" ? (
+ <View className="absolute right-3 top-4 z-[1]">
+ <AndroidHeaderIconButton
+ accessibilityLabel="Refresh repository status"
+ disabled={busy}
+ icon="arrow.clockwise"
+ onPress={() => void gitActions.refreshSelectedThreadGitStatus()}
+ />
+ </View>
+ ) : (
+ <Pressable
+ className={
+ busy
+ ? "absolute right-3 top-4 z-[1] h-9 w-9 items-center justify-center rounded-full bg-subtle opacity-[0.45]"
+ : "absolute right-3 top-4 z-[1] h-9 w-9 items-center justify-center rounded-full bg-subtle"
+ }
+ disabled={busy}
+ onPress={() => void gitActions.refreshSelectedThreadGitStatus()}
+ >
+ <SymbolView
+ name="arrow.clockwise"
+ size={16}
+ tintColorClassName="accent-icon"
+ type="monochrome"
+ weight="medium"
+ />
+ </Pressable>
+ )}
<Text className="text-xs font-t3-bold tracking-[1px] uppercase text-foreground-muted">
Repository
</Text>
@@ -457,6 +503,7 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {
) : (
<AndroidSheetHeader
title={currentBranchLabel}
+ hideBottomBorder={Platform.OS === "android"}
subtitle={currentStatusSummary}
onBack={() => navigation.goBack()}
actions={[
@@ -470,7 +517,9 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {
/>
)}
- {content}
+ <MaterialScreenContent insetHorizontal={layout.usesSplitView}>
+ {content}
+ </MaterialScreenContent>
</View>
);
}
diff --git a/apps/mobile/src/features/threads/git/gitSheetComponents.tsx b/apps/mobile/src/features/threads/git/gitSheetComponents.tsx
index 285c3414a9e..daf494cb79c 100644
--- a/apps/mobile/src/features/threads/git/gitSheetComponents.tsx
+++ b/apps/mobile/src/features/threads/git/gitSheetComponents.tsx
@@ -1,7 +1,8 @@
import { SymbolView } from "../../../components/AppSymbol";
import type { ComponentProps } from "react";
-import { Pressable, View } from "react-native";
+import { Platform, Pressable, View } from "react-native";
import { AppText as Text } from "../../../components/AppText";
+import { MaterialButton } from "../../../components/MaterialButton";
import { cn } from "../../../lib/cn";
/* ─── Shared sheet components ──────────────────────────────────────── */
@@ -13,6 +14,18 @@ export function SheetActionButton(props: {
readonly tone?: "primary" | "secondary" | "danger";
readonly onPress: () => void;
}) {
+ if (Platform.OS === "android")
+ return (
+ <View className="flex-1">
+ <MaterialButton
+ label={props.label}
+ tone={props.tone}
+ disabled={props.disabled}
+ onPress={props.onPress}
+ fullWidth
+ />
+ </View>
+ );
const tone = props.tone ?? "secondary";
const textColorClassName =
tone === "primary"
@@ -24,13 +37,13 @@ export function SheetActionButton(props: {
return (
<Pressable
className={cn(
- "min-h-[48px] flex-1 flex-row items-center justify-center gap-2 rounded-[18px] px-4 py-3 disabled:opacity-[0.45]",
- tone === "primary"
- ? "bg-primary"
- : tone === "danger"
- ? "border border-danger-border bg-danger"
- : "border border-secondary-border bg-secondary",
+ "min-h-[48px] flex-row items-center justify-center gap-2 px-4 py-3 disabled:opacity-[0.45]",
+ "flex-1 rounded-[18px]",
+ tone === "primary" ? "bg-primary" : tone === "danger" ? "bg-danger" : "bg-secondary",
+ tone !== "primary" &&
+ (tone === "danger" ? "border border-danger-border" : "border border-secondary-border"),
)}
+ accessibilityRole="button"
disabled={props.disabled}
onPress={props.onPress}
>
@@ -58,7 +71,13 @@ export function SheetActionButton(props: {
export function MetaCard(props: { readonly label: string; readonly value: string }) {
return (
- <View className="rounded-[18px] border border-border bg-card px-4 py-3">
+ <View
+ className={
+ Platform.OS === "android"
+ ? "rounded-[20px] bg-card px-4 py-3"
+ : "rounded-[18px] border border-border bg-card px-4 py-3"
+ }
+ >
<Text className="text-foreground-muted text-2xs font-t3-bold tracking-[0.9px] uppercase">
{props.label}
</Text>
@@ -78,30 +97,50 @@ export function SheetListRow(props: {
}) {
return (
<Pressable
- className="flex-row items-center gap-3 px-1 py-3 disabled:opacity-[0.45]"
+ className={
+ Platform.OS === "android"
+ ? "min-h-16 flex-row items-center gap-4 px-4 py-3 active:bg-subtle disabled:opacity-[0.45]"
+ : "flex-row items-center gap-3 px-1 py-3 disabled:opacity-[0.45]"
+ }
disabled={props.disabled}
onPress={props.onPress}
>
- <View className="bg-subtle h-9 w-9 items-center justify-center rounded-full">
+ <View
+ className={
+ Platform.OS === "android"
+ ? "size-6 items-center justify-center"
+ : "bg-subtle h-9 w-9 items-center justify-center rounded-full"
+ }
+ >
<SymbolView
name={props.icon}
- size={16}
- tintColorClassName={"accent-icon"}
+ size={Platform.OS === "android" ? 24 : 16}
+ tintColorClassName="accent-icon"
type="monochrome"
/>
</View>
<View className="flex-1 gap-0.5">
- <Text className="text-foreground text-base font-t3-bold">{props.title}</Text>
+ <Text
+ className={
+ Platform.OS === "android"
+ ? "text-foreground text-base font-t3-medium"
+ : "text-foreground text-base font-t3-bold"
+ }
+ >
+ {props.title}
+ </Text>
{props.subtitle ? (
<Text className="text-foreground-muted text-xs leading-snug">{props.subtitle}</Text>
) : null}
</View>
- <SymbolView
- name="chevron.right"
- size={13}
- tintColorClassName={"accent-icon-subtle"}
- type="monochrome"
- />
+ {Platform.OS !== "android" ? (
+ <SymbolView
+ name="chevron.right"
+ size={13}
+ tintColorClassName="accent-icon-subtle"
+ type="monochrome"
+ />
+ ) : null}
</Pressable>
);
}
diff --git a/apps/mobile/src/features/threads/thread-list-items.tsx b/apps/mobile/src/features/threads/thread-list-items.tsx
index af71ab61344..b9d4dd50d29 100644
--- a/apps/mobile/src/features/threads/thread-list-items.tsx
+++ b/apps/mobile/src/features/threads/thread-list-items.tsx
@@ -183,7 +183,7 @@ export const ThreadListGroupHeader = memo(function ThreadListGroupHeader(props:
<SymbolView
name="plus"
size={compact ? 20 : 16}
- tintColorClassName={"accent-icon-muted"}
+ tintColorClassName="accent-icon-muted"
type="monochrome"
weight="medium"
/>
@@ -232,7 +232,7 @@ export const ThreadListShowMoreRow = memo(function ThreadListShowMoreRow(props:
<SymbolView
name={icon}
size={10}
- tintColorClassName={"accent-icon-subtle"}
+ tintColorClassName="accent-icon-subtle"
type="monochrome"
weight="semibold"
/>
@@ -379,7 +379,7 @@ export const PendingTaskListRow = memo(function PendingTaskListRow(props: {
<SymbolView
name="chevron.right"
size={13}
- tintColorClassName={"accent-icon-subtle"}
+ tintColorClassName="accent-icon-subtle"
type="monochrome"
/>
</View>
@@ -469,10 +469,10 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
>["simultaneousWithExternalGesture"];
}) {
const { width: windowWidth } = useWindowDimensions();
- const { themeAppearance: colorScheme, materialYouStyleLayoutActive } = useAppearancePreferences();
+ const { themeAppearance: colorScheme } = useAppearancePreferences();
const compact = props.variant === "compact";
const selected = props.selected === true;
- const visuallySelected = selected && (!compact || materialYouStyleLayoutActive);
+ const visuallySelected = selected && (!compact || Platform.OS === "android");
const theme = useUniwindTheme();
const screenColor = theme["--color-screen"];
const drawerColor = theme["--color-drawer"];
@@ -507,22 +507,22 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
);
const backgroundColor = compact ? screenColor : drawerColor;
- const effectiveSelectedBackground = materialYouStyleLayoutActive
- ? materialSelectedBackgroundColor
- : selectedBackgroundColor;
- const effectiveSelectedForeground = materialYouStyleLayoutActive
- ? materialSelectedForegroundColor
- : selectedForegroundColor;
+ const effectiveSelectedBackground =
+ Platform.OS === "android" ? materialSelectedBackgroundColor : selectedBackgroundColor;
+ const effectiveSelectedForeground =
+ Platform.OS === "android" ? materialSelectedForegroundColor : selectedForegroundColor;
const effectiveStatus =
visuallySelected && status
? {
...status,
- pillClassName: materialYouStyleLayoutActive
- ? "bg-thread-selected-foreground/20"
- : "bg-user-bubble-foreground/20",
- textClassName: materialYouStyleLayoutActive
- ? "text-thread-selected-foreground"
- : "text-user-bubble-foreground",
+ pillClassName:
+ Platform.OS === "android"
+ ? "bg-thread-selected-foreground/20"
+ : "bg-user-bubble-foreground/20",
+ textClassName:
+ Platform.OS === "android"
+ ? "text-thread-selected-foreground"
+ : "text-user-bubble-foreground",
}
: status;
@@ -596,7 +596,7 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
compact
? "accent-icon-subtle"
: selected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "accent-thread-selected-foreground-muted"
: "accent-user-bubble-foreground-muted"
: "accent-foreground-muted"
@@ -608,7 +608,7 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
"shrink",
compact ? "text-sm" : "text-xs",
visuallySelected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-foreground-muted",
@@ -647,7 +647,7 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
<Text
className={`${compact ? "text-sm" : "text-xs"} font-t3-medium ${
visuallySelected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: pr.textClassName
@@ -666,7 +666,7 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
key={`${thread.environmentId}:${thread.id}`}
interactionClassName={
visuallySelected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "bg-thread-selected-foreground"
: "bg-user-bubble-foreground"
: "bg-primary"
@@ -676,10 +676,10 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
accessibilityRole="button"
className="bg-screen"
style={
- materialYouStyleLayoutActive
+ Platform.OS === "android"
? {
backgroundColor: visuallySelected ? effectiveSelectedBackground : backgroundColor,
- borderRadius: SIDEBAR_ROW_RADIUS,
+ borderRadius: 20,
}
: undefined
}
@@ -689,13 +689,18 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
}}
>
<View className="pr-[18px] pt-[10px]" style={{ paddingLeft: THREAD_LIST_COMPACT_INSET }}>
- <View className={cn("gap-[3px] pb-[10px]", !props.isLast && "border-b border-separator")}>
+ <View
+ className={cn(
+ "gap-[3px] pb-[10px]",
+ Platform.OS !== "android" && !props.isLast && "border-b border-separator",
+ )}
+ >
<View className="flex-row items-center justify-between gap-2">
<Text
className={cn(
"flex-1 text-lg font-t3-bold",
visuallySelected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: "text-foreground",
@@ -706,14 +711,14 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
</Text>
<View className="flex-row items-center gap-2">
{props.hasQueuedMessages ? (
- <QueuedMessageIcon selected={visuallySelected && !materialYouStyleLayoutActive} />
+ <QueuedMessageIcon selected={visuallySelected && Platform.OS !== "android"} />
) : null}
{statusPill}
<Text
className={cn(
"text-base tabular-nums",
visuallySelected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-foreground-tertiary",
@@ -724,7 +729,7 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
<SymbolView
name="chevron.right"
size={13}
- tintColorClassName={"accent-icon-subtle"}
+ tintColorClassName="accent-icon-subtle"
type="monochrome"
/>
</View>
@@ -746,7 +751,7 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
key={`${thread.environmentId}:${thread.id}`}
interactionClassName={
visuallySelected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "bg-thread-selected-foreground"
: "bg-user-bubble-foreground"
: "bg-primary"
@@ -761,7 +766,7 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
}}
style={{
backgroundColor: visuallySelected ? effectiveSelectedBackground : backgroundColor,
- borderRadius: SIDEBAR_ROW_RADIUS,
+ borderRadius: Platform.OS === "android" ? 20 : SIDEBAR_ROW_RADIUS,
minHeight: 64,
justifyContent: "center",
paddingHorizontal: 12,
@@ -774,7 +779,7 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
className={cn(
"flex-1 text-base font-t3-medium",
visuallySelected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: "text-foreground",
@@ -785,14 +790,14 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
</Text>
<View className="flex-row items-center gap-2">
{props.hasQueuedMessages ? (
- <QueuedMessageIcon selected={visuallySelected && !materialYouStyleLayoutActive} />
+ <QueuedMessageIcon selected={visuallySelected && Platform.OS !== "android"} />
) : null}
{statusPill}
<Text
className={cn(
"text-xs tabular-nums",
visuallySelected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-foreground-muted",
@@ -820,9 +825,11 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
threadKey={`${thread.environmentId}:${thread.id}`}
backgroundColor={backgroundColor}
containerStyle={
- compact && !materialYouStyleLayoutActive
- ? undefined
- : { borderRadius: SIDEBAR_ROW_RADIUS, overflow: "hidden" }
+ Platform.OS === "android"
+ ? { borderRadius: 20, overflow: "hidden", marginHorizontal: 8, marginVertical: 2 }
+ : compact
+ ? undefined
+ : { borderRadius: SIDEBAR_ROW_RADIUS, overflow: "hidden" }
}
enableTrackpadSwipe
fullSwipeWidth={props.fullSwipeWidth ?? windowWidth - 32}
diff --git a/apps/mobile/src/features/threads/thread-list-v2-items.tsx b/apps/mobile/src/features/threads/thread-list-v2-items.tsx
index 02870c3ff22..64c865cae80 100644
--- a/apps/mobile/src/features/threads/thread-list-v2-items.tsx
+++ b/apps/mobile/src/features/threads/thread-list-v2-items.tsx
@@ -1,6 +1,5 @@
import { RowPressable } from "../../components/RowPressable";
import { CustomSnoozeSheet } from "./CustomSnoozeSheet";
-import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import { appAtomRegistry } from "../../state/atom-registry";
import { threadArrangementOpenAtom } from "../../state/thread-order";
import type { ThreadMoveDestination } from "./threadOrder";
@@ -182,7 +181,7 @@ export const ThreadListV2SettledShelfHeader = memo(function ThreadListV2SettledS
<SymbolView
name="chevron.down"
size={10}
- tintColorClassName={"accent-foreground-muted"}
+ tintColorClassName="accent-foreground-muted"
type="monochrome"
style={{ transform: [{ rotate: props.expanded ? "180deg" : "0deg" }] }}
/>
@@ -441,12 +440,11 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
const pr = useThreadPr(thread);
- const { materialYouStyleLayoutActive } = useAppearancePreferences();
const theme = useUniwindTheme();
const screenColor = theme["--color-screen"];
const drawerColor = theme["--color-drawer"];
const selectedBackgroundColor =
- theme[materialYouStyleLayoutActive ? "--color-thread-selected" : "--color-user-bubble"];
+ theme[Platform.OS === "android" ? "--color-thread-selected" : "--color-user-bubble"];
const sidebarPane = props.pane === "sidebar";
const selected = props.selected === true;
// The provider badge's border blends into the row's own surface, which
@@ -456,7 +454,9 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
const providerIconSurfaceColor = sidebarPane
? selected
? selectedBackgroundColor
- : drawerColor
+ : Platform.OS === "android"
+ ? screenColor
+ : drawerColor
: screenColor;
const status = resolveThreadListV2Status(thread);
@@ -750,7 +750,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
className={cn(
"flex-1 text-sm font-t3-medium",
selected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-foreground-muted",
@@ -764,7 +764,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
<SymbolView
name="pin"
size={11}
- tintColorClassName={"accent-foreground-muted"}
+ tintColorClassName="accent-foreground-muted"
type="monochrome"
/>
) : null}
@@ -772,7 +772,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
className={cn(
"text-xs tabular-nums",
selected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: (statusLabel?.className ?? "text-foreground-tertiary"),
@@ -785,7 +785,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
className={cn(
"mt-1 text-base font-t3-medium",
selected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: "text-foreground",
@@ -809,7 +809,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
className={cn(
"flex-1 text-xs",
selected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-danger-foreground",
@@ -830,7 +830,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
className={cn(
"shrink text-xs",
selected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-foreground-muted",
@@ -842,7 +842,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
className={cn(
"text-xs",
selected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-foreground-muted",
@@ -858,7 +858,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
className={cn(
"text-xs",
selected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-foreground-tertiary",
@@ -874,7 +874,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
size={11}
tintColorClassName={
selected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "accent-thread-selected-foreground-muted"
: "accent-user-bubble-foreground-muted"
: "accent-foreground-tertiary"
@@ -893,7 +893,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
size={12}
tintColorClassName={
selected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "accent-thread-selected-foreground"
: "accent-user-bubble-foreground"
: pr.state === null || pr.isDraft
@@ -911,7 +911,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
className={cn(
"text-xs",
selected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: pr.textClassName,
@@ -941,13 +941,13 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
<RowPressable
key={`${thread.environmentId}:${thread.id}`}
interactionClassName={
- selected && (sidebarPane || materialYouStyleLayoutActive)
- ? materialYouStyleLayoutActive
+ selected && (sidebarPane || Platform.OS === "android")
+ ? Platform.OS === "android"
? "bg-thread-selected-foreground"
: "bg-user-bubble-foreground"
: "bg-primary"
}
- className={sidebarPane || materialYouStyleLayoutActive ? undefined : "bg-screen"}
+ className={sidebarPane || Platform.OS === "android" ? undefined : "bg-screen"}
accessibilityHint={swipeAccessibilityHint}
accessibilityLabel={
props.hasQueuedMessages ? `${thread.title}, messages queued to send` : thread.title
@@ -959,14 +959,14 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
onSelectThread(thread);
}}
style={
- sidebarPane || materialYouStyleLayoutActive
+ sidebarPane || Platform.OS === "android"
? {
backgroundColor: selected
? selectedBackgroundColor
- : sidebarPane
+ : sidebarPane && Platform.OS !== "android"
? drawerColor
: screenColor,
- borderRadius: SIDEBAR_V2_ROW_RADIUS,
+ borderRadius: Platform.OS === "android" ? 20 : SIDEBAR_V2_ROW_RADIUS,
...(sidebarPane ? { paddingHorizontal: 12, paddingVertical: 10 } : null),
}
: undefined
@@ -980,8 +980,10 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
separates rows. The opaque screen background stays so swipe
actions reveal behind the row. */
<View>
- <View className="px-5 py-2.5">{cardContent}</View>
- {props.showTrailingDivider !== false ? (
+ <View className={Platform.OS === "android" ? "px-3 py-2.5" : "px-5 py-2.5"}>
+ {cardContent}
+ </View>
+ {Platform.OS !== "android" && props.showTrailingDivider !== false ? (
<View className="ml-5 h-px bg-border-subtle" />
) : null}
</View>
@@ -991,8 +993,8 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
<RowPressable
key={`${thread.environmentId}:${thread.id}`}
interactionClassName={
- selected && (sidebarPane || materialYouStyleLayoutActive)
- ? materialYouStyleLayoutActive
+ selected && (sidebarPane || Platform.OS === "android")
+ ? Platform.OS === "android"
? "bg-thread-selected-foreground"
: "bg-user-bubble-foreground"
: "bg-primary"
@@ -1003,20 +1005,20 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
}
accessibilityRole="button"
accessibilityState={{ selected }}
- className={sidebarPane || materialYouStyleLayoutActive ? undefined : "bg-screen"}
+ className={sidebarPane || Platform.OS === "android" ? undefined : "bg-screen"}
onPress={() => {
close();
onSelectThread(thread);
}}
style={
- sidebarPane || materialYouStyleLayoutActive
+ sidebarPane || Platform.OS === "android"
? {
backgroundColor: selected
? selectedBackgroundColor
- : sidebarPane
+ : sidebarPane && Platform.OS !== "android"
? drawerColor
: screenColor,
- borderRadius: SIDEBAR_V2_ROW_RADIUS,
+ borderRadius: Platform.OS === "android" ? 20 : SIDEBAR_V2_ROW_RADIUS,
}
: undefined
}
@@ -1044,7 +1046,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
className={cn(
"text-base",
selected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: "text-foreground-muted",
@@ -1066,7 +1068,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
className={cn(
"text-sm tabular-nums",
selected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: snoozedRow
@@ -1084,16 +1086,20 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
);
return (
- <>
+ <View collapsable={false}>
{customSnoozeOpen && (
<CustomSnoozeSheet onClose={() => setCustomSnoozeOpen(false)} onSnooze={handleSnooze} />
)}
<ThreadSwipeable
threadKey={`${thread.environmentId}:${thread.id}`}
- backgroundColor={sidebarPane ? drawerColor : screenColor}
+ backgroundColor={sidebarPane && Platform.OS !== "android" ? drawerColor : screenColor}
compactActions={variant === "slim"}
containerStyle={
- sidebarPane ? { borderRadius: SIDEBAR_V2_ROW_RADIUS, overflow: "hidden" } : undefined
+ Platform.OS === "android"
+ ? { borderRadius: 20, overflow: "hidden", marginHorizontal: 8, marginVertical: 2 }
+ : sidebarPane
+ ? { borderRadius: SIDEBAR_V2_ROW_RADIUS, overflow: "hidden" }
+ : undefined
}
enableTrackpadSwipe
// Full swipe commits the advertised lifecycle action (Settle /
@@ -1141,6 +1147,6 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
</ControlPillMenu>
)}
</ThreadSwipeable>
- </>
+ </View>
);
});
diff --git a/apps/mobile/src/features/threads/thread-search-match.tsx b/apps/mobile/src/features/threads/thread-search-match.tsx
index bc10bd9fe92..618cf15ee14 100644
--- a/apps/mobile/src/features/threads/thread-search-match.tsx
+++ b/apps/mobile/src/features/threads/thread-search-match.tsx
@@ -1,8 +1,8 @@
+import { Platform } from "react-native";
import type { EnvironmentThreadSearchMatch } from "@t3tools/client-runtime/state/thread-search";
import { AppText as Text } from "../../components/AppText";
import { cn } from "../../lib/cn";
-import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
function foldAsciiCase(value: string): string {
return value.replace(/[A-Z]/g, (character) => character.toLowerCase());
@@ -51,14 +51,13 @@ export function ThreadSearchMatchExcerpt(props: {
readonly compact?: boolean;
}) {
const isUser = props.match.source === "user";
- const { materialYouStyleLayoutActive } = useAppearancePreferences();
const parts = splitHighlightParts(props.match.snippet, props.query);
return (
<Text
className={cn(
props.compact ? "text-sm" : "text-xs",
props.selected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground-muted"
: "text-user-bubble-foreground-muted"
: "text-foreground-muted",
@@ -69,7 +68,7 @@ export function ThreadSearchMatchExcerpt(props: {
className={cn(
props.compact ? "text-sm font-t3-medium" : "text-xs font-t3-medium",
props.selected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: isUser
@@ -85,7 +84,7 @@ export function ThreadSearchMatchExcerpt(props: {
props.compact ? "text-sm" : "text-xs",
part.highlighted && "font-t3-bold",
props.selected
- ? materialYouStyleLayoutActive
+ ? Platform.OS === "android"
? "text-thread-selected-foreground"
: "text-user-bubble-foreground"
: part.highlighted
diff --git a/apps/mobile/src/features/usage/UsageLimitsPooled.tsx b/apps/mobile/src/features/usage/UsageLimitsPooled.tsx
index 23d9ac3b9a0..4e3e7339765 100644
--- a/apps/mobile/src/features/usage/UsageLimitsPooled.tsx
+++ b/apps/mobile/src/features/usage/UsageLimitsPooled.tsx
@@ -12,15 +12,14 @@ import {
type LimitPoolWindow,
} from "@t3tools/shared/usageLimits";
import { useId, useState } from "react";
-import { Platform, Pressable, ScrollView, View } from "react-native";
+import { Pressable, ScrollView, View } from "react-native";
import { Defs, Path, Pattern, Rect, Svg } from "react-native-svg";
import { useSafeAreaInsets } from "react-native-safe-area-context";
-import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
import { SymbolView } from "../../components/AppSymbol";
import { AppText as Text } from "../../components/AppText";
import { ProviderIcon } from "../../components/ProviderIcon";
-import { NativeStackScreenOptions } from "../../native/StackHeader";
+import { SettingsScreen } from "../settings/components/SettingsScreen";
import { environmentPresentations } from "../../state/presentation";
import { ResetCredits } from "./UsageLimitsSection";
import { useProviderColors } from "./usageProviders";
@@ -278,7 +277,6 @@ type AccountScreenProps = StaticScreenProps<{
/** Resolve the account again so live quota and credit updates reach the open detail screen. */
export function UsageLimitAccountScreen({ route }: AccountScreenProps) {
- const navigation = useNavigation();
const insets = useSafeAreaInsets();
const presentations = useAtomValue(environmentPresentations.presentationsAtom);
const { accountKey, windowId, windowKind, environmentIds, now } = route.params;
@@ -297,13 +295,7 @@ export function UsageLimitAccountScreen({ route }: AccountScreenProps) {
const reset = pool?.resets.find((candidate) => candidate.member.account.key === accountKey);
const [revealed, setRevealed] = useState(false);
return (
- <View collapsable={false} className="flex-1 bg-sheet">
- {Platform.OS === "android" ? (
- <>
- <NativeStackScreenOptions options={{ headerShown: false }} />
- <AndroidScreenHeader title="Account" onBack={() => navigation.goBack()} />
- </>
- ) : null}
+ <SettingsScreen title="Account">
<ScrollView
contentInsetAdjustmentBehavior="automatic"
contentContainerClassName="gap-5 p-5"
@@ -389,6 +381,6 @@ export function UsageLimitAccountScreen({ route }: AccountScreenProps) {
</>
)}
</ScrollView>
- </View>
+ </SettingsScreen>
);
}
diff --git a/apps/mobile/src/features/usage/UsageRouteScreen.tsx b/apps/mobile/src/features/usage/UsageRouteScreen.tsx
index 6f00300f1ac..af45e9eefb2 100644
--- a/apps/mobile/src/features/usage/UsageRouteScreen.tsx
+++ b/apps/mobile/src/features/usage/UsageRouteScreen.tsx
@@ -1,3 +1,4 @@
+import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
import { EnvironmentId, USAGE_CONTRACT_VERSION } from "@t3tools/contracts";
import { type RouteProp, useIsFocused, useNavigation, useRoute } from "@react-navigation/native";
import {
@@ -18,15 +19,14 @@ import {
makeWindow,
} from "@t3tools/shared/usageFormat";
import { useCallback, useLayoutEffect, useMemo, useRef, useState } from "react";
-import { Platform, Pressable, RefreshControl, ScrollView, View } from "react-native";
+import { Platform, Pressable, RefreshControl, View } from "react-native";
import Animated, { FadeIn, ReduceMotion } from "react-native-reanimated";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { SegmentedControl } from "../../components/SegmentedControl";
-import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
import { AppText as Text } from "../../components/AppText";
import { cn } from "../../lib/cn";
-import { NativeStackScreenOptions } from "../../native/StackHeader";
+import { SettingsScreen } from "../settings/components/SettingsScreen";
import { useUsage, type EnvironmentUsageStatus } from "../../state/usage";
import { SettingsSection } from "../settings/components/SettingsSection";
import { UsageDailyChart } from "./UsageDailyChart";
@@ -236,17 +236,7 @@ export function UsageRouteScreen() {
}, [navigation, environmentFilter]);
return (
- <View collapsable={false} className="flex-1 bg-sheet">
- {Platform.OS === "android" ? (
- <>
- <NativeStackScreenOptions options={{ headerShown: false }} />
- <AndroidScreenHeader
- title="Usage"
- onBack={() => navigation.goBack()}
- trailing={environmentFilter}
- />
- </>
- ) : null}
+ <SettingsScreen title="Usage" trailing={environmentFilter}>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
showsVerticalScrollIndicator={false}
@@ -277,20 +267,20 @@ export function UsageRouteScreen() {
<>
{/* Period and metric together: neither applies to Limits, and
both change every number below, so they share one bar. */}
- <View className="flex-row items-center gap-3">
+ <View className={cn("gap-3", Platform.OS !== "android" && "flex-row items-center")}>
<SegmentedControl
options={WINDOW_OPTIONS}
selected={windowDays}
onSelect={selectWindow}
size="compact"
- className="flex-1"
+ className={Platform.OS === "android" ? "w-full" : "flex-1"}
/>
<SegmentedControl
options={METRIC_OPTIONS}
selected={metric}
onSelect={setMetric}
size="compact"
- className="w-36"
+ className={Platform.OS === "android" ? "w-full" : "w-36"}
/>
</View>
{merged.duplicateSources.length > 0 ? (
@@ -330,7 +320,7 @@ export function UsageRouteScreen() {
)}
</Animated.View>
</ScrollView>
- </View>
+ </SettingsScreen>
);
}
diff --git a/apps/mobile/src/lib/appBlurTarget.ts b/apps/mobile/src/lib/appBlurTarget.ts
deleted file mode 100644
index 5c892adc686..00000000000
--- a/apps/mobile/src/lib/appBlurTarget.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { createRef } from "react";
-import type { View } from "react-native";
-
-// Android BlurViews can't sample their real backdrop like iOS does — they
-// need an explicit BlurTargetView to snapshot. App.tsx wraps the app content
-// in one and binds this ref so overlays hosted in separate windows (the
-// anchored dropdown's Modal) can still blur what's on screen behind them.
-export const appBlurTargetRef = createRef<View>();
diff --git a/apps/mobile/src/lib/glassBlurTarget.ts b/apps/mobile/src/lib/glassBlurTarget.ts
deleted file mode 100644
index 4e6f7d3e3e8..00000000000
--- a/apps/mobile/src/lib/glassBlurTarget.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { createContext, type RefObject } from "react";
-import type { View } from "react-native";
-
-// Android cannot sample a target that contains the BlurView itself. Keep the
-// feed in a separate target, shared by the composer and its popovers.
-export const GlassBlurTargetContext = createContext<RefObject<View | null> | undefined>(undefined);
diff --git a/apps/mobile/src/lib/materialYouTheme.test.ts b/apps/mobile/src/lib/materialYouTheme.test.ts
index af52c2635e3..16618ea55d4 100644
--- a/apps/mobile/src/lib/materialYouTheme.test.ts
+++ b/apps/mobile/src/lib/materialYouTheme.test.ts
@@ -31,8 +31,20 @@ const palette: MaterialYouPalette = {
};
describe("Material You system colors", () => {
+ it.each(["light", "dark"] as const)(
+ "uses the system surface for the Android frame in %s",
+ (appearance) => {
+ const variables = materialYouPaletteToMobileThemeVariables(
+ palette,
+ appearance,
+ getMobileThemeRuntimeVariables("material-you", appearance, "android"),
+ );
+ expect(variables["--color-header"]).toBe(palette.surfaceContainerHigh);
+ },
+ );
+
it("overrides the selected theme without mutating its base variables", () => {
- const base = getMobileThemeRuntimeVariables("t3-code", "dark");
+ const base = getMobileThemeRuntimeVariables("t3-code", "dark", "android");
const snapshot = { ...base };
const variables = materialYouPaletteToMobileThemeVariables(palette, "dark", base);
@@ -47,7 +59,7 @@ describe("Material You system colors", () => {
});
it("uses the Messages-style RCS tones for sent messages", () => {
- const base = getMobileThemeRuntimeVariables("t3-code", "dark");
+ const base = getMobileThemeRuntimeVariables("t3-code", "dark", "android");
const dark = materialYouPaletteToMobileThemeVariables(
{ ...palette, inversePrimary: "#A31D8DFF" },
"dark",
@@ -56,7 +68,7 @@ describe("Material You system colors", () => {
const light = materialYouPaletteToMobileThemeVariables(
{ ...palette, inversePrimary: "#A31D8DFF" },
"light",
- getMobileThemeRuntimeVariables("t3-code", "light"),
+ getMobileThemeRuntimeVariables("t3-code", "light", "android"),
);
expect(dark["--color-user-bubble"]).toBe("#850073FF");
diff --git a/apps/mobile/src/lib/mobileThemeVariables.test.ts b/apps/mobile/src/lib/mobileThemeVariables.test.ts
index 78c002b2d5a..6cd457d899d 100644
--- a/apps/mobile/src/lib/mobileThemeVariables.test.ts
+++ b/apps/mobile/src/lib/mobileThemeVariables.test.ts
@@ -1,25 +1,58 @@
import { describe, expect, it } from "vite-plus/test";
import { readDefaultMobileThemeVariables } from "./mobileTheme.test-support";
-import { getMobileThemeVariables } from "./mobileTheme";
+import { getMobileThemeVariables, MOBILE_THEME_IDS, themeColorWithAlpha } from "./mobileTheme";
import { getMobileThemeRuntimeVariables } from "./mobileThemeVariables";
describe("mobile theme runtime variables", () => {
it("derives the standard runtime palette from global.css", () => {
- expect(getMobileThemeRuntimeVariables("t3-code", "light")).toEqual(
+ expect(getMobileThemeRuntimeVariables("t3-code", "light", "ios")).toEqual(
readDefaultMobileThemeVariables("light"),
);
- expect(getMobileThemeRuntimeVariables("t3-code", "dark")).toEqual(
+ expect(getMobileThemeRuntimeVariables("t3-code", "dark", "ios")).toEqual(
readDefaultMobileThemeVariables("dark"),
);
});
it("uses the same shared palette source as generated custom themes", () => {
- expect(getMobileThemeRuntimeVariables("ocean", "light")).toEqual(
+ expect(getMobileThemeRuntimeVariables("ocean", "light", "ios")).toEqual(
getMobileThemeVariables("ocean", "light"),
);
- expect(getMobileThemeRuntimeVariables("iris", "dark")).toEqual(
+ expect(getMobileThemeRuntimeVariables("iris", "dark", "ios")).toEqual(
getMobileThemeVariables("iris", "dark"),
);
});
+
+ it.each(MOBILE_THEME_IDS)(
+ "keeps %s colors on Android with an opaque Material frame",
+ (themeId) => {
+ for (const appearance of ["light", "dark"] as const) {
+ const ios = getMobileThemeRuntimeVariables(themeId, appearance, "ios");
+ const android = getMobileThemeRuntimeVariables(themeId, appearance, "android");
+ expect(android).toEqual({
+ ...ios,
+ "--color-header": themeColorWithAlpha(
+ ios[
+ themeId === "t3-code" || themeId === "material-you"
+ ? "--color-card"
+ : "--color-drawer"
+ ],
+ 1,
+ ),
+ });
+ expect(android["--color-header"]).toMatch(/^rgba\(\d+, \d+, \d+, 1\)$/);
+ }
+ },
+ );
+
+ it.each(["t3-code", "material-you"] as const)(
+ "keeps the %s default dark frame distinct from the rounded settings body",
+ (themeId) => {
+ const variables = getMobileThemeRuntimeVariables(themeId, "dark", "android");
+ expect(variables["--color-header"]).toBe("rgba(23, 23, 23, 1)");
+ expect(variables["--color-header"]).not.toBe(
+ themeColorWithAlpha(variables["--color-sheet-solid"], 1),
+ );
+ },
+ );
});
diff --git a/apps/mobile/src/lib/mobileThemeVariables.ts b/apps/mobile/src/lib/mobileThemeVariables.ts
index 30c38e6bf42..a623c1df379 100644
--- a/apps/mobile/src/lib/mobileThemeVariables.ts
+++ b/apps/mobile/src/lib/mobileThemeVariables.ts
@@ -1,8 +1,8 @@
import defaultThemeVariables from "../../generated-uniwind-default-theme-variables.json";
-
import {
DEFAULT_MOBILE_THEME_ID,
getMobileThemeVariables,
+ themeColorWithAlpha,
type MobileThemeAppearance,
type MobileThemeId,
type MobileThemeVariables,
@@ -20,8 +20,22 @@ const defaults = defaultThemeVariables as Readonly<
export function getMobileThemeRuntimeVariables(
themeId: MobileThemeId,
appearance: MobileThemeAppearance,
+ platform: string,
): MobileThemeVariables {
- return themeId === DEFAULT_MOBILE_THEME_ID || themeId === "material-you"
+ const usesDefaultPalette = themeId === DEFAULT_MOBILE_THEME_ID || themeId === "material-you";
+ const variables = usesDefaultPalette
? defaults[appearance]
: getMobileThemeVariables(themeId, appearance);
+ if (platform !== "android") return variables;
+
+ // Rounded panes share one opaque frame. The default dark drawer matches the
+ // settings body, so use its card tone to keep the rounded edge visible.
+ // System colors replace this with their own surfaceContainerHigh afterwards.
+ return {
+ ...variables,
+ "--color-header": themeColorWithAlpha(
+ variables[usesDefaultPalette ? "--color-card" : "--color-drawer"],
+ 1,
+ ),
+ };
}
diff --git a/apps/mobile/src/lib/storage.test.ts b/apps/mobile/src/lib/storage.test.ts
index 856e253923f..78a165c5ff1 100644
--- a/apps/mobile/src/lib/storage.test.ts
+++ b/apps/mobile/src/lib/storage.test.ts
@@ -204,21 +204,15 @@ describe("mobile connection storage", () => {
await expect(loadPreferences()).resolves.toEqual({ ...themes, lightThemeId: "t3-chat" });
});
- it("persists the Material You layout independently of the selected theme", async () => {
- await savePreferencesPatch({
- lightThemeId: "material-you",
- materialYouStyleLayoutEnabled: true,
- });
- await savePreferencesPatch({ lightThemeId: "t3-chat" });
- await expect(loadPreferences()).resolves.toEqual({
- lightThemeId: "t3-chat",
- materialYouStyleLayoutEnabled: true,
- });
- await savePreferencesPatch({ materialYouStyleLayoutEnabled: false });
- await expect(loadPreferences()).resolves.toEqual({
- lightThemeId: "t3-chat",
- materialYouStyleLayoutEnabled: false,
- });
+ it.each([true, false])("drops the removed Android layout preference (%s)", async (enabled) => {
+ mocks.setPreferencesJson(
+ JSON.stringify({
+ materialYouStyleLayoutEnabled: enabled,
+ lightThemeId: "t3-chat",
+ }),
+ 10,
+ );
+ await expect(loadPreferences()).resolves.toEqual({ lightThemeId: "t3-chat" });
});
it("drops the removed theme transition preference", async () => {
diff --git a/apps/mobile/src/native/SelectableMarkdownText.android.tsx b/apps/mobile/src/native/SelectableMarkdownText.android.tsx
index a59a039cbc9..35586489623 100644
--- a/apps/mobile/src/native/SelectableMarkdownText.android.tsx
+++ b/apps/mobile/src/native/SelectableMarkdownText.android.tsx
@@ -2,8 +2,11 @@ import {
SelectableMarkdownText as T3SelectableMarkdownText,
type SelectableMarkdownTextProps,
} from "@t3tools/mobile-markdown-text/renderer";
+import { useMemo } from "react";
import { highlightCodeSnippet } from "../features/review/shikiReviewHighlighter";
+import { themeColorWithAlpha } from "../lib/mobileTheme";
+import { useUniwindTheme } from "../lib/useUniwindTheme";
type MobileSelectableMarkdownTextProps = Omit<SelectableMarkdownTextProps, "highlightCode">;
@@ -20,5 +23,18 @@ export function hasNativeSelectableMarkdownText(): boolean {
}
export function SelectableMarkdownText(props: MobileSelectableMarkdownTextProps) {
- return <T3SelectableMarkdownText {...props} highlightCode={highlightCodeSnippet} />;
+ const theme = useUniwindTheme();
+ const selectionColor = themeColorWithAlpha(theme["--color-primary"], 0.32);
+ const selectionHandleColor = theme["--color-primary"];
+ const textStyle = useMemo(
+ () => ({ selectionColor, selectionHandleColor, ...props.textStyle }),
+ [props.textStyle, selectionColor, selectionHandleColor],
+ );
+ return (
+ <T3SelectableMarkdownText
+ {...props}
+ textStyle={textStyle}
+ highlightCode={highlightCodeSnippet}
+ />
+ );
}
diff --git a/apps/mobile/src/native/T3ComposerEditor.native.tsx b/apps/mobile/src/native/T3ComposerEditor.native.tsx
index 92a4e1e2c18..490f47bd8a2 100644
--- a/apps/mobile/src/native/T3ComposerEditor.native.tsx
+++ b/apps/mobile/src/native/T3ComposerEditor.native.tsx
@@ -14,7 +14,7 @@ import {
type Ref,
} from "react";
import type { NativeSyntheticEvent, ViewProps } from "react-native";
-import { Image, StyleSheet } from "react-native";
+import { Image, Platform, StyleSheet } from "react-native";
import { markdownFileIconSource } from "@t3tools/mobile-markdown-text/file-icons";
import {
@@ -259,7 +259,7 @@ export function ComposerEditor({
);
const { systemColorsActive } = useAppearancePreferences();
const themeJson = JSON.stringify({
- selection: systemColorsActive ? theme["--color-primary"] : null,
+ selection: Platform.OS === "android" || systemColorsActive ? theme["--color-primary"] : null,
text: theme["--color-foreground"],
placeholder: theme["--color-placeholder"],
chipBackground: theme["--color-subtle"],
diff --git a/apps/mobile/src/persistence/mobile-preferences.ts b/apps/mobile/src/persistence/mobile-preferences.ts
index 4fae06f6826..2959a18d8c6 100644
--- a/apps/mobile/src/persistence/mobile-preferences.ts
+++ b/apps/mobile/src/persistence/mobile-preferences.ts
@@ -8,7 +8,6 @@ import * as Semaphore from "effect/Semaphore";
import type { SidebarProjectGroupingMode } from "@t3tools/contracts";
import type { ComposerEnterBehavior } from "../lib/composerEnterBehavior";
import { MOBILE_THEME_IDS, type MobileThemeId, type MobileThemeMode } from "../lib/mobileTheme";
-
import * as MobileDatabase from "./mobile-database";
import * as MobileSecureStorage from "./mobile-secure-storage";
import { MobileStorageDecodeError, MobileStorageEncodeError } from "./mobile-storage";
@@ -22,7 +21,6 @@ export interface Preferences {
readonly lightThemeId?: MobileThemeId;
readonly darkThemeId?: MobileThemeId;
readonly themeMode?: MobileThemeMode;
- readonly materialYouStyleLayoutEnabled?: boolean;
readonly baseFontSize?: number;
readonly terminalFontSize?: number | null;
readonly markdownFontSize?: number;
@@ -94,7 +92,6 @@ function sanitizePreferences(parsed: Preferences): Preferences {
lightThemeId?: MobileThemeId;
darkThemeId?: MobileThemeId;
themeMode?: MobileThemeMode;
- materialYouStyleLayoutEnabled?: boolean;
baseFontSize?: number;
terminalFontSize?: number | null;
markdownFontSize?: number;
@@ -139,9 +136,6 @@ function sanitizePreferences(parsed: Preferences): Preferences {
) {
preferences.themeMode = parsed.themeMode;
}
- if (typeof parsed.materialYouStyleLayoutEnabled === "boolean") {
- preferences.materialYouStyleLayoutEnabled = parsed.materialYouStyleLayoutEnabled;
- }
if (typeof parsed.baseFontSize === "number") preferences.baseFontSize = parsed.baseFontSize;
if (typeof parsed.terminalFontSize === "number" || parsed.terminalFontSize === null) {
preferences.terminalFontSize = parsed.terminalFontSize;
diff --git a/docs/user/appearance.md b/docs/user/appearance.md
index f682902586f..b2fdd05b08f 100644
--- a/docs/user/appearance.md
+++ b/docs/user/appearance.md
@@ -10,7 +10,8 @@ themes or defaults.
On Android 12 or newer, choose the **Material You** theme in Appearance to use colors from
your wallpaper. Selecting another theme replaces those colors. Like other themes, Material You
can be selected separately for light and dark appearances.
-Android also offers **Material You Layout**, which changes shapes and spacing independently
+Android uses **Material You Layout** by default unless you have turned it off in Appearance.
+It changes shapes, spacing, and controls independently
of the selected theme.
## Motion
diff --git a/vite.config.ts b/vite.config.ts
index e487c893189..d1b31c8361d 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -184,6 +184,7 @@ export default defineConfig({
"apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx",
"apps/mobile/src/features/files/FileMarkdownPreview.tsx",
"apps/mobile/src/features/files/SourceFileSurface.tsx",
+ "apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx",
"apps/mobile/src/features/files/AttachmentFileScreen.tsx",
"apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx",
"apps/mobile/src/features/files/thread-file-navigator-pane.tsx",
@@ -204,6 +205,7 @@ export default defineConfig({
"apps/mobile/src/lib/useMobileNavigationTheme.ts",
"apps/mobile/src/native/T3ComposerEditor.ios.tsx",
"apps/mobile/src/native/T3ComposerEditor.native.tsx",
+ "apps/mobile/src/native/SelectableMarkdownText.android.tsx",
],
rules: {
"t3code/no-mobile-uniwind-theme-escape-hatches": ["error", { allowUniwindTheme: true }],