@umituz/react-native-design-system 2.3.37 → 2.3.38

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.3.37",
3
+ "version": "2.3.38",
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",
@@ -41,7 +41,7 @@ export const useFireworks = (config: FireworksConfig) => {
41
41
  if (__DEV__) {
42
42
  console.warn('useFireworks: colors array is required and cannot be empty');
43
43
  }
44
- return { particles: [], trigger: () => {}, isActive: false };
44
+ return { particles: [], trigger: () => { }, isActive: false };
45
45
  }
46
46
 
47
47
  const createParticle = useCallback((
@@ -51,7 +51,7 @@ export const useFireworks = (config: FireworksConfig) => {
51
51
  ): ParticleConfig => {
52
52
  const angle = Math.random() * Math.PI * 2;
53
53
  const velocity = Math.random() * spread + 50;
54
-
54
+
55
55
  return {
56
56
  x,
57
57
  y,
@@ -64,6 +64,8 @@ export const useFireworks = (config: FireworksConfig) => {
64
64
  };
65
65
  }, [particleSize, spread]);
66
66
 
67
+ const isActiveRef = useRef(false);
68
+
67
69
  const updateParticles = useCallback(() => {
68
70
  const currentParticles = [...particlesRef.current];
69
71
  const updated: ParticleConfig[] = [];
@@ -88,12 +90,13 @@ export const useFireworks = (config: FireworksConfig) => {
88
90
  particlesRef.current = updated;
89
91
  setParticles(updated);
90
92
 
91
- if (updated.length > 0 && isActive) {
93
+ if (updated.length > 0 && isActiveRef.current) {
92
94
  animationFrameRef.current = requestAnimationFrame(updateParticles);
93
95
  } else {
94
96
  setIsActive(false);
97
+ isActiveRef.current = false;
95
98
  }
96
- }, [isActive]);
99
+ }, [setIsActive]); // Removed isActive dependency
97
100
 
98
101
  const trigger = useCallback((x?: number, y?: number) => {
99
102
  const centerX = x ?? 0;
@@ -110,6 +113,7 @@ export const useFireworks = (config: FireworksConfig) => {
110
113
  particlesRef.current = particlesArray;
111
114
  setParticles(particlesArray);
112
115
  setIsActive(true);
116
+ isActiveRef.current = true;
113
117
 
114
118
  if (animationFrameRef.current) {
115
119
  cancelAnimationFrame(animationFrameRef.current);