Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): dragging a microphone or environment route now saves its new place #26096

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/26096/headmerged by juliusmarminge View on GitHub

Showing 5 changed files with 83 additions and 13 deletions (loading 3).

x
0 of 5 viewed, 5 left
75 additions and 0 deletionsapps/mobile/src/features/settings/components/SettingsDragHandle.test.tsxAdded
View file
@@ -0,0 +1,75 @@
+import type { ReactNode } from "react";
+import { act } from "react";
+import { createRoot } from "react-dom/client";
+import { describe, expect, it, vi } from "vite-plus/test";
+​
+type PanEvent = { readonly translationY: number };
+type PanHandlers = {
+ onStart?: () => void;
+ onUpdate?: (event: PanEvent) => void;
+ onFinalize?: (event: PanEvent, success: boolean) => void;
+};
+​
+const pans = vi.hoisted(() => [] as PanHandlers[]);
+​
+vi.mock("react-native", () => ({
+ View: ({ children }: { children?: ReactNode }) => <div>{children}</div>,
+}));
+vi.mock("react-native-gesture-handler", () => ({
+ GestureDetector: ({ children }: { children?: ReactNode }) => children,
+ Gesture: {
+ Pan: () => {
+ const handlers: PanHandlers = {};
+ pans.push(handlers);
+ const pan = {
+ minDistance: () => pan,
+ shouldCancelWhenOutside: () => pan,
+ runOnJS: () => pan,
+ onStart: (callback: PanHandlers["onStart"]) => ((handlers.onStart = callback), pan),
+ onUpdate: (callback: PanHandlers["onUpdate"]) => ((handlers.onUpdate = callback), pan),
+ onFinalize: (callback: PanHandlers["onFinalize"]) => (