2023-04-13 15:49:51 +03:00
|
|
|
import { NavigationContainerRef } from '@react-navigation/native';
|
2022-07-28 10:28:29 +03:00
|
|
|
import React from 'react';
|
|
|
|
|
|
2023-04-13 15:49:51 +03:00
|
|
|
export const settingsNavigationContainerRef = React.createRef<NavigationContainerRef<any>>();
|
2022-07-28 10:28:29 +03:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* User defined navigation action included inside the reference to the container.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} name - Destination name of the route that has been defined somewhere.
|
|
|
|
|
* @param {Object} params - Params to pass to the destination route.
|
|
|
|
|
* @returns {Function}
|
|
|
|
|
*/
|
2023-08-15 10:32:40 +03:00
|
|
|
export function navigate(name: string, params?: Object) {
|
2022-07-28 10:28:29 +03:00
|
|
|
return settingsNavigationContainerRef.current?.navigate(name, params);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* User defined navigation action included inside the reference to the container.
|
|
|
|
|
*
|
|
|
|
|
* @returns {Function}
|
|
|
|
|
*/
|
|
|
|
|
export function goBack() {
|
|
|
|
|
return settingsNavigationContainerRef.current?.goBack();
|
|
|
|
|
}
|