@idealyst/navigation 1.0.98 → 1.0.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idealyst/navigation",
3
- "version": "1.0.98",
3
+ "version": "1.0.99",
4
4
  "description": "Cross-platform navigation library for React and React Native",
5
5
  "readme": "README.md",
6
6
  "main": "src/index.ts",
@@ -43,8 +43,8 @@
43
43
  "publish:npm": "npm publish"
44
44
  },
45
45
  "peerDependencies": {
46
- "@idealyst/components": "^1.0.98",
47
- "@idealyst/theme": "^1.0.98",
46
+ "@idealyst/components": "^1.0.99",
47
+ "@idealyst/theme": "^1.0.99",
48
48
  "@react-navigation/bottom-tabs": ">=7.0.0",
49
49
  "@react-navigation/drawer": ">=7.0.0",
50
50
  "@react-navigation/native": ">=7.0.0",
@@ -60,10 +60,10 @@
60
60
  "react-router-dom": ">=6.0.0"
61
61
  },
62
62
  "devDependencies": {
63
- "@idealyst/components": "^1.0.98",
63
+ "@idealyst/components": "^1.0.99",
64
64
  "@idealyst/datagrid": "^1.0.93",
65
65
  "@idealyst/datepicker": "^1.0.93",
66
- "@idealyst/theme": "^1.0.98",
66
+ "@idealyst/theme": "^1.0.99",
67
67
  "@types/react": "^19.1.8",
68
68
  "@types/react-dom": "^19.1.6",
69
69
  "react": "^19.1.0",
@@ -143,8 +143,32 @@ const buildRoute = (params: RouteParam, index: number, isNested = false) => {
143
143
  // Build child routes including catch-all for 404
144
144
  const childRoutes = params.routes.map((child, childIndex) => buildRoute(child, childIndex, true));
145
145
 
146
- // Add catch-all route if notFoundComponent or onInvalidRoute is configured
146
+ // Add catch-all and index routes if notFoundComponent or onInvalidRoute is configured
147
147
  if (params.notFoundComponent || params.onInvalidRoute) {
148
+ // Check if any route handles the index (empty path or "/" for this navigator)
149
+ const hasIndexRoute = params.routes.some(route => {
150
+ const childPath = route.path.startsWith('/') ? route.path.slice(1) : route.path;
151
+ return childPath === '' || childPath === '/';
152
+ });
153
+
154
+ // If no index route defined, add one for the 404 handler
155
+ // This handles the case where user visits the navigator's root path directly
156
+ if (!hasIndexRoute) {
157
+ childRoutes.push(
158
+ <Route
159
+ key="__notFoundIndex__"
160
+ index
161
+ element={
162
+ <NotFoundWrapper
163
+ component={params.notFoundComponent}
164
+ onInvalidRoute={params.onInvalidRoute}
165
+ />
166
+ }
167
+ />
168
+ );
169
+ }
170
+
171
+ // Add catch-all for non-index invalid routes
148
172
  childRoutes.push(
149
173
  <Route
150
174
  key="__notFound__"