@umituz/react-native-design-system 2.8.17 → 2.8.19
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 +1 -1
- package/src/exports/molecules.ts +5 -0
- package/src/molecules/navigation/hooks/useAppFocusEffect.ts +14 -0
- package/src/molecules/navigation/hooks/useAppIsFocused.ts +11 -0
- package/src/molecules/navigation/hooks/useAppNavigation.ts +12 -0
- package/src/molecules/navigation/hooks/useAppRoute.ts +14 -0
- package/src/molecules/navigation/index.ts +4 -0
- package/src/molecules/navigation/types.ts +4 -2
- package/src/molecules/navigation/utils/ScreenFactory.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.19",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive, safe area, exception, infinite scroll, UUID, image, timezone, offline, and onboarding utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
package/src/exports/molecules.ts
CHANGED
|
@@ -100,6 +100,10 @@ export {
|
|
|
100
100
|
createNavigationTheme,
|
|
101
101
|
useTabBarStyles,
|
|
102
102
|
useTabConfig,
|
|
103
|
+
useAppNavigation,
|
|
104
|
+
useAppRoute,
|
|
105
|
+
useAppFocusEffect,
|
|
106
|
+
useAppIsFocused,
|
|
103
107
|
type NavigationHeaderProps,
|
|
104
108
|
type ScreenOptionsParams,
|
|
105
109
|
type TabsNavigatorProps,
|
|
@@ -118,6 +122,7 @@ export {
|
|
|
118
122
|
type BottomTabNavigationOptions,
|
|
119
123
|
type BottomTabScreenProps,
|
|
120
124
|
type StackNavigationOptions,
|
|
125
|
+
type RouteProp,
|
|
121
126
|
type TabLabelProps,
|
|
122
127
|
type TabBarConfig,
|
|
123
128
|
// Long Press Menu
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useFocusEffect } from "@react-navigation/native";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* useAppFocusEffect Hook
|
|
6
|
+
*
|
|
7
|
+
* A wrapper around React Navigation's useFocusEffect hook.
|
|
8
|
+
* Standardizes focus effect usage across all packages and apps.
|
|
9
|
+
*/
|
|
10
|
+
export function useAppFocusEffect(effect: () => void | (() => void)) {
|
|
11
|
+
useFocusEffect(effect);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { useCallback };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useIsFocused } from "@react-navigation/native";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* useAppIsFocused Hook
|
|
5
|
+
*
|
|
6
|
+
* A wrapper around React Navigation's useIsFocused hook.
|
|
7
|
+
* Standardizes API usage across all packages and apps.
|
|
8
|
+
*/
|
|
9
|
+
export function useAppIsFocused(): boolean {
|
|
10
|
+
return useIsFocused();
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useNavigation } from "@react-navigation/native";
|
|
2
|
+
import type { NavigationProp, ParamListBase } from "@react-navigation/native";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* useAppNavigation Hook
|
|
6
|
+
*
|
|
7
|
+
* A wrapper around React Navigation's useNavigation hook.
|
|
8
|
+
* Standardizes navigation usage across all packages and apps.
|
|
9
|
+
*/
|
|
10
|
+
export function useAppNavigation<T extends ParamListBase>(): NavigationProp<T> {
|
|
11
|
+
return useNavigation<NavigationProp<T>>();
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useRoute } from "@react-navigation/native";
|
|
2
|
+
import type { RouteProp, ParamListBase } from "@react-navigation/native";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* useAppRoute Hook
|
|
6
|
+
*
|
|
7
|
+
* A wrapper around React Navigation's useRoute hook.
|
|
8
|
+
* Standardizes route usage across all packages and apps.
|
|
9
|
+
*/
|
|
10
|
+
export function useAppRoute<T extends ParamListBase, RouteName extends keyof T = string>(): RouteProp<T, RouteName> {
|
|
11
|
+
return useRoute<RouteProp<T, RouteName>>();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type { RouteProp };
|
|
@@ -34,6 +34,10 @@ export { TabLabel, type TabLabelProps } from "./components/TabLabel";
|
|
|
34
34
|
export * from './components/NavigationHeader';
|
|
35
35
|
export { useTabBarStyles, type TabBarConfig } from "./hooks/useTabBarStyles";
|
|
36
36
|
export { useTabConfig, type UseTabConfigProps } from "./hooks/useTabConfig";
|
|
37
|
+
export { useAppNavigation } from "./hooks/useAppNavigation";
|
|
38
|
+
export { useAppRoute, type RouteProp } from "./hooks/useAppRoute";
|
|
39
|
+
export { useAppFocusEffect } from "./hooks/useAppFocusEffect";
|
|
40
|
+
export { useAppIsFocused } from "./hooks/useAppIsFocused";
|
|
37
41
|
|
|
38
42
|
// Navigation Theme
|
|
39
43
|
export { createNavigationTheme } from "./utils/NavigationTheme";
|
|
@@ -28,9 +28,11 @@ export interface FabConfig {
|
|
|
28
28
|
*/
|
|
29
29
|
export interface BaseScreen<T extends ParamListBase = ParamListBase> {
|
|
30
30
|
/** Unique name identifier for the screen */
|
|
31
|
-
name: string
|
|
31
|
+
name: Extract<keyof T, string>;
|
|
32
32
|
/** React component to render for this screen */
|
|
33
|
-
component
|
|
33
|
+
component?: React.ComponentType<any>;
|
|
34
|
+
/** Render function for children (alternative to component) */
|
|
35
|
+
children?: (props: any) => React.ReactNode;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
/**
|
|
@@ -87,6 +87,7 @@ export function createTabScreen<T extends ParamListBase = ParamListBase>(
|
|
|
87
87
|
key: screen.name,
|
|
88
88
|
name: screen.name,
|
|
89
89
|
component: screen.component,
|
|
90
|
+
children: screen.children,
|
|
90
91
|
options: screenOptions,
|
|
91
92
|
});
|
|
92
93
|
}
|
|
@@ -129,6 +130,7 @@ export function createStackScreen<T extends ParamListBase = ParamListBase>(
|
|
|
129
130
|
key: screen.name,
|
|
130
131
|
name: screen.name,
|
|
131
132
|
component: screen.component,
|
|
133
|
+
children: screen.children,
|
|
132
134
|
options: screenOptions,
|
|
133
135
|
});
|
|
134
136
|
}
|