@appello/mobile
Version:
Common package with many useful features for mobile development
12 lines (11 loc) • 676 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.useGetCurrentRouteName = void 0;
const native_1 = require("@react-navigation/native");
const react_1 = require("react");
const utils_1 = require("../utils");
const useGetCurrentRouteName = () => {
const navigationState = (0, native_1.useNavigationState)(state => { var _a; return state.routes[(((_a = state === null || state === void 0 ? void 0 : state.routes) === null || _a === void 0 ? void 0 : _a.length) || 1) - 1]; });
return (0, react_1.useMemo)(() => (0, utils_1.getRouteName)(navigationState), [navigationState]);
};
exports.useGetCurrentRouteName = useGetCurrentRouteName;