fix(mobile): support Hermes collection sorting
Reuses the focused compatibility approach from closed PR #3923 and covers the remaining hardware-keyboard reverse iteration. Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
9c65560b35
commit
32b749d07e
8 files changed
+72
-22
No files matched your search
@@ -55,7 +55,10 @@ export function subscribeToHardwareKeyboardCommandRegistrations(listener: () =>
|
||||
export function dispatchHardwareKeyboardCommand(command: HardwareKeyboardCommand): boolean {
|
||||
const commandHandlers = handlers.get(command);
|
||||
if (!commandHandlers) return false;
|
||||
for (const handler of [...commandHandlers].toReversed()) {
|
||||
const handlersInRegistrationOrder = Array.from(commandHandlers);
|
||||
for (let index = handlersInRegistrationOrder.length - 1; index >= 0; index -= 1) {
|
||||
const handler = handlersInRegistrationOrder[index];
|
||||
if (!handler) continue;
|
||||
if (handler() !== false) return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -8,7 +8,8 @@ import {
|
||||
} from "@t3tools/client-runtime/state/thread-relationships";
|
||||
import { canDetachThreadProviderSession } from "@t3tools/client-runtime/state/thread-workflows";
|
||||
import type { EnvironmentId, OrchestrationV2ThreadShell, ThreadId } from "@t3tools/contracts";
|
||||
import { useRouter } from "expo-router";
|
||||
import { copySorted } from "@t3tools/shared/Array";
|
||||
import { useNavigation } from "@react-navigation/native";
|
||||
import { useMemo, useState } from "react";
|
||||
import { ActivityIndicator, Modal, Pressable, ScrollView, View } from "react-native";
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
@@ -79,7 +80,8 @@ export function ThreadRelationshipsBanner(props: {
|
||||
const mergeTargetThreadId = resolveMergeBackTargetThreadId(projection);
|
||||
const rows = useMemo(
|
||||
() =>
|
||||
immediateThreadRelationships(graph, props.threadId).toSorted(
|
||||
copySorted(
|
||||
immediateThreadRelationships(graph, props.threadId),
|
||||
(left, right) =>
|
||||
Number(right.threadId === mergeTargetThreadId) -
|
||||
Number(left.threadId === mergeTargetThreadId),
|
||||
|
||||
Reference in new issue
Block a user