@idealyst/navigation 1.0.79 → 1.0.81

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.79",
3
+ "version": "1.0.81",
4
4
  "description": "Cross-platform navigation library for React and React Native",
5
5
  "readme": "README.md",
6
6
  "main": "src/index.ts",
@@ -18,10 +18,8 @@
18
18
  },
19
19
  "exports": {
20
20
  ".": {
21
- "react-native": "./src/index.native.ts",
22
- "default": "./src/index.web.ts",
23
- "import": "./src/index.web.ts",
24
- "require": "./src/index.web.ts",
21
+ "import": "./src/index.ts",
22
+ "require": "./src/index.ts",
25
23
  "types": "./src/index.ts"
26
24
  },
27
25
  "./examples": {
@@ -40,8 +38,8 @@
40
38
  "publish:npm": "npm publish"
41
39
  },
42
40
  "peerDependencies": {
43
- "@idealyst/components": "^1.0.79",
44
- "@idealyst/theme": "^1.0.79",
41
+ "@idealyst/components": "^1.0.81",
42
+ "@idealyst/theme": "^1.0.81",
45
43
  "@react-navigation/bottom-tabs": "^7.0.0",
46
44
  "@react-navigation/drawer": "^7.0.0",
47
45
  "@react-navigation/native": "^7.0.0",
@@ -6,7 +6,6 @@ import { useUnistyles } from 'react-native-unistyles';
6
6
 
7
7
  const NavigatorContext = createContext<NavigatorContextValue>({
8
8
  navigate: () => {},
9
- params: {},
10
9
  });
11
10
 
12
11
  // Utility function to parse path with parameters and find matching route
@@ -70,7 +69,6 @@ const parseParameterizedPath = (path: string, routes: any[]): { routeName: strin
70
69
  const UnwrappedNavigatorProvider = ({ route }: NavigatorProviderProps) => {
71
70
 
72
71
  const navigation = useNavigation();
73
- const currentRoute = useRoute();
74
72
 
75
73
  const navigate = (params: NavigateParams) => {
76
74
 
@@ -94,7 +92,6 @@ const UnwrappedNavigatorProvider = ({ route }: NavigatorProviderProps) => {
94
92
  return (
95
93
  <NavigatorContext.Provider value={{
96
94
  navigate,
97
- params: currentRoute.params || {}
98
95
  }}>
99
96
  <RouteComponent />
100
97
  </NavigatorContext.Provider>
@@ -17,5 +17,4 @@ export type NavigatorProviderProps = {
17
17
  */
18
18
  export type NavigatorContextValue = {
19
19
  navigate: (params: NavigateParams) => void;
20
- params: Record<string, string>;
21
20
  };
@@ -0,0 +1,2 @@
1
+ // Native-specific hook exports
2
+ export * from './useParams.native';
@@ -0,0 +1,2 @@
1
+ // Cross-platform hook exports
2
+ export * from './useParams.web'; // This will be overridden by platform-specific exports
@@ -0,0 +1,2 @@
1
+ // Web-specific hook exports
2
+ export * from './useParams.web';
@@ -0,0 +1,10 @@
1
+ import { useRoute } from '@react-navigation/native';
2
+
3
+ /**
4
+ * Custom useParams hook for React Native that wraps React Navigation's useRoute
5
+ * Returns the current route parameters
6
+ */
7
+ export const useParams = (): Record<string, string> => {
8
+ const route = useRoute();
9
+ return (route.params as Record<string, string>) || {};
10
+ };
@@ -0,0 +1,10 @@
1
+ import { useParams as useReactRouterParams } from 'react-router';
2
+
3
+ /**
4
+ * Custom useParams hook that wraps React Router's useParams
5
+ * This ensures we're accessing the correct React Router context
6
+ */
7
+ export const useParams = (): Record<string, string> => {
8
+ const params = useReactRouterParams();
9
+ return params || {};
10
+ };
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  // Cross-platform exports
2
2
  export * from './context';
3
3
  export * from './layouts';
4
- export * from './routing';
4
+ export * from './routing';
5
+ export * from './hooks';
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { View, Text } from '@idealyst/components'
3
3
  import { StackLayoutProps } from '../routing/types'
4
- import { Outlet } from 'react-router'
4
+ import { Outlet } from '..'
5
5
 
6
6
  export interface DefaultStackLayoutProps extends StackLayoutProps {
7
7
  onNavigate: (path: string) => void
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { View, Text, Button, Icon } from '@idealyst/components'
3
3
  import { TabLayoutProps } from '../routing/types'
4
- import { Outlet } from 'react-router'
4
+ import { Outlet } from '..'
5
5
 
6
6
  export interface DefaultTabLayoutProps extends TabLayoutProps {}
7
7