2021-11-11 14:32:56 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
// $FlowExpectedError
|
|
|
|
export const rootNavigationRef = React.createRef();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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}
|
|
|
|
*/
|
2022-01-25 12:55:57 +00:00
|
|
|
export function navigateRoot(name: string, params: Object) {
|
2021-11-11 14:32:56 +00:00
|
|
|
// $FlowExpectedError
|
|
|
|
return rootNavigationRef.current?.navigate(name, params);
|
|
|
|
}
|
|
|
|
|