Compare commits
No commits in common. "3d7a285db34bc0f53a39f1a5c4f6e4f92c32d09f" and "be19a391275a06207320e1d3a3b7320aedbc507d" have entirely different histories.
3d7a285db3
...
be19a39127
|
|
@ -1,34 +1,5 @@
|
||||||
import { router, Stack } from "expo-router";
|
import { Stack } from "expo-router";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
// GLOBAL NAVIGATION THROTTLE (Generic Fix for Repeated Click / Double Navigation)
|
|
||||||
// ============================================================================
|
|
||||||
const NAVIGATION_THROTTLE_MS = 700;
|
|
||||||
let lastNavigationTimestamp = 0;
|
|
||||||
|
|
||||||
const originalPush = router.push.bind(router);
|
|
||||||
const originalNavigate = router.navigate.bind(router);
|
|
||||||
|
|
||||||
router.push = ((...args: Parameters<typeof originalPush>) => {
|
|
||||||
const now = Date.now();
|
|
||||||
if (now - lastNavigationTimestamp < NAVIGATION_THROTTLE_MS) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
lastNavigationTimestamp = now;
|
|
||||||
return originalPush(...args);
|
|
||||||
}) as typeof router.push;
|
|
||||||
|
|
||||||
router.navigate = ((...args: Parameters<typeof originalNavigate>) => {
|
|
||||||
const now = Date.now();
|
|
||||||
if (now - lastNavigationTimestamp < NAVIGATION_THROTTLE_MS) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
lastNavigationTimestamp = now;
|
|
||||||
return originalNavigate(...args);
|
|
||||||
}) as typeof router.navigate;
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
import * as RN from "react-native";
|
import * as RN from "react-native";
|
||||||
import {
|
import {
|
||||||
useFonts,
|
useFonts,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue