Polish native mobile Mail-style chrome

This commit is contained in:
Julius Marminge committed 2026-06-30 07:39:55 -07:00
1 parent 5bfd2161be
commit a930a44212
7 files changed
+182 -67

No files matched your search

+4 -3
View File
@@ -11,6 +11,7 @@ import type { SearchBarCommands } from "react-native-screens";
import { nativeHeaderScrollEdgeEffects } from "../../lib/native-scroll-edge-effect";
import { useThemeColor } from "../../lib/useThemeColor";
import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
import { withNativeGlassHeaderItem } from "../layout/native-glass-header-items";
import { createNativeMailSearchToolbarItem } from "../layout/native-mail-search-toolbar";
import type { HomeProjectSortOrder } from "./homeThreadList";
import {
@@ -73,14 +74,14 @@ export function HomeHeader(props: {
unstable_headerRightItems:
Platform.OS === "ios"
? () => [
{
withNativeGlassHeaderItem({
accessibilityLabel: "Open settings",
icon: { name: "ellipsis", type: "sfSymbol" },
icon: { name: "ellipsis", type: "sfSymbol" } as const,
identifier: "home-settings",
label: "",
onPress: props.onOpenSettings,
type: "button",
},
}),
]
: undefined,
unstable_headerToolbarItems:
+19 -8
View File
@@ -435,6 +435,16 @@ export function HomeScreen(props: HomeScreenProps) {
<>
{Platform.OS === "ios" ? null : <HomeTopContentSpacer topInset={insets.top} />}
{shouldShowConnectionStatus && Platform.OS === "ios" ? (
<View style={{ paddingBottom: 16 }}>
<WorkspaceConnectionStatus
state={props.catalogState}
onPress={props.onOpenEnvironments}
variant="sidebar"
/>
</View>
) : null}
{!hasAnyThreads ? (
<View>
<EmptyState
@@ -543,14 +553,15 @@ export function HomeScreen(props: HomeScreenProps) {
</ScrollView>
);
const connectionStatus = shouldShowConnectionStatus ? (
<View
className="absolute left-0 right-0 items-center"
style={{ bottom: Math.max(insets.bottom, 18) + 76 }}
>
<WorkspaceConnectionStatus state={props.catalogState} onPress={props.onOpenEnvironments} />
</View>
) : null;
const connectionStatus =
shouldShowConnectionStatus && Platform.OS !== "ios" ? (
<View
className="absolute left-0 right-0 items-center"
style={{ bottom: Math.max(insets.bottom, 18) + 76 }}
>
<WorkspaceConnectionStatus state={props.catalogState} onPress={props.onOpenEnvironments} />
</View>
) : null;
return (
<>
@@ -0,0 +1,31 @@
type NativeGlassHeaderItem = {
readonly type: "button" | "menu";
readonly glassEffect?: boolean;
readonly sharesBackground?: boolean;
readonly variant?: "plain" | "done" | "prominent";
readonly width?: number;
};
export const NATIVE_GLASS_HEADER_BUTTON_WIDTH = 58;
/**
* iOS 26/27 Mail-style header controls need the native glass button
* configuration when they are not part of a larger toolbar. Keep this
* centralized so Expo Router screens and plain react-native-screens demos
* don't drift apart.
*/
export function withNativeGlassHeaderItem<T extends NativeGlassHeaderItem>(
item: T,
options: {
readonly sharesBackground?: boolean;
readonly width?: number;
} = {},
): T {
return {
...item,
glassEffect: item.glassEffect ?? true,
sharesBackground: options.sharesBackground ?? item.sharesBackground ?? true,
variant: item.variant ?? "prominent",
width: options.width ?? item.width ?? NATIVE_GLASS_HEADER_BUTTON_WIDTH,
} as T;
}
@@ -35,6 +35,7 @@ import { ThreadSwipeable } from "../home/thread-swipe-actions";
import { useThreadListActions } from "../home/useThreadListActions";
import { WorkspaceConnectionStatus } from "../home/WorkspaceConnectionStatus";
import { shouldShowWorkspaceConnectionStatus } from "../home/workspace-connection-status";
import { withNativeGlassHeaderItem } from "../layout/native-glass-header-items";
import { SidebarHeaderActions } from "./sidebar-header-actions";
import { SidebarFilterButton } from "./sidebar-filter-button";
import { threadStatusTone } from "./threadPresentation";
@@ -564,20 +565,17 @@ export function ThreadNavigationSidebar(props: {
const { Screen, ScreenStack, ScreenStackHeaderConfig } =
require("react-native-screens") as typeof import("react-native-screens");
const nativeHeaderRightBarButtonItems = [
{
withNativeGlassHeaderItem({
accessibilityLabel: "Open settings",
icon: { name: "ellipsis", type: "sfSymbol" },
icon: { name: "ellipsis", type: "sfSymbol" } as const,
identifier: "thread-sidebar-settings",
onPress: props.onOpenSettings,
sharesBackground: true,
tintColor: foregroundColor,
type: "button",
variant: "prominent",
width: 58,
},
{
}),
withNativeGlassHeaderItem({
accessibilityLabel: "Filter and sort threads",
icon: { name: filterIcon, type: "sfSymbol" },
icon: { name: filterIcon, type: "sfSymbol" } as const,
identifier: "thread-sidebar-filter",
menu: {
title: "Thread list options",
@@ -640,12 +638,9 @@ export function ThreadNavigationSidebar(props: {
},
],
},
sharesBackground: true,
tintColor: foregroundColor,
type: "menu",
variant: "prominent",
width: 58,
},
}),
] as ComponentProps<typeof ScreenStackHeaderConfig>["headerRightBarButtonItems"];
return (
@@ -60,6 +60,7 @@ import {
useAdaptiveWorkspaceLayout,
useAdaptiveWorkspacePaneRole,
} from "../layout/AdaptiveWorkspaceLayout";
import { withNativeGlassHeaderItem } from "../layout/native-glass-header-items";
import { ThreadFileNavigatorPane } from "../files/thread-file-navigator-pane";
import {
ThreadInspectorContentStack,
@@ -640,7 +641,7 @@ function ThreadRouteContent(
},
...(props.onReturnToThread
? [
{
withNativeGlassHeaderItem({
accessibilityLabel: "Return to chat",
icon: { name: "chevron.left", type: "sfSymbol" as const },
identifier: "thread-left-return",
@@ -648,10 +649,10 @@ function ThreadRouteContent(
sharesBackground: false,
type: "button" as const,
width: 58,
},
}),
]
: []),
{
withNativeGlassHeaderItem({
accessibilityLabel: panes.primarySidebarVisible
? "Maximize content"
: "Show thread sidebar",
@@ -664,8 +665,8 @@ function ThreadRouteContent(
sharesBackground: false,
type: "button" as const,
width: 58,
},
{
}),
withNativeGlassHeaderItem({
accessibilityLabel: "New task",
icon: { name: "square.and.pencil", type: "sfSymbol" as const },
identifier: "thread-left-new-task",
@@ -673,7 +674,7 @@ function ThreadRouteContent(
sharesBackground: false,
type: "button" as const,
width: 58,
},
}),
],
[panes.primarySidebarVisible, props.onReturnToThread, router, togglePrimarySidebar],
);
+98 -4
View File
@@ -11,6 +11,69 @@ index ea5325e..acd2fd7 100644
+ imageLoader:(RCTImageLoader *)imageLoader;
+
@end
diff --git a/ios/RNSBarButtonItem.mm b/ios/RNSBarButtonItem.mm
index 0eb1f09..73298f1 100644
--- a/ios/RNSBarButtonItem.mm
+++ b/ios/RNSBarButtonItem.mm
@@ -110,6 +110,58 @@ static UIMenuOptions RNSMakeUIMenuOptionsFromConfig(NSDictionary *config);
if (dict[@"accessibilityHint"]) {
self.accessibilityHint = dict[@"accessibilityHint"];
}
+#if !TARGET_OS_TV && RNS_IPHONE_OS_VERSION_AVAILABLE(26_0)
+ NSNumber *glassEffectNum = dict[@"glassEffect"];
+ if (@available(iOS 26.0, *)) {
+ if ([glassEffectNum boolValue]) {
+ UIButtonConfiguration *configuration = [UIButtonConfiguration glassButtonConfiguration];
+ configuration.cornerStyle = UIButtonConfigurationCornerStyleCapsule;
+ UIBackgroundConfiguration *background = configuration.background;
+ background.strokeWidth = 0.0;
+ background.strokeColor = UIColor.clearColor;
+ configuration.background = background;
+ configuration.contentInsets = NSDirectionalEdgeInsetsZero;
+ if (title != nil) {
+ configuration.title = title;
+ }
+
+ UIButton *button = [UIButton buttonWithConfiguration:configuration primaryAction:nil];
+ button.translatesAutoresizingMaskIntoConstraints = NO;
+ button.enabled = self.enabled;
+ button.accessibilityLabel = self.accessibilityLabel;
+ button.accessibilityHint = self.accessibilityHint;
+
+ CGFloat resolvedWidth = width != nil ? width.doubleValue : 56.0;
+ [button.widthAnchor constraintEqualToConstant:resolvedWidth].active = YES;
+ [button.heightAnchor constraintEqualToConstant:50.0].active = YES;
+
+ [[self class] resolveImageFromConfig:dict
+ imageLoader:imageLoader
+ completionBlock:^(UIImage *img) {
+ UIButtonConfiguration *updatedConfiguration = button.configuration;
+ updatedConfiguration.image = img;
+ button.configuration = updatedConfiguration;
+ }];
+
+ NSDictionary *menu = dict[@"menu"];
+ if (menu) {
+ button.menu = [[self class] initUIMenuWithDict:menu menuAction:menuAction imageLoader:imageLoader];
+ button.showsMenuAsPrimaryAction = YES;
+ } else {
+ NSString *buttonId = dict[@"buttonId"];
+ if (buttonId && action) {
+ UIAction *pressAction = [UIAction actionWithHandler:^(__kindof UIAction *_Nonnull sender) {
+ action(buttonId);
+ }];
+ [button addAction:pressAction forControlEvents:UIControlEventTouchUpInside];
+ }
+ }
+
+ self.customView = button;
+ return self;
+ }
+ }
+#endif
#if !TARGET_OS_TV || __TV_OS_VERSION_MAX_ALLOWED >= 170000
if (@available(tvOS 17.0, *)) {
diff --git a/ios/RNSScreen.mm b/ios/RNSScreen.mm
index 69d4d9a..6192c4a 100644
--- a/ios/RNSScreen.mm
@@ -1137,7 +1200,7 @@ index 8e4480f..883c5f2 100644
//# sourceMappingURL=index.d.ts.map
\ No newline at end of file
diff --git a/lib/typescript/types.d.ts b/lib/typescript/types.d.ts
index 3b384e0..a77ef61 100644
index 3b384e0..1e3a966 100644
--- a/lib/typescript/types.d.ts
+++ b/lib/typescript/types.d.ts
@@ -10,6 +10,7 @@ export type SearchBarCommands = {
@@ -1211,7 +1274,19 @@ index 3b384e0..a77ef61 100644
/**
* Allows for setting text color of the title.
*/
@@ -1145,8 +1188,37 @@ export interface HeaderBarButtonItemWithMenu extends SharedHeaderBarButtonItem {
@@ -1001,6 +1044,11 @@ interface SharedHeaderBarButtonItem {
* Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/style-swift.property
*/
variant?: 'plain' | 'done' | 'prominent' | undefined;
+ /**
+ * Render the item with UIButtonConfiguration.glassButtonConfiguration.
+ * Only available from iOS 26.0 and later.
+ */
+ glassEffect?: boolean | undefined;
/**
* The tint color to apply to the item.
*
@@ -1145,8 +1193,37 @@ export interface HeaderBarButtonItemWithMenu extends SharedHeaderBarButtonItem {
export interface HeaderBarButtonItemSpacing {
type: 'spacing';
spacing: number;
@@ -1250,6 +1325,13 @@ index 3b384e0..a77ef61 100644
/**
* Custom Screen Transition
*/
@@ -1192,4 +1269,4 @@ export interface GestureProviderProps extends GestureProps {
gestureDetectorBridge: React.MutableRefObject<GestureDetectorBridge>;
}
export {};
-//# sourceMappingURL=types.d.ts.map
\ No newline at end of file
+//# sourceMappingURL=types.d.ts.map
diff --git a/src/components/ScreenStackHeaderConfig.tsx b/src/components/ScreenStackHeaderConfig.tsx
index 421b3c2..0ca6f1d 100644
--- a/src/components/ScreenStackHeaderConfig.tsx
@@ -1475,7 +1557,7 @@ index a405aec..cd649bd 100644
+export * from './components/gamma/scroll-view-marker';
export type * from './components/shared/types';
diff --git a/src/types.tsx b/src/types.tsx
index 76a83f3..bb7abb6 100644
index 76a83f3..9e4499f 100644
--- a/src/types.tsx
+++ b/src/types.tsx
@@ -26,6 +26,7 @@ export type SearchBarCommands = {
@@ -1549,7 +1631,19 @@ index 76a83f3..bb7abb6 100644
/**
* Allows for setting text color of the title.
*/
@@ -1279,11 +1322,46 @@ export interface HeaderBarButtonItemWithMenu extends SharedHeaderBarButtonItem {
@@ -1125,6 +1168,11 @@ interface SharedHeaderBarButtonItem {
* Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/style-swift.property
*/
variant?: 'plain' | 'done' | 'prominent' | undefined;
+ /**
+ * Render the item with UIButtonConfiguration.glassButtonConfiguration.
+ * Only available from iOS 26.0 and later.
+ */
+ glassEffect?: boolean | undefined;
/**
* The tint color to apply to the item.
*
@@ -1279,11 +1327,46 @@ export interface HeaderBarButtonItemWithMenu extends SharedHeaderBarButtonItem {
export interface HeaderBarButtonItemSpacing {
type: 'spacing';
spacing: number;
+16 -34
View File
@@ -66,33 +66,15 @@ overrides:
packageExtensionsChecksum: sha256-FV3+2NW/9MFbunJaPsMxvO0LAzyfccoPtPiKoIXAwUU=
patchedDependencies:
'@effect/[email protected]':
hash: 42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f
path: patches/@[email protected]
'@expo/[email protected]':
hash: 8cb08b5bb7051ed9d2dbe46a2c293c5a1e17f1bd6ddf30de27909e18c921ff46
path: patches/@expo%[email protected]
'@ff-labs/[email protected]':
hash: 2b16019ce7ab61aec6478dd02f79ef468cc1d5c51e9d00764f7d2ab8167210c8
path: patches/@[email protected]
'@pierre/[email protected]':
hash: 7cb6da88544119adda056b2f46f43956f99326227732da0b345081e285a6c53a
path: patches/@pierre%[email protected]
[email protected]:
hash: c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5
path: patches/[email protected]
[email protected]:
hash: 9170f8074ae4e35a0a086e756c8f815794fd3abe51eac67ca3ba02804225ec1f
path: patches/[email protected]
[email protected]:
hash: 3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8
path: patches/[email protected]
[email protected]:
hash: 825622aae63a8fb5b904f3c77908a0e216261d727ea171709f2c0b6088422675
path: patches/[email protected]
[email protected]:
hash: d5b1dfed010c3e2ea92399b0a83d9ba903443f4e900184f9bdefbb22cafa33cb
path: patches/[email protected]
'@effect/[email protected]': 42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f
'@expo/[email protected]': 8cb08b5bb7051ed9d2dbe46a2c293c5a1e17f1bd6ddf30de27909e18c921ff46
'@ff-labs/[email protected]': 2b16019ce7ab61aec6478dd02f79ef468cc1d5c51e9d00764f7d2ab8167210c8
'@pierre/[email protected]': 7cb6da88544119adda056b2f46f43956f99326227732da0b345081e285a6c53a
[email protected]: c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5
[email protected]: 9170f8074ae4e35a0a086e756c8f815794fd3abe51eac67ca3ba02804225ec1f
[email protected]: 3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8
[email protected]: 825622aae63a8fb5b904f3c77908a0e216261d727ea171709f2c0b6088422675
[email protected]: 914870f7aa1cbbbb0bff272c223fabfb154d84dc3a53054b76c3c2c8727c71b7
importers:
@@ -327,7 +309,7 @@ importers:
version: 0.1.15([email protected])([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
expo-router:
specifier: ~56.2.11
version: 56.2.11(patch_hash=3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8)(708fd680682731bfd53a5282341dd27a)
version: 56.2.11(patch_hash=3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8)(58010f146fb71a08f4c76f0e25e5e6b3)
expo-secure-store:
specifier: ~56.0.4
version: 56.0.4([email protected])
@@ -381,7 +363,7 @@ importers:
version: 5.7.0([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
react-native-screens:
specifier: 4.25.2
version: 4.25.2(patch_hash=d5b1dfed010c3e2ea92399b0a83d9ba903443f4e900184f9bdefbb22cafa33cb)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
version: 4.25.2(patch_hash=914870f7aa1cbbbb0bff272c223fabfb154d84dc3a53054b76c3c2c8727c71b7)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
react-native-shiki-engine:
specifier: ^0.3.12
version: 0.3.12([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
@@ -12021,7 +12003,7 @@ snapshots:
ws: 8.21.0([email protected])([email protected])
zod: 3.25.76
optionalDependencies:
expo-router: 56.2.11(patch_hash=3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8)(708fd680682731bfd53a5282341dd27a)
expo-router: 56.2.11(patch_hash=3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8)(58010f146fb71a08f4c76f0e25e5e6b3)
react-native: 0.85.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected])
transitivePeerDependencies:
- '@expo/dom-webview'
@@ -12319,7 +12301,7 @@ snapshots:
react: 19.2.3
optionalDependencies:
'@expo/metro-runtime': 56.0.15(@expo/[email protected])([email protected])([email protected]([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
expo-router: 56.2.11(patch_hash=3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8)(708fd680682731bfd53a5282341dd27a)
expo-router: 56.2.11(patch_hash=3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8)(58010f146fb71a08f4c76f0e25e5e6b3)
react-dom: 19.2.3([email protected])
transitivePeerDependencies:
- supports-color
@@ -16235,7 +16217,7 @@ snapshots:
react: 19.2.3
react-native: 0.85.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected])
[email protected](patch_hash=3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8)(708fd680682731bfd53a5282341dd27a):
[email protected](patch_hash=3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8)(58010f146fb71a08f4c76f0e25e5e6b3):
dependencies:
'@expo/log-box': 56.0.13(@expo/[email protected])([email protected])([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
'@expo/metro-runtime': 56.0.15(@expo/[email protected])([email protected])([email protected]([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
@@ -16266,7 +16248,7 @@ snapshots:
react-native: 0.85.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected])
react-native-drawer-layout: 4.2.4(0e9729601f58a7a7ae26c76fe6017455)
react-native-safe-area-context: 5.7.0([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
react-native-screens: 4.25.2(patch_hash=d5b1dfed010c3e2ea92399b0a83d9ba903443f4e900184f9bdefbb22cafa33cb)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
react-native-screens: 4.25.2(patch_hash=914870f7aa1cbbbb0bff272c223fabfb154d84dc3a53054b76c3c2c8727c71b7)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
server-only: 0.0.1
sf-symbols-typescript: 2.2.0
shallowequal: 1.1.0
@@ -18873,7 +18855,7 @@ snapshots:
react: 19.2.3
react-native: 0.85.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected])
[email protected](patch_hash=d5b1dfed010c3e2ea92399b0a83d9ba903443f4e900184f9bdefbb22cafa33cb)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]):
[email protected](patch_hash=914870f7aa1cbbbb0bff272c223fabfb154d84dc3a53054b76c3c2c8727c71b7)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]):
dependencies:
react: 19.2.3
react-freeze: 1.0.4([email protected])