@umituz/react-native-design-system 2.5.28 → 2.5.30

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": "@umituz/react-native-design-system",
3
- "version": "2.5.28",
3
+ "version": "2.5.30",
4
4
  "description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive and safe area utilities",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -4,19 +4,20 @@ import type { ParamListBase } from "@react-navigation/native";
4
4
  import { AtomicIcon } from "../../../atoms/AtomicIcon";
5
5
  import { useAppDesignTokens } from "../../../theme";
6
6
  import { useSafeAreaInsets } from "../../../safe-area";
7
- import type { TabNavigatorConfig } from "../types";
7
+ import type { TabNavigatorConfig, TabScreen } from "../types";
8
8
 
9
9
  export interface UseTabConfigProps<T extends ParamListBase> {
10
10
  config: TabNavigatorConfig<T>;
11
11
  }
12
12
 
13
- export const useTabConfig = <T extends ParamListBase>({
14
- config,
15
- }: UseTabConfigProps<T>) => {
13
+ export function useTabConfig<T extends ParamListBase>(props: UseTabConfigProps<T>): TabNavigatorConfig<T> {
14
+ const { config } = props;
16
15
  const tokens = useAppDesignTokens();
17
16
  const insets = useSafeAreaInsets();
18
17
 
19
18
  const finalConfig: TabNavigatorConfig<T> = useMemo(() => {
19
+ const screens = config.screens as TabScreen<T>[];
20
+
20
21
  return {
21
22
  ...config,
22
23
  renderIcon: (
@@ -25,47 +26,38 @@ export const useTabConfig = <T extends ParamListBase>({
25
26
  routeName: string,
26
27
  isFab: boolean,
27
28
  ) => {
28
- // If user provided a custom renderer, use it
29
29
  if (config.renderIcon) {
30
30
  return config.renderIcon(iconName, focused, routeName, isFab);
31
31
  }
32
32
 
33
- const screen = config.screens.find((s) => s.name === routeName);
34
- const fabConfig = config.fabConfig;
33
+ const screen = screens.find((s) => s.name === routeName);
34
+ const fab = config.fabConfig;
35
35
 
36
36
  if (isFab) {
37
- const size = fabConfig?.size ?? 84;
38
- return (
39
- <View
40
- style={{
41
- width: size,
42
- height: size,
43
- borderRadius: size / 2,
44
- backgroundColor: tokens.colors.primary,
45
- justifyContent: "center",
46
- alignItems: "center",
47
- marginTop: fabConfig?.offsetY ?? -32,
48
- }}
49
- >
50
- <AtomicIcon
51
- name={iconName}
52
- svgPath={screen?.svgPath}
53
- customSize={size * 0.57} // Approx 48/84 ratio
54
- customColor="#FFFFFF"
55
- />
56
- </View>
57
- );
37
+ const fabSize = fab?.size ?? 84;
38
+ return React.createElement(View, {
39
+ style: {
40
+ width: fabSize,
41
+ height: fabSize,
42
+ borderRadius: fabSize / 2,
43
+ backgroundColor: tokens.colors.primary,
44
+ justifyContent: "center",
45
+ alignItems: "center",
46
+ marginTop: fab?.offsetY ?? -32,
47
+ }
48
+ }, React.createElement(AtomicIcon, {
49
+ name: iconName,
50
+ svgPath: screen?.svgPath,
51
+ customSize: fabSize * 0.57,
52
+ customColor: "#FFFFFF"
53
+ }));
58
54
  }
59
55
 
60
- return (
61
- <AtomicIcon
62
- name={iconName}
63
- customColor={
64
- focused ? tokens.colors.primary : tokens.colors.textSecondary
65
- }
66
- size="lg"
67
- />
68
- );
56
+ return React.createElement(AtomicIcon, {
57
+ name: iconName,
58
+ customColor: focused ? tokens.colors.primary : tokens.colors.textSecondary,
59
+ size: "lg"
60
+ });
69
61
  },
70
62
  screenOptions: {
71
63
  tabBarActiveTintColor: tokens.colors.primary,
@@ -100,4 +92,4 @@ export const useTabConfig = <T extends ParamListBase>({
100
92
  }, [tokens, config, insets]);
101
93
 
102
94
  return finalConfig;
103
- };
95
+ }