@umituz/react-native-design-system 2.9.34 → 2.9.36

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.9.34",
3
+ "version": "2.9.36",
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, onboarding, and loading utilities",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -106,15 +106,18 @@ export const CircularMenu: React.FC<CircularMenuProps> = ({
106
106
  <CircularMenuBackground />
107
107
 
108
108
  <View style={styles.itemsContainer}>
109
- {layoutItems.map((item) => (
110
- <View key={item.id} style={item.position as ViewStyle}>
111
- <CircularMenuItem
112
- icon={item.icon}
113
- label={item.label}
114
- onPress={item.onPress}
115
- />
116
- </View>
117
- ))}
109
+ {layoutItems.map((item) => {
110
+ if (!item.icon || !item.label || !item.onPress) return null;
111
+ return (
112
+ <View key={item.id} style={item.position as ViewStyle}>
113
+ <CircularMenuItem
114
+ icon={item.icon}
115
+ label={item.label}
116
+ onPress={item.onPress}
117
+ />
118
+ </View>
119
+ );
120
+ })}
118
121
 
119
122
  <View style={styles.closeButton}>
120
123
  <CircularMenuCloseButton onPress={onClose} />
@@ -2,24 +2,27 @@
2
2
  * Performance optimization utilities for safe area hooks
3
3
  */
4
4
 
5
- import { useMemo, useRef } from 'react';
6
- import { clearValidationCache } from './validation';
5
+ import { useMemo, useRef } from "react";
6
+ import { clearValidationCache } from "./validation";
7
7
 
8
8
  /**
9
9
  * Memoize options object to prevent unnecessary re-renders
10
- * Uses deep comparison for better stability
10
+ * Uses shallow comparison for better performance
11
11
  */
12
- export const useStableOptions = <T extends Record<string, any>>(options: T): T => {
12
+ export const useStableOptions = <T extends Record<string, any>>(
13
+ options: T,
14
+ ): T => {
13
15
  const prevOptionsRef = useRef<T | undefined>(undefined);
14
16
 
15
17
  return useMemo(() => {
16
- if (!prevOptionsRef.current) {
18
+ const prev = prevOptionsRef.current;
19
+
20
+ if (!prev) {
17
21
  prevOptionsRef.current = options;
18
22
  return options;
19
23
  }
20
24
 
21
- // Check if keys match first
22
- const prevKeys = Object.keys(prevOptionsRef.current);
25
+ const prevKeys = Object.keys(prev);
23
26
  const currentKeys = Object.keys(options);
24
27
 
25
28
  if (prevKeys.length !== currentKeys.length) {
@@ -27,14 +30,13 @@ export const useStableOptions = <T extends Record<string, any>>(options: T): T =
27
30
  return options;
28
31
  }
29
32
 
30
- // Check values
31
- const hasChanged = prevKeys.some(key => prevOptionsRef.current![key] !== options[key]);
33
+ const hasChanged = prevKeys.some((key) => prev[key] !== options[key]);
32
34
 
33
35
  if (hasChanged) {
34
36
  prevOptionsRef.current = options;
35
37
  }
36
38
 
37
- return prevOptionsRef.current;
39
+ return prevOptionsRef.current ?? options;
38
40
  }, [options]);
39
41
  };
40
42
 
@@ -44,4 +46,4 @@ export const useStableOptions = <T extends Record<string, any>>(options: T): T =
44
46
  */
45
47
  export const clearPerformanceCaches = (): void => {
46
48
  clearValidationCache();
47
- };
49
+ };