UNPKG

expo-router

Version:

Expo Router is a file-based router for React Native and web applications.

23 lines (21 loc) • 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "getFocusedRouteNameFromRoute", { enumerable: true, get: function() { return getFocusedRouteNameFromRoute; } }); const _useRouteCache = require("./useRouteCache"); function getFocusedRouteNameFromRoute(route) { // @ts-expect-error: this isn't in type definitions coz we want this private const state = route[_useRouteCache.CHILD_STATE] ?? route.state; // TODO(@ubax): https://github.com/expo/expo/pull/48757 - remove the stack.type check from here const routeName = state ? state.routes[// If we have a partial state without index, for tab/drawer, first screen will be focused one, and last for stack // Deep-link partial states can omit both index and type; typeless full states still have an index state.index ?? (typeof state.type === 'string' && state.type !== 'stack' ? 0 : state.routes.length - 1)].name : undefined; return routeName; } //# sourceMappingURL=getFocusedRouteNameFromRoute.js.map