@idealyst/navigation 1.2.13 → 1.2.15

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.2.13",
3
+ "version": "1.2.15",
4
4
  "description": "Cross-platform navigation library for React and React Native",
5
5
  "readme": "README.md",
6
6
  "main": "src/index.ts",
@@ -44,9 +44,9 @@
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@idealyst/camera": "^1.1.6",
47
- "@idealyst/components": "^1.2.13",
47
+ "@idealyst/components": "^1.2.15",
48
48
  "@idealyst/microphone": "^1.1.7",
49
- "@idealyst/theme": "^1.2.13",
49
+ "@idealyst/theme": "^1.2.15",
50
50
  "@react-navigation/bottom-tabs": ">=7.0.0",
51
51
  "@react-navigation/drawer": ">=7.0.0",
52
52
  "@react-navigation/native": ">=7.0.0",
@@ -71,11 +71,11 @@
71
71
  },
72
72
  "devDependencies": {
73
73
  "@idealyst/camera": "^1.1.6",
74
- "@idealyst/components": "^1.2.13",
74
+ "@idealyst/components": "^1.2.15",
75
75
  "@idealyst/datagrid": "^1.0.93",
76
76
  "@idealyst/datepicker": "^1.0.93",
77
77
  "@idealyst/microphone": "^1.1.7",
78
- "@idealyst/theme": "^1.2.13",
78
+ "@idealyst/theme": "^1.2.15",
79
79
  "@types/react": "^19.1.8",
80
80
  "@types/react-dom": "^19.1.6",
81
81
  "react": "^19.1.0",
@@ -102,37 +102,36 @@ export default function ExampleSidebar({ insets }: DrawerSidebarProps) {
102
102
  const navigator = useNavigator();
103
103
 
104
104
  return (
105
- <Screen
106
- style={{
107
- height: '100%',
108
- padding: 16,
109
- }}
105
+ <Screen
106
+ style={{ height: '100%' }}
110
107
  contentInset={insets}
111
108
  >
112
- {componentGroups.map((group, groupIndex) => (
113
- <List key={group.title}>
114
- <Text
115
- size="sm"
116
- weight="bold"
117
- color="secondary"
118
- style={{ marginBottom: 8, marginLeft: 8 }}
119
- >
120
- {group.title}
121
- </Text>
122
- {group.items.map((item) => (
123
- <ListItem
124
- key={item.path}
125
- label={item.label}
126
- leading={item.icon}
127
- size="sm"
128
- onPress={() => navigator.navigate({ path: item.path, vars: {} })}
129
- />
109
+ <View scrollable padding="md" style={{ height: '100%' }}>
110
+ {componentGroups.map((group, groupIndex) => (
111
+ <List key={group.title}>
112
+ <Text
113
+ size="sm"
114
+ weight="bold"
115
+ color="secondary"
116
+ style={{ marginBottom: 8, marginLeft: 8 }}
117
+ >
118
+ {group.title}
119
+ </Text>
120
+ {group.items.map((item) => (
121
+ <ListItem
122
+ key={item.path}
123
+ label={item.label}
124
+ leading={item.icon}
125
+ size="sm"
126
+ onPress={() => navigator.navigate({ path: item.path, vars: {} })}
127
+ />
128
+ ))}
129
+ {groupIndex < componentGroups.length - 1 && (
130
+ <Divider spacing="sm" style={{ marginTop: 8 }} />
131
+ )}
132
+ </List>
130
133
  ))}
131
- {groupIndex < componentGroups.length - 1 && (
132
- <Divider spacing="sm" style={{ marginTop: 8 }} />
133
- )}
134
- </List>
135
- ))}
134
+ </View>
136
135
  </Screen>
137
- )
136
+ );
138
137
  }
@@ -4,7 +4,7 @@ import { useParams as useReactRouterParams } from '../router';
4
4
  * Custom useParams hook that wraps React Router's useParams
5
5
  * This ensures we're accessing the correct React Router context
6
6
  */
7
- export const useParams = (): Record<string, string> => {
7
+ export const useParams = (): Record<string, string | undefined> => {
8
8
  const params = useReactRouterParams();
9
9
  return params || {};
10
10
  };
@@ -1,4 +1,4 @@
1
- import { NavigatorParam, RouteParam, ScreenOptions, NotFoundComponentProps } from './types'
1
+ import { NavigatorParam, RouteParam, ScreenOptions, NotFoundComponentProps, NOT_FOUND_SCREEN_NAME } from './types'
2
2
 
3
3
  import { TypedNavigator } from "@react-navigation/native";
4
4
  import { createNativeStackNavigator } from "@react-navigation/native-stack";
@@ -8,11 +8,8 @@ import { DrawerContentWrapper } from './DrawerContentWrapper.native';
8
8
  import { HeaderWrapper } from './HeaderWrapper.native';
9
9
  import React from 'react';
10
10
 
11
-
12
- /**
13
- * Internal screen name for 404 pages
14
- */
15
- export const NOT_FOUND_SCREEN_NAME = '__notFound__';
11
+ // Re-export for backwards compatibility
12
+ export { NOT_FOUND_SCREEN_NAME };
16
13
 
17
14
  /**
18
15
  * Creates a NotFound screen component that receives path and params from route params
@@ -164,7 +164,7 @@ const buildRoute = (params: RouteParam, index: number, isNested = false, parentP
164
164
 
165
165
  // Separate fullScreen routes from regular routes
166
166
  const regularRoutes = params.routes.filter(route => !isFullScreenRoute(route));
167
- const fullScreenRoutes = params.routes.filter(isFullScreenRoute);
167
+ const fullScreenRoutes = params.routes.filter((route): route is ScreenParam => isFullScreenRoute(route));
168
168
 
169
169
  // Transform routes to include full paths for layout component (only non-fullScreen)
170
170
  const routesWithFullPaths = regularRoutes.map(route => ({
@@ -241,12 +241,14 @@ const buildRoute = (params: RouteParam, index: number, isNested = false, parentP
241
241
  const fullPath = joinPaths(navigatorFullPath, route.path);
242
242
  // Remove leading slash for React Router path (it will be relative to root)
243
243
  const routerPath = fullPath.startsWith('/') ? fullPath.slice(1) : fullPath;
244
+ // Type assertion: fullScreen routes are always screens with a component
245
+ const screenRoute = route as ScreenParam;
244
246
 
245
247
  return (
246
248
  <Route
247
249
  key={`fullscreen-${route.path}-${fsIndex}`}
248
250
  path={routerPath || '/'}
249
- element={React.createElement(route.component)}
251
+ element={React.createElement(screenRoute.component)}
250
252
  />
251
253
  );
252
254
  });
@@ -1,6 +1,11 @@
1
1
  import React from "react";
2
2
  import type { NavigateParams } from "../context/types";
3
3
 
4
+ /**
5
+ * Special screen name used for not-found/404 routes
6
+ */
7
+ export const NOT_FOUND_SCREEN_NAME = '__notFound__';
8
+
4
9
  /**
5
10
  * Tab bar specific screen options
6
11
  */