The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 09:30 UTC
fix(mobile): review file navigation respects reduced motion (#23348)
Co-authored-by: maria-rcks <maria@kuuro.net>
Ivan Fedyunin committed
Oct 31, 2026 at 05:35 UTC
399d96d09565b68df4aa18c1d751714383518bbc
3 files changed
+30
-1
apps/mobile/modules/t3-review-diff/android/src/main/java/expo/modules/t3reviewdiff/T3ReviewDiffView.kt
+1
@@ -483,6 +483,7 @@ class T3ReviewDiffView(context: Context, appContext: AppContext) : ExpoView(cont
483
)
484
postInvalidateOnAnimation()
485
} else {
486
+ verticalScroller.forceFinished(true)
487
canvasView.setVerticalOffset(target)
488
}
489
}
apps/mobile/modules/t3-review-diff/tests/android/src/test/kotlin/expo/modules/t3reviewdiff/ReviewDiffViewportTest.kt
+24
@@ -22,6 +22,30 @@ import org.robolectric.annotation.Config
22
@RunWith(RobolectricTestRunner::class)
23
@Config(sdk = [35], manifest = Config.NONE)
24
class ReviewDiffViewportTest {
25
+ @Test
26
+ fun immediateNavigationStopsAnActiveFling() {
27
+ val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
28
+ val view = T3ReviewDiffView(activity, AppContext())
29
+ val scroller = view.javaClass.getDeclaredField("verticalScroller").apply {
30
+ isAccessible = true
31
+ }.get(view) as android.widget.OverScroller
32
+ try {
33
+ scroller.fling(0, 100, 0, 2000, 0, 0, 0, 10000)
34
+ assertTrue(!scroller.isFinished)
35
+ view.scrollToTop(false)
36
+ view.computeScroll()
37
+ val canvas = view.getChildAt(0)
38
+ val offset = canvas.javaClass.getDeclaredMethod("verticalOffset").apply {
39
+ isAccessible = true
40
+ }.invoke(canvas)
41
+ assertEquals(0, offset)
42
+ assertTrue(scroller.isFinished)
43
+ } finally {
44
+ view.cleanup()
45
+ activity.finish()
46
+ }
47
+ }
48
+
49
@Test
50
fun resetDiscardsOldRowsAndPendingDecodeBeforePublishingTheNewDestination() {
51
val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
apps/mobile/src/features/review/ReviewSheet.tsx
+5
-1
@@ -22,6 +22,7 @@ import {
22
View,
23
} from "react-native";
24
import { useSafeAreaInsets } from "react-native-safe-area-context";
25
+import { useReduceMotionEnabled } from "../../lib/appState";
26
import { useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics";
27
import { NativeInspectorContent } from "../../native/NativeInspectorContent";
28
@@ -423,6 +424,7 @@ type ReviewSheetProps = StaticScreenProps<{
424
}>;
425
426
export function ReviewSheet(props: ReviewSheetProps) {
427
+ const reduceMotion = useReduceMotionEnabled();
428
const { nativeReviewDiffStyle } = useAppearanceCodeSurface();
429
useAdaptiveWorkspacePaneRole("inspector");
430
const { panes } = useAdaptiveWorkspaceLayout();
@@ -553,7 +555,9 @@ export function ReviewSheet(props: ReviewSheetProps) {
555
const nativeView = nativeReviewDiffViewRef.current;
556
if (!nativeView) return;
557
const result = await settlePromise(() =>
556
- fileId === null ? nativeView.scrollToTop(true) : nativeView.scrollToFile(fileId, true),
558
+ fileId === null
559
+ ? nativeView.scrollToTop(!reduceMotion)
560
+ : nativeView.scrollToFile(fileId, !reduceMotion),
561
);
562
if (AsyncResult.isFailure(result)) {
563
console.error("[review] Failed to navigate to diff file", squashAtomCommandFailure(result));