// RootNavigation.js
import { StackActions } from "@react-navigation/native";
import * as React from "react";

export const navigationRef = React.createRef();

export function navigate(name, params) {
  navigationRef.current?.navigate(name, params);
}

export function dispatch(...params) {
  navigationRef.current?.dispatch(...params);
}

export function addListener(...params) {
  return navigationRef.current?.addListener(...params);
}

export function pop() {
  navigationRef.current?.dispatch(StackActions.pop(1));
}
// add other navigation functions that you need and export them
