2024-01-05 13:50:07 -04:00
|
|
|
import { createNavigationContainerRef, ParamListBase, NavigationAction } from '@react-navigation/native';
|
|
|
|
|
|
|
|
export const navigationRef = createNavigationContainerRef<ParamListBase>();
|
|
|
|
|
|
|
|
export function navigate(name: string, params?: ParamListBase) {
|
|
|
|
if (navigationRef.isReady()) {
|
|
|
|
navigationRef.current?.navigate(name, params);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function dispatch(action: NavigationAction) {
|
|
|
|
if (navigationRef.isReady()) {
|
|
|
|
navigationRef.current?.dispatch(action);
|
|
|
|
}
|
|
|
|
}
|
2024-02-24 11:08:10 -04:00
|
|
|
|
|
|
|
export function reset() {
|
|
|
|
if (navigationRef.isReady()) {
|
|
|
|
navigationRef.current?.reset({
|
|
|
|
index: 0,
|
|
|
|
routes: [{ name: 'UnlockWithScreenRoot' }],
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|