update
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import React, { setGlobal } from "reactn";
|
||||
|
||||
import { isDesktop } from "../hooks/useLayoutType";
|
||||
import { Routes } from "./Routes";
|
||||
|
||||
export const navigationRef = React.createRef();
|
||||
|
||||
export function navigate(name, params) {
|
||||
navigationRef.current?.navigate(name, params);
|
||||
}
|
||||
|
||||
export function dispatch(route) {
|
||||
navigationRef.current?.dispatch(route);
|
||||
}
|
||||
|
||||
export function reset(route) {
|
||||
navigationRef.current?.reset(route);
|
||||
}
|
||||
|
||||
export function goBack() {
|
||||
navigationRef.current?.goBack();
|
||||
}
|
||||
|
||||
export const navigateToTask = (taskData = {}) => {
|
||||
if (isDesktop) {
|
||||
setGlobal({ currentTaskData: taskData });
|
||||
} else {
|
||||
navigate(Routes.TaskDetails, taskData);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user