Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(mobile): 将标签编辑态传给原生列表并保留直接可排序行

ylliuuu66d47990cf3590
diff --git a/apps/mobile/src/__tests__/composerSheetOrientation.test.tsx b/apps/mobile/src/__tests__/composerSheetOrientation.test.tsx
index 9940ffd052..1a0a0abbae 100644
--- a/apps/mobile/src/__tests__/composerSheetOrientation.test.tsx
+++ b/apps/mobile/src/__tests__/composerSheetOrientation.test.tsx
@@ -20,8 +20,8 @@ vi.mock('@expo/ui', () => ({ Host: ({ children }: any) => <div>{children}</div>
vi.mock('@expo/ui/swift-ui', () => {
const Container = ({ children }: any) => <div>{children}</div>;
return { ScrollView: ({ children }: any) => <section data-native-scroll>{children}</section>,
- Form: ({ children }: any) => <div data-native="Form">{children}</div>,
- List: ({ children }: any) => <div data-native="List">{children}</div>, Button: Container, Group: Container, HStack: Container, Image: Container,
+ Form: ({ children, modifiers }: any) => <div data-native="Form" data-modifiers={JSON.stringify(modifiers)}>{children}</div>,
+ List: ({ children, modifiers }: any) => <div data-native="List" data-modifiers={JSON.stringify(modifiers)}>{children}</div>, Button: Container, Group: Container, HStack: Container, Image: Container,
RNHostView: ({ children, matchContents }: any) => <div data-rn-size={matchContents ? 'content' : 'viewport'}>{children}</div>,
Spacer: Container, Text: Container, VStack: Container, ZStack: Container,
BottomSheet: (props: any) => { state.sheet = props; return <div>{props.children}</div>; },
@@ -41,6 +41,7 @@ it('uses a plain list only when requested and preserves form sheets', () => {
} finally { act(() => root.unmount()); }
});
vi.mock('@expo/ui/swift-ui/modifiers', () => ({
+ environment: (key: string, value: string) => ({ environment: { key, value } }),
containerRelativeFrame: vi.fn(() => ({})),
onGeometryChange: vi.fn(() => ({})),
...Object.fromEntries(['accessibilityLabel', 'contentShape', 'buttonStyle', 'font', 'foregroundStyle', 'frame', 'padding', 'presentationDetents', 'presentationDragIndicator', 'interactiveDismissDisabled', 'scrollContentBackground', 'listStyle', 'scrollDismissesKeyboard'].map(name => [name, vi.fn(() => ({}))])),
@@ -136,3 +137,24 @@ it('keeps self-scrolling companion pages on the existing RN viewport path', () =
expect(viewport?.querySelector('[data-rn-scroll]')?.textContent).not.toContain('Save');
} finally { act(() => root.unmount()); }
});
+
+
+// #6947: per-row editMode never exposes native handles; it belongs on the Form/List.
+it.each([false, true])('applies requested edit mode to the native container (plain list: %s)', (nativeList) => {
+ const container = document.createElement('div');
+ const root = createRoot(container);
+ const render = (editing?: boolean) => act(() => root.render(
+ <ComposerSheet visible title="" nativeContent nativeList={nativeList} nativeEditMode={editing} onClose={() => {}}>
+ <span>Tags</span>
+ </ComposerSheet>,
+ ));
+ const modifiers = () => JSON.parse(container.querySelector('[data-native]')!.getAttribute('data-modifiers')!);
+ try {
+ render();
+ expect(modifiers().some((m: any) => m.environment?.key === 'editMode')).toBe(false);
+ render(true);
+ expect(modifiers()).toContainEqual({ environment: { key: 'editMode', value: 'active' } });
+ render(false);
+ expect(modifiers()).toContainEqual({ environment: { key: 'editMode', value: 'inactive' } });
+ } finally { act(() => root.unmount()); }
+});
diff --git a/apps/mobile/src/__tests__/sessionOptionsExpoSheet.test.ts b/apps/mobile/src/__tests__/sessionOptionsExpoSheet.test.ts
index db19c11879..66c152e0ab 100644
--- a/apps/mobile/src/__tests__/sessionOptionsExpoSheet.test.ts
+++ b/apps/mobile/src/__tests__/sessionOptionsExpoSheet.test.ts
@@ -70,6 +70,7 @@ vi.mock('@expo/ui/swift-ui/modifiers', () => ({
'containerRelativeFrame',
'buttonStyle',
'disabled',
+ 'environment',
'font',
'foregroundStyle',
'onGeometryChange',
diff --git a/apps/mobile/src/__tests__/taskTagsNative.test.tsx b/apps/mobile/src/__tests__/taskTagsNative.test.tsx
index d884427d5d..04307e3e91 100644
--- a/apps/mobile/src/__tests__/taskTagsNative.test.tsx
+++ b/apps/mobile/src/__tests__/taskTagsNative.test.tsx
@@ -7,6 +7,7 @@ const h = vi.hoisted(() => ({
onMove: null as null | ((sources: number[], destination: number) => void),
textField: null as any,
announce: vi.fn(),
+ sortingChanged: vi.fn(),
}));
vi.mock('react-native', () => ({
@@ -31,8 +32,8 @@ vi.mock('@/session/ComposerNativeSection', () => ({
),
}));
vi.mock('@/session/ComposerNativeRow', () => ({
- ComposerNativeRow: ({ title, onPress, onOptions, testID, disabled }: any) => (
- <div>
+ ComposerNativeRow: ({ title, onPress, onOptions, testID, disabled, modifiers }: any) => (
+ <div data-modifiers={JSON.stringify(modifiers)}>
<button data-testid={testID} disabled={disabled} onClick={onPress}>
{title}
</button>
@@ -149,7 +150,7 @@ const baseState = (over: Record<string, unknown> = {}): any => ({
let root: ReturnType<typeof createRoot>;
let node: HTMLDivElement;
const render = (state: any) =>
- act(async () => root.render(<NativeTaskTagsExpanded state={state} />));
+ act(async () => root.render(<NativeTaskTagsExpanded state={state} onSortingChange={h.sortingChanged} />));
const press = (testID: string) =>
act(async () => node.querySelector<HTMLButtonElement>(`[data-testid="${testID}"]`)!.click());
@@ -158,6 +159,7 @@ beforeEach(() => {
h.onMove = null;
h.textField = null;
h.announce.mockClear();
+ h.sortingChanged.mockClear();
node = document.createElement('div');
root = createRoot(node);
});
@@ -238,15 +240,11 @@ const modifiers = () =>
it('disables native deletion in both modes and exposes edit mode only when sorting', async () => {
const state = baseState();
await render(state);
- expect(modifiers()).toContainEqual({
- environment: { key: 'editMode', value: 'inactive' },
- });
+ expect(h.sortingChanged).toHaveBeenLastCalledWith(false);
expect(modifiers().filter((m: any) => m.deleteDisabled)).toHaveLength(3);
expect(node.textContent).toContain('taskTags.reorderFooter');
await press('taskTags.reorder');
- expect(modifiers()).toContainEqual({
- environment: { key: 'editMode', value: 'active' },
- });
+ expect(h.sortingChanged).toHaveBeenLastCalledWith(true);
expect(modifiers().filter((m: any) => m.deleteDisabled)).toHaveLength(3);
expect(modifiers().filter((m: any) => m.moveDisabled === false)).toHaveLength(3);
expect(node.textContent).toContain('taskTags.reorderDone');
@@ -256,9 +254,7 @@ it('disables native deletion in both modes and exposes edit mode only when sorti
await press('taskTags.tag.a');
expect(state.onToggle).not.toHaveBeenCalled();
await press('taskTags.reorder');
- expect(modifiers()).toContainEqual({
- environment: { key: 'editMode', value: 'inactive' },
- });
+ expect(h.sortingChanged).toHaveBeenLastCalledWith(false);
expect(node.querySelector('[data-testid="taskTags.tag.a.options"]')).not.toBeNull();
expect(node.querySelector('[data-testid="taskTags.add"]')).not.toBeNull();
});
@@ -266,13 +262,14 @@ it('disables native deletion in both modes and exposes edit mode only when sorti
it('blocks moves while saving or offline, and restores sorting after the lock clears', async () => {
const state = baseState();
await render(state);
+ const move = h.onMove!;
await press('taskTags.reorder');
await render({ ...state, disabled: true });
expect(modifiers().filter((m: any) => m.moveDisabled === true)).toHaveLength(3);
- act(() => h.onMove!([0], 3));
+ act(() => move([0], 3));
expect(state.onMove).not.toHaveBeenCalled();
await render(state);
- act(() => h.onMove!([0], 3));
+ act(() => move([0], 3));
expect(state.onMove).toHaveBeenCalledWith(0, 2);
});
@@ -284,9 +281,7 @@ it('resets sorting after leaving the list and keeps an exit when the catalog shr
expect(node.textContent).toContain('taskTags.reorderDone');
await render({ ...state, page: 'edit' });
await render(state);
- expect(modifiers()).toContainEqual({
- environment: { key: 'editMode', value: 'inactive' },
- });
+ expect(h.sortingChanged).toHaveBeenLastCalledWith(false);
});
it('allows finishing sorting while offline without enabling writes or re-entry', async () => {
@@ -298,7 +293,7 @@ it('allows finishing sorting while offline without enabling writes or re-entry',
node.querySelector<HTMLButtonElement>('[data-testid="taskTags.reorder"]')!;
expect(reorderButton().disabled).toBe(false);
await press('taskTags.reorder');
- expect(modifiers()).toContainEqual({ environment: { key: 'editMode', value: 'inactive' } });
+ expect(h.sortingChanged).toHaveBeenLastCalledWith(false);
expect(reorderButton().disabled).toBe(true);
expect(node.querySelector<HTMLButtonElement>('[data-testid="taskTags.tag.a"]')!.disabled).toBe(true);
act(() => h.onMove!([0], 3));
diff --git a/apps/mobile/src/__tests__/taskTagsSheet.test.tsx b/apps/mobile/src/__tests__/taskTagsSheet.test.tsx
index 0db4e8b158..274f1eeb4e 100644
--- a/apps/mobile/src/__tests__/taskTagsSheet.test.tsx
+++ b/apps/mobile/src/__tests__/taskTagsSheet.test.tsx
@@ -5,6 +5,7 @@ import { afterEach, beforeEach, expect, it, vi } from 'vitest';
const h = vi.hoisted(() => ({
sheet: null as any,
+ sortingChanged: null as null | ((sorting: boolean) => void),
pageChange: null as null | ((page: string | null, back: () => void, backDisabled?: boolean) => void),
}));
@@ -24,7 +25,9 @@ vi.mock('@/theme', () => ({
spacing: {},
}));
vi.mock('@/session/SheetModal', () => ({ SheetModal: () => null }));
-vi.mock('@/session/TaskTagsNative', () => ({ NativeTaskTagsExpanded: () => null }));
+vi.mock('@/session/TaskTagsNative', () => ({
+ NativeTaskTagsExpanded: ({ onSortingChange }: any) => { h.sortingChanged = onSortingChange; return null; },
+}));
vi.mock('@/session/ComposerSheet', () => ({
ComposerSheet: (props: any) => {
h.sheet = props;
@@ -32,9 +35,9 @@ vi.mock('@/session/ComposerSheet', () => ({
},
}));
vi.mock('@/session/TaskTags', () => ({
- TaskTagsPanel: ({ onPageChange }: any) => {
+ TaskTagsPanel: ({ onPageChange, renderExpanded }: any) => {
h.pageChange = onPageChange;
- return null;
+ return renderExpanded?.({});
},
}));
@@ -90,3 +93,16 @@ it('passes a saving editor page down so the back arrow is disabled', async () =>
await act(async () => h.pageChange!('list', () => {}, true));
expect(h.sheet.backDisabled).toBe(false);
});
+
+
+it('sets edit mode on the containing sheet when native tag sorting changes', async () => {
+ await act(async () => root.render(
+ <TaskTagsSheet session={{ id: 's', canonicalDeviceId: 'host' } as any}
+ visible onClose={() => {}} onClosed={() => {}} />,
+ ));
+ expect(h.sheet.nativeEditMode).toBe(false);
+ await act(async () => h.sortingChanged!(true));
+ expect(h.sheet.nativeEditMode).toBe(true);
+ await act(async () => h.sortingChanged!(false));
+ expect(h.sheet.nativeEditMode).toBe(false);
+});
diff --git a/apps/mobile/src/session/ComposerNativeRow.ios.tsx b/apps/mobile/src/session/ComposerNativeRow.ios.tsx
index e6e72b9155..9302101cb5 100644
--- a/apps/mobile/src/session/ComposerNativeRow.ios.tsx
+++ b/apps/mobile/src/session/ComposerNativeRow.ios.tsx
@@ -27,9 +27,10 @@ export function ComposerNativeRow({
optionsLabel,
disabled: unavailable,
testID,
+ modifiers,
}: ComposerNativeRowProps) {
return (
- <HStack spacing={0}>
+ <HStack spacing={0} modifiers={modifiers}>
<Button
onPress={onPress}
testID={testID}
diff --git a/apps/mobile/src/session/ComposerNativeRow.tsx b/apps/mobile/src/session/ComposerNativeRow.tsx
index c23611c9cd..a00cd83d88 100644
--- a/apps/mobile/src/session/ComposerNativeRow.tsx
+++ b/apps/mobile/src/session/ComposerNativeRow.tsx
@@ -1,5 +1,6 @@
import type { ReactNode } from "react";
-export interface ComposerNativeRowProps {
+import type { CommonViewModifierProps } from '@expo/ui/swift-ui';
+export interface ComposerNativeRowProps extends CommonViewModifierProps {
leading?: ReactNode;
accessory?: ReactNode;
optionsIcon?: ReactNode;
diff --git a/apps/mobile/src/session/ComposerSheet.ios.tsx b/apps/mobile/src/session/ComposerSheet.ios.tsx
index e690f89753..79e39eb10f 100644
--- a/apps/mobile/src/session/ComposerSheet.ios.tsx
+++ b/apps/mobile/src/session/ComposerSheet.ios.tsx
@@ -21,6 +21,7 @@ import {
accessibilityElement,
accessibilityHidden,
disabled,
+ environment,
opacity,
scrollDisabled,
contentShape,
@@ -62,6 +63,7 @@ export function ComposerSheet({
nativeContent,
contentScrolls,
nativeList,
+ nativeEditMode,
nativeHeader,
nativeRoot,
preventDismiss = false,
@@ -73,6 +75,9 @@ export function ComposerSheet({
// UIKit disables the medium detent in compact-height landscape. Never bind
// selection to an unavailable detent, including after rotating an open sheet.
const landscape = width > height;
+ const editModeModifiers = nativeEditMode === undefined
+ ? []
+ : [environment('editMode', nativeEditMode ? 'active' : 'inactive')];
return (
<Host
colorScheme={mode}
@@ -156,7 +161,7 @@ export function ComposerSheet({
{nativeRoot.header}
<Form
testID={testID ? `${testID}.list` : undefined}
- modifiers={[containerRelativeFrame({ axes: 'horizontal' }), scrollContentBackground("hidden")]}
+ modifiers={[...editModeModifiers, containerRelativeFrame({ axes: 'horizontal' }), scrollContentBackground("hidden")]}
>
{nativeRoot.content}
</Form>
@@ -171,7 +176,7 @@ export function ComposerSheet({
{nativeHeader}
<Form
testID={testID}
- modifiers={[containerRelativeFrame({ axes: 'horizontal' }), scrollContentBackground("hidden")]}
+ modifiers={[...editModeModifiers, containerRelativeFrame({ axes: 'horizontal' }), scrollContentBackground("hidden")]}
>
{children}
</Form>
@@ -180,6 +185,7 @@ export function ComposerSheet({
</ZStack>
) : nativeContent && nativeList ? (
<List testID={testID} modifiers={[
+ ...editModeModifiers,
containerRelativeFrame({ axes: 'horizontal' }),
listStyle("plain"),
scrollContentBackground("hidden"),
@@ -189,6 +195,7 @@ export function ComposerSheet({
</List>
) : nativeContent ? (
<Form testID={testID} modifiers={[
+ ...editModeModifiers,
containerRelativeFrame({ axes: 'horizontal' }),
scrollContentBackground("hidden"),
...(aboveContent ? [padding({ top: -12 })] : []),
diff --git a/apps/mobile/src/session/ComposerSheet.tsx b/apps/mobile/src/session/ComposerSheet.tsx
index 462b3e5fc9..40fd993b0d 100644
--- a/apps/mobile/src/session/ComposerSheet.tsx
+++ b/apps/mobile/src/session/ComposerSheet.tsx
@@ -5,6 +5,8 @@ export interface ComposerSheetProps {
contentScrolls?: boolean;
/** Use an ungrouped system list instead of the default form. */
nativeList?: boolean;
+ /** Set edit mode on the containing SwiftUI list so its reorder handles appear. */
+ nativeEditMode?: boolean;
/** Protect an unsaved or in-flight form; explicit Back/Save remains available. */
preventDismiss?: boolean;
nativeHeader?: ReactNode;
diff --git a/apps/mobile/src/session/SessionOptionsExpoSheet.tsx b/apps/mobile/src/session/SessionOptionsExpoSheet.tsx
index 742136ee93..94f1efa1f3 100644
--- a/apps/mobile/src/session/SessionOptionsExpoSheet.tsx
+++ b/apps/mobile/src/session/SessionOptionsExpoSheet.tsx
@@ -159,6 +159,7 @@ function SessionOptionsExpoSheet({
onClose={onClose}
onClosed={onClosed}
nativeContent
+ nativeEditMode={page === 'list' && tagPage.sorting}
testID="home.sessionActions"
>
{!tagsExpanded ? (
@@ -180,7 +181,9 @@ function SessionOptionsExpoSheet({
expanded={tagsExpanded}
onExpandedChange={setTagsExpanded}
renderCompact={(state) => <NativeTagShortcuts state={state} />}
- renderExpanded={(state) => <NativeTaskTagsExpanded state={state} />}
+ renderExpanded={(state) => (
+ <NativeTaskTagsExpanded state={state} onSortingChange={tagPage.onSortingChange} />
+ )}
onPageChange={tagPage.onPageChange}
/>
) : null}
diff --git a/apps/mobile/src/session/TaskTagsNative.ios.tsx b/apps/mobile/src/session/TaskTagsNative.ios.tsx
index b7bc3609da..4c8000a38b 100644
--- a/apps/mobile/src/session/TaskTagsNative.ios.tsx
+++ b/apps/mobile/src/session/TaskTagsNative.ios.tsx
@@ -1,10 +1,9 @@
-import { useEffect, useState } from 'react';
+import { useEffect, useRef, useState } from 'react';
import { AccessibilityInfo } from 'react-native';
import { useTranslation } from 'react-i18next';
import {
Button,
Circle,
- Group,
HStack,
Image,
List,
@@ -23,7 +22,6 @@ import {
contentShape,
deleteDisabled,
disabled,
- environment,
font,
foregroundStyle,
frame,
@@ -41,7 +39,7 @@ import { iconSize, useTheme } from '@/theme';
import { ComposerNativeSection as Section } from './ComposerNativeSection';
import { ComposerNativeRow } from './ComposerNativeRow';
import type { TaskTagsExpandedState } from './TaskTags';
-import type { NativeTagSwatchProps } from './TaskTagsNative';
+import type { NativeTagSwatchProps, NativeTaskTagsExpandedProps } from './TaskTagsNative';
import { TAG_SWATCH, taskTagMoveTarget } from './taskTagsNativePage';
/** One drawn swatch for every tag surface; the outline only rescues white tags. */
@@ -247,9 +245,16 @@ function TagForm({ state }: { state: TaskTagsExpandedState }) {
}
/** SwiftUI rendering of the expanded tag pages: list, add / edit, delete confirmation. */
-export function NativeTaskTagsExpanded({ state }: { state: TaskTagsExpandedState }) {
+export function NativeTaskTagsExpanded({ state, onSortingChange }: NativeTaskTagsExpandedProps) {
const { t } = useTranslation();
const [sorting, setSorting] = useState(false);
+ const latest = useRef({ sorting, state });
+ latest.current = { sorting, state };
+ // SwiftUI requires editMode on the enclosing Form/List, not on its row group.
+ useEffect(() => {
+ onSortingChange?.(sorting);
+ return () => onSortingChange?.(false);
+ }, [sorting, onSortingChange]);
useEffect(() => {
if (state.page !== 'list') setSorting(false);
}, [state.page]);
@@ -291,43 +296,42 @@ export function NativeTaskTagsExpanded({ state }: { state: TaskTagsExpandedState
<ProgressView />
</Section>
) : state.tags.length ? (
- <Group modifiers={[environment('editMode', sorting ? 'active' : 'inactive')]}>
- <Section
- footer={
- state.tags.length > 1 ? (
- <Note text={t(sorting ? 'taskTags.reorderHint' : 'taskTags.reorderFooter')} />
- ) : undefined
- }
+ <Section
+ footer={
+ state.tags.length > 1 ? (
+ <Note text={t(sorting ? 'taskTags.reorderHint' : 'taskTags.reorderFooter')} />
+ ) : undefined
+ }
+ >
+ <List.ForEach
+ onMove={(sources, destination) => {
+ const { sorting, state } = latest.current;
+ if (!sorting || state.disabled) return;
+ const from = sources[0];
+ if (from === undefined) return;
+ state.onMove(from, taskTagMoveTarget(from, destination));
+ }}
>
- <List.ForEach
- onMove={(sources, destination) => {
- if (!sorting || state.disabled) return;
- const from = sources[0];
- if (from === undefined) return;
- state.onMove(from, taskTagMoveTarget(from, destination));
- }}
- >
- {state.tags.map((tag) => (
- <Group
- key={tag.id}
- modifiers={[deleteDisabled(true), moveDisabled(state.disabled || !sorting)]}
- >
- <ComposerNativeRow
- leading={<NativeTagSwatch {...tag} selected={false} size={TAG_SWATCH.row} />}
- title={tag.name}
- selected={tag.selected}
- disabled={state.disabled || sorting}
- onPress={() => state.onToggle(tag.id)}
- onOptions={sorting ? undefined : () => state.onEdit(tag.id)}
- optionsIcon={<Image size={iconSize.lg} systemName="pencil" />}
- optionsLabel={t('taskTags.editLabel', { name: tag.name })}
- testID={`taskTags.tag.${tag.id}`}
- />
- </Group>
- ))}
- </List.ForEach>
- </Section>
- </Group>
+ {/* A transparent Group adds a nested native ForEach and prevents row moves. */}
+ {state.tags.map((tag) => (
+ <ComposerNativeRow
+ key={tag.id}
+ modifiers={[deleteDisabled(true), moveDisabled(state.disabled || !sorting)]}
+ leading={<NativeTagSwatch {...tag} selected={false} size={TAG_SWATCH.row} />}
+ title={tag.name}
+ selected={tag.selected}
+ disabled={state.disabled}
+ onPress={() => {
+ if (!latest.current.sorting) latest.current.state.onToggle(tag.id);
+ }}
+ onOptions={sorting ? undefined : () => state.onEdit(tag.id)}
+ optionsIcon={<Image size={iconSize.lg} systemName="pencil" />}
+ optionsLabel={t('taskTags.editLabel', { name: tag.name })}
+ testID={`taskTags.tag.${tag.id}`}
+ />
+ ))}
+ </List.ForEach>
+ </Section>
) : !state.message ? (
<Section>
<Note text={t('taskTags.empty')} />
diff --git a/apps/mobile/src/session/TaskTagsNative.tsx b/apps/mobile/src/session/TaskTagsNative.tsx
index 4c455f646e..55859445ca 100644
--- a/apps/mobile/src/session/TaskTagsNative.tsx
+++ b/apps/mobile/src/session/TaskTagsNative.tsx
@@ -13,6 +13,11 @@ export function NativeTagSwatch(_props: NativeTagSwatchProps) {
return null;
}
-export function NativeTaskTagsExpanded(_props: { state: TaskTagsExpandedState }) {
+export interface NativeTaskTagsExpandedProps {
+ state: TaskTagsExpandedState;
+ onSortingChange?(sorting: boolean): void;
+}
+
+export function NativeTaskTagsExpanded(_props: NativeTaskTagsExpandedProps) {
return null;
}
diff --git a/apps/mobile/src/session/TaskTagsSheet.tsx b/apps/mobile/src/session/TaskTagsSheet.tsx
index 799c67f34d..4ff490bd52 100644
--- a/apps/mobile/src/session/TaskTagsSheet.tsx
+++ b/apps/mobile/src/session/TaskTagsSheet.tsx
@@ -60,7 +60,9 @@ export function TaskTagsSheet({
expanded
showDone={false}
onExpandedChange={() => {}}
- renderExpanded={ios ? (state) => <NativeTaskTagsExpanded state={state} /> : undefined}
+ renderExpanded={ios ? (state) => (
+ <NativeTaskTagsExpanded state={state} onSortingChange={tagPage.onSortingChange} />
+ ) : undefined}
onPageChange={ios ? tagPage.onPageChange : undefined}
/>
);
@@ -78,6 +80,7 @@ export function TaskTagsSheet({
onClose={onClose}
onClosed={onClosed}
nativeContent
+ nativeEditMode={tagPage.sorting}
testID="taskTags.sheet"
>
{panel}
diff --git a/apps/mobile/src/session/taskTagsNativePage.ts b/apps/mobile/src/session/taskTagsNativePage.ts
index b8e0ecd786..3a363fd2a5 100644
--- a/apps/mobile/src/session/taskTagsNativePage.ts
+++ b/apps/mobile/src/session/taskTagsNativePage.ts
@@ -8,6 +8,7 @@ export const TAG_SWATCH = { row: 22, picker: 28 } as const;
export function useTaskTagsNativePage() {
const [page, setPage] = useState<TaskTagsPage | null>(null);
const [backDisabled, setBackDisabled] = useState(false);
+ const [sorting, setSorting] = useState(false);
const backRef = useRef<() => void>(() => {});
const onPageChange = useCallback(
(next: TaskTagsPage | null, back: () => void, blocked = false) => {
@@ -18,7 +19,7 @@ export function useTaskTagsNativePage() {
[],
);
const back = useCallback(() => backRef.current(), []);
- return { page, back, backDisabled, onPageChange };
+ return { page, back, backDisabled, onPageChange, sorting, onSortingChange: setSorting };
}
export function taskTagsPageTitle(page: TaskTagsPage, t: (key: string) => string) {