@umituz/react-native-design-system 2.3.30 → 2.3.32
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 +8 -5
- package/src/molecules/animation/presentation/components/Fireworks.tsx +1 -1
- package/src/molecules/animation/presentation/components/__tests__/Fireworks.test.tsx +13 -17
- package/src/molecules/animation/presentation/hooks/__tests__/useAnimation.integration.test.ts +37 -43
- package/src/molecules/animation/presentation/hooks/__tests__/useGesture.test.ts +3 -6
- package/src/molecules/animation/presentation/hooks/__tests__/useSpringAnimation.test.ts +3 -7
- package/src/molecules/animation/presentation/hooks/__tests__/useTimingAnimation.test.ts +3 -6
- package/src/molecules/animation/presentation/hooks/__tests__/useTransformAnimation.test.ts +1 -5
- package/src/molecules/animation/presentation/hooks/useGesture.ts +1 -5
- package/src/molecules/animation/types/global.d.ts +1 -6
- package/src/molecules/countdown/components/Countdown.tsx +1 -3
- package/src/molecules/navigation/utils/AppNavigation.ts +3 -4
- package/src/molecules/navigation/utils/__tests__/NavigationValidator.test.ts +1 -1
- package/src/utilities/sharing/infrastructure/services/SharingService.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.32",
|
|
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",
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"@react-navigation/bottom-tabs": ">=6.0.0",
|
|
57
57
|
"@react-navigation/native": ">=6.0.0",
|
|
58
58
|
"@react-navigation/stack": ">=6.0.0",
|
|
59
|
-
"@umituz/react-native-haptics": "
|
|
60
|
-
"@umituz/react-native-localization": "
|
|
61
|
-
"@umituz/react-native-uuid": "
|
|
59
|
+
"@umituz/react-native-haptics": "*",
|
|
60
|
+
"@umituz/react-native-localization": "*",
|
|
61
|
+
"@umituz/react-native-uuid": "*",
|
|
62
62
|
"expo-application": ">=5.0.0",
|
|
63
63
|
"expo-clipboard": ">=8.0.0",
|
|
64
64
|
"expo-crypto": ">=13.0.0",
|
|
@@ -101,13 +101,16 @@
|
|
|
101
101
|
"@react-navigation/bottom-tabs": "^6.6.1",
|
|
102
102
|
"@react-navigation/native": "^6.0.0",
|
|
103
103
|
"@react-navigation/stack": "^6.4.1",
|
|
104
|
+
"@testing-library/react": "^16.3.1",
|
|
105
|
+
"@testing-library/react-native": "^13.3.3",
|
|
104
106
|
"@types/jest": "^30.0.0",
|
|
105
107
|
"@types/react": "~19.1.10",
|
|
108
|
+
"@types/react-native": "^0.72.8",
|
|
106
109
|
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
|
107
110
|
"@typescript-eslint/parser": "^8.50.1",
|
|
108
111
|
"@umituz/react-native-haptics": "^1.0.2",
|
|
109
112
|
"@umituz/react-native-localization": "^3.5.34",
|
|
110
|
-
"@umituz/react-native-uuid": "
|
|
113
|
+
"@umituz/react-native-uuid": "*",
|
|
111
114
|
"eslint": "^9.39.2",
|
|
112
115
|
"eslint-plugin-react": "^7.37.5",
|
|
113
116
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { render, fireEvent } from '@testing-library/react-native';
|
|
9
9
|
import { Fireworks } from '../Fireworks';
|
|
10
|
-
import {
|
|
10
|
+
import { useFireworks } from '../../hooks/useFireworks';
|
|
11
11
|
|
|
12
12
|
// Mock react-native-reanimated
|
|
13
13
|
jest.mock('react-native-reanimated', () => ({
|
|
@@ -61,8 +61,8 @@ describe('Fireworks Component', () => {
|
|
|
61
61
|
it('should apply custom styles', () => {
|
|
62
62
|
const customStyle = { backgroundColor: 'blue' };
|
|
63
63
|
const { getByTestId } = render(
|
|
64
|
-
<Fireworks
|
|
65
|
-
colors={['#FF0000']}
|
|
64
|
+
<Fireworks
|
|
65
|
+
colors={['#FF0000']}
|
|
66
66
|
style={customStyle}
|
|
67
67
|
/>
|
|
68
68
|
);
|
|
@@ -94,16 +94,15 @@ describe('Fireworks Component', () => {
|
|
|
94
94
|
describe('autoTrigger', () => {
|
|
95
95
|
it('should trigger fireworks when autoTrigger is true and container has size', () => {
|
|
96
96
|
const mockTrigger = jest.fn();
|
|
97
|
-
|
|
98
|
-
useFireworks.mockReturnValue({
|
|
97
|
+
(useFireworks as jest.Mock).mockReturnValue({
|
|
99
98
|
particles: [],
|
|
100
99
|
trigger: mockTrigger,
|
|
101
100
|
isActive: false,
|
|
102
101
|
});
|
|
103
102
|
|
|
104
103
|
const { getByTestId } = render(
|
|
105
|
-
<Fireworks
|
|
106
|
-
colors={['#FF0000']}
|
|
104
|
+
<Fireworks
|
|
105
|
+
colors={['#FF0000']}
|
|
107
106
|
autoTrigger={true}
|
|
108
107
|
/>
|
|
109
108
|
);
|
|
@@ -120,16 +119,15 @@ describe('Fireworks Component', () => {
|
|
|
120
119
|
|
|
121
120
|
it('should not trigger when autoTrigger is false', () => {
|
|
122
121
|
const mockTrigger = jest.fn();
|
|
123
|
-
|
|
124
|
-
useFireworks.mockReturnValue({
|
|
122
|
+
(useFireworks as jest.Mock).mockReturnValue({
|
|
125
123
|
particles: [],
|
|
126
124
|
trigger: mockTrigger,
|
|
127
125
|
isActive: false,
|
|
128
126
|
});
|
|
129
127
|
|
|
130
128
|
render(
|
|
131
|
-
<Fireworks
|
|
132
|
-
colors={['#FF0000']}
|
|
129
|
+
<Fireworks
|
|
130
|
+
colors={['#FF0000']}
|
|
133
131
|
autoTrigger={false}
|
|
134
132
|
/>
|
|
135
133
|
);
|
|
@@ -139,16 +137,15 @@ describe('Fireworks Component', () => {
|
|
|
139
137
|
|
|
140
138
|
it('should use custom trigger position', () => {
|
|
141
139
|
const mockTrigger = jest.fn();
|
|
142
|
-
|
|
143
|
-
useFireworks.mockReturnValue({
|
|
140
|
+
(useFireworks as jest.Mock).mockReturnValue({
|
|
144
141
|
particles: [],
|
|
145
142
|
trigger: mockTrigger,
|
|
146
143
|
isActive: false,
|
|
147
144
|
});
|
|
148
145
|
|
|
149
146
|
const { getByTestId } = render(
|
|
150
|
-
<Fireworks
|
|
151
|
-
colors={['#FF0000']}
|
|
147
|
+
<Fireworks
|
|
148
|
+
colors={['#FF0000']}
|
|
152
149
|
autoTrigger={true}
|
|
153
150
|
triggerX={0.25}
|
|
154
151
|
triggerY={0.75}
|
|
@@ -171,8 +168,7 @@ describe('Fireworks Component', () => {
|
|
|
171
168
|
const particles = [
|
|
172
169
|
{ x: 100, y: 100, color: '#FF0000', size: 4, life: 1 },
|
|
173
170
|
];
|
|
174
|
-
|
|
175
|
-
useFireworks.mockReturnValue({
|
|
171
|
+
(useFireworks as jest.Mock).mockReturnValue({
|
|
176
172
|
particles,
|
|
177
173
|
trigger: jest.fn(),
|
|
178
174
|
isActive: false,
|
package/src/molecules/animation/presentation/hooks/__tests__/useAnimation.integration.test.ts
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
import { renderHook, act } from '@testing-library/react';
|
|
8
8
|
import { useAnimation } from '../useAnimation';
|
|
9
|
+
import { useTimingAnimation } from '../useTimingAnimation';
|
|
10
|
+
import { useSpringAnimation } from '../useSpringAnimation';
|
|
11
|
+
import { useTransformAnimation } from '../useTransformAnimation';
|
|
12
|
+
import { useAnimatedStyle } from 'react-native-reanimated';
|
|
9
13
|
|
|
10
14
|
// Mock react-native-reanimated
|
|
11
15
|
jest.mock('react-native-reanimated', () => ({
|
|
@@ -25,39 +29,46 @@ jest.mock('react-native-reanimated', () => ({
|
|
|
25
29
|
},
|
|
26
30
|
}));
|
|
27
31
|
|
|
32
|
+
// Define singleton mock objects
|
|
33
|
+
const mockTiming = {
|
|
34
|
+
fadeIn: jest.fn(),
|
|
35
|
+
fadeOut: jest.fn(),
|
|
36
|
+
slideInUp: jest.fn(),
|
|
37
|
+
slideInDown: jest.fn(),
|
|
38
|
+
slideInLeft: jest.fn(),
|
|
39
|
+
slideInRight: jest.fn(),
|
|
40
|
+
opacity: { value: 1 },
|
|
41
|
+
translateY: { value: 0 },
|
|
42
|
+
translateX: { value: 0 },
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const mockSpring = {
|
|
46
|
+
scaleIn: jest.fn(),
|
|
47
|
+
scaleOut: jest.fn(),
|
|
48
|
+
bounce: jest.fn(),
|
|
49
|
+
scale: { value: 1 },
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const mockTransform = {
|
|
53
|
+
shake: jest.fn(),
|
|
54
|
+
pulse: jest.fn(),
|
|
55
|
+
spin: jest.fn(),
|
|
56
|
+
translateX: { value: 0 },
|
|
57
|
+
scale: { value: 1 },
|
|
58
|
+
rotate: { value: 0 },
|
|
59
|
+
};
|
|
60
|
+
|
|
28
61
|
// Mock all sub-hooks
|
|
29
62
|
jest.mock('../useTimingAnimation', () => ({
|
|
30
|
-
useTimingAnimation: jest.fn(() =>
|
|
31
|
-
fadeIn: jest.fn(),
|
|
32
|
-
fadeOut: jest.fn(),
|
|
33
|
-
slideInUp: jest.fn(),
|
|
34
|
-
slideInDown: jest.fn(),
|
|
35
|
-
slideInLeft: jest.fn(),
|
|
36
|
-
slideInRight: jest.fn(),
|
|
37
|
-
opacity: { value: 1 },
|
|
38
|
-
translateY: { value: 0 },
|
|
39
|
-
translateX: { value: 0 },
|
|
40
|
-
})),
|
|
63
|
+
useTimingAnimation: jest.fn(() => mockTiming),
|
|
41
64
|
}));
|
|
42
65
|
|
|
43
66
|
jest.mock('../useSpringAnimation', () => ({
|
|
44
|
-
useSpringAnimation: jest.fn(() =>
|
|
45
|
-
scaleIn: jest.fn(),
|
|
46
|
-
scaleOut: jest.fn(),
|
|
47
|
-
bounce: jest.fn(),
|
|
48
|
-
scale: { value: 1 },
|
|
49
|
-
})),
|
|
67
|
+
useSpringAnimation: jest.fn(() => mockSpring),
|
|
50
68
|
}));
|
|
51
69
|
|
|
52
70
|
jest.mock('../useTransformAnimation', () => ({
|
|
53
|
-
useTransformAnimation: jest.fn(() =>
|
|
54
|
-
shake: jest.fn(),
|
|
55
|
-
pulse: jest.fn(),
|
|
56
|
-
spin: jest.fn(),
|
|
57
|
-
translateX: { value: 0 },
|
|
58
|
-
scale: { value: 1 },
|
|
59
|
-
rotate: { value: 0 },
|
|
60
|
-
})),
|
|
71
|
+
useTransformAnimation: jest.fn(() => mockTransform),
|
|
61
72
|
}));
|
|
62
73
|
|
|
63
74
|
describe('useAnimation Integration', () => {
|
|
@@ -66,10 +77,6 @@ describe('useAnimation Integration', () => {
|
|
|
66
77
|
});
|
|
67
78
|
|
|
68
79
|
it('should integrate all animation hooks', () => {
|
|
69
|
-
const { useTimingAnimation } = require('../useTimingAnimation');
|
|
70
|
-
const { useSpringAnimation } = require('../useSpringAnimation');
|
|
71
|
-
const { useTransformAnimation } = require('../useTransformAnimation');
|
|
72
|
-
|
|
73
80
|
renderHook(() => useAnimation());
|
|
74
81
|
|
|
75
82
|
expect(useTimingAnimation).toHaveBeenCalled();
|
|
@@ -116,7 +123,6 @@ describe('useAnimation Integration', () => {
|
|
|
116
123
|
|
|
117
124
|
it('should provide animated style', () => {
|
|
118
125
|
const { result } = renderHook(() => useAnimation());
|
|
119
|
-
const { useAnimatedStyle } = require('react-native-reanimated');
|
|
120
126
|
|
|
121
127
|
expect(typeof result.current.animatedStyle).toBe('function');
|
|
122
128
|
expect(useAnimatedStyle).toHaveBeenCalled();
|
|
@@ -125,8 +131,6 @@ describe('useAnimation Integration', () => {
|
|
|
125
131
|
describe('animation combinations', () => {
|
|
126
132
|
it('should allow combining fade and scale animations', () => {
|
|
127
133
|
const { result } = renderHook(() => useAnimation());
|
|
128
|
-
const mockTiming = require('../useTimingAnimation').useTimingAnimation();
|
|
129
|
-
const mockSpring = require('../useSpringAnimation').useSpringAnimation();
|
|
130
134
|
|
|
131
135
|
act(() => {
|
|
132
136
|
result.current.fadeIn();
|
|
@@ -139,8 +143,6 @@ describe('useAnimation Integration', () => {
|
|
|
139
143
|
|
|
140
144
|
it('should allow combining slide and rotate animations', () => {
|
|
141
145
|
const { result } = renderHook(() => useAnimation());
|
|
142
|
-
const mockTiming = require('../useTimingAnimation').useTimingAnimation();
|
|
143
|
-
const mockTransform = require('../useTransformAnimation').useTransformAnimation();
|
|
144
146
|
|
|
145
147
|
act(() => {
|
|
146
148
|
result.current.slideInUp();
|
|
@@ -153,9 +155,6 @@ describe('useAnimation Integration', () => {
|
|
|
153
155
|
|
|
154
156
|
it('should allow complex animation sequences', () => {
|
|
155
157
|
const { result } = renderHook(() => useAnimation());
|
|
156
|
-
const mockTiming = require('../useTimingAnimation').useTimingAnimation();
|
|
157
|
-
const mockSpring = require('../useSpringAnimation').useSpringAnimation();
|
|
158
|
-
const mockTransform = require('../useTransformAnimation').useTransformAnimation();
|
|
159
158
|
|
|
160
159
|
act(() => {
|
|
161
160
|
result.current.fadeIn();
|
|
@@ -179,7 +178,6 @@ describe('useAnimation Integration', () => {
|
|
|
179
178
|
|
|
180
179
|
describe('animated style composition', () => {
|
|
181
180
|
it('should compose styles from all animation types', () => {
|
|
182
|
-
const { useAnimatedStyle } = require('react-native-reanimated');
|
|
183
181
|
const mockStyle = {
|
|
184
182
|
opacity: 1,
|
|
185
183
|
transform: [
|
|
@@ -190,7 +188,7 @@ describe('useAnimation Integration', () => {
|
|
|
190
188
|
],
|
|
191
189
|
};
|
|
192
190
|
|
|
193
|
-
useAnimatedStyle.mockReturnValue(mockStyle);
|
|
191
|
+
(useAnimatedStyle as jest.Mock).mockReturnValue(mockStyle);
|
|
194
192
|
|
|
195
193
|
const { result } = renderHook(() => useAnimation());
|
|
196
194
|
|
|
@@ -198,10 +196,6 @@ describe('useAnimation Integration', () => {
|
|
|
198
196
|
});
|
|
199
197
|
|
|
200
198
|
it('should prioritize transform values over timing/spring values', () => {
|
|
201
|
-
const { useAnimatedStyle } = require('react-native-reanimated');
|
|
202
|
-
const mockTiming = require('../useTimingAnimation').useTimingAnimation();
|
|
203
|
-
const mockTransform = require('../useTransformAnimation').useTransformAnimation();
|
|
204
|
-
|
|
205
199
|
// Set transform values to non-default
|
|
206
200
|
mockTransform.translateX.value = 50;
|
|
207
201
|
mockTransform.scale.value = 1.5;
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { renderHook } from '@testing-library/react';
|
|
8
|
+
import { GestureDetector } from 'react-native-gesture-handler';
|
|
8
9
|
import { useGesture } from '../useGesture';
|
|
10
|
+
import { useGestureCreators } from '../useGestureCreators';
|
|
11
|
+
import { useGestureState } from '../useGestureState';
|
|
9
12
|
|
|
10
13
|
// Mock react-native-gesture-handler
|
|
11
14
|
jest.mock('react-native-gesture-handler', () => ({
|
|
@@ -39,9 +42,6 @@ jest.mock('../useGestureState', () => ({
|
|
|
39
42
|
translateX: { value: 0 },
|
|
40
43
|
translateY: { value: 0 },
|
|
41
44
|
scale: { value: 1 },
|
|
42
|
-
savedTranslateX: { value: 0 },
|
|
43
|
-
savedTranslateY: { value: 0 },
|
|
44
|
-
savedScale: { value: 1 },
|
|
45
45
|
reset: jest.fn(),
|
|
46
46
|
animatedStyle: {},
|
|
47
47
|
})),
|
|
@@ -88,21 +88,18 @@ describe('useGesture', () => {
|
|
|
88
88
|
|
|
89
89
|
it('should export GestureDetector', () => {
|
|
90
90
|
const { result } = renderHook(() => useGesture());
|
|
91
|
-
const { GestureDetector } = require('react-native-gesture-handler');
|
|
92
91
|
|
|
93
92
|
expect(result.current.GestureDetector).toBe(GestureDetector);
|
|
94
93
|
});
|
|
95
94
|
|
|
96
95
|
describe('gesture creators integration', () => {
|
|
97
96
|
it('should integrate with useGestureCreators', () => {
|
|
98
|
-
const { useGestureCreators } = require('../useGestureCreators');
|
|
99
97
|
renderHook(() => useGesture());
|
|
100
98
|
|
|
101
99
|
expect(useGestureCreators).toHaveBeenCalled();
|
|
102
100
|
});
|
|
103
101
|
|
|
104
102
|
it('should integrate with useGestureState', () => {
|
|
105
|
-
const { useGestureState } = require('../useGestureState');
|
|
106
103
|
renderHook(() => useGesture());
|
|
107
104
|
|
|
108
105
|
expect(useGestureState).toHaveBeenCalled();
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
import { renderHook, act } from '@testing-library/react';
|
|
8
8
|
import { useSpringAnimation } from '../useSpringAnimation';
|
|
9
|
-
import {
|
|
9
|
+
import { ANIMATION_CONSTANTS } from '../../../domain/entities/Animation';
|
|
10
|
+
import { withSpring, withSequence } from 'react-native-reanimated';
|
|
10
11
|
|
|
11
12
|
// Mock react-native-reanimated
|
|
12
13
|
jest.mock('react-native-reanimated', () => ({
|
|
@@ -21,7 +22,7 @@ jest.mock('react-native-reanimated', () => ({
|
|
|
21
22
|
// Mock SpringAnimationConfigService
|
|
22
23
|
jest.mock('../../../infrastructure/services/SpringAnimationConfigService', () => ({
|
|
23
24
|
SpringAnimationConfigService: {
|
|
24
|
-
getSpringConfig: jest.fn((
|
|
25
|
+
getSpringConfig: jest.fn(() => ({
|
|
25
26
|
damping: ANIMATION_CONSTANTS.SPRING.DAMPING,
|
|
26
27
|
stiffness: ANIMATION_CONSTANTS.SPRING.STIFFNESS,
|
|
27
28
|
})),
|
|
@@ -50,7 +51,6 @@ describe('useSpringAnimation', () => {
|
|
|
50
51
|
describe('scaleIn', () => {
|
|
51
52
|
it('should animate scale from 0 to 1 with default config', () => {
|
|
52
53
|
const { result } = renderHook(() => useSpringAnimation());
|
|
53
|
-
const { withSpring } = require('react-native-reanimated');
|
|
54
54
|
|
|
55
55
|
act(() => {
|
|
56
56
|
result.current.scaleIn();
|
|
@@ -64,7 +64,6 @@ describe('useSpringAnimation', () => {
|
|
|
64
64
|
|
|
65
65
|
it('should use custom config when provided', () => {
|
|
66
66
|
const { result } = renderHook(() => useSpringAnimation());
|
|
67
|
-
const { withSpring } = require('react-native-reanimated');
|
|
68
67
|
const customConfig = { damping: 20, stiffness: 200 };
|
|
69
68
|
|
|
70
69
|
act(() => {
|
|
@@ -78,7 +77,6 @@ describe('useSpringAnimation', () => {
|
|
|
78
77
|
describe('scaleOut', () => {
|
|
79
78
|
it('should animate scale to 0 with default config', () => {
|
|
80
79
|
const { result } = renderHook(() => useSpringAnimation());
|
|
81
|
-
const { withSpring } = require('react-native-reanimated');
|
|
82
80
|
|
|
83
81
|
act(() => {
|
|
84
82
|
result.current.scaleOut();
|
|
@@ -94,7 +92,6 @@ describe('useSpringAnimation', () => {
|
|
|
94
92
|
describe('bounce', () => {
|
|
95
93
|
it('should create bounce animation sequence', () => {
|
|
96
94
|
const { result } = renderHook(() => useSpringAnimation());
|
|
97
|
-
const { withSpring, withSequence } = require('react-native-reanimated');
|
|
98
95
|
const mockConfig = { damping: 5, stiffness: 120 };
|
|
99
96
|
|
|
100
97
|
act(() => {
|
|
@@ -110,7 +107,6 @@ describe('useSpringAnimation', () => {
|
|
|
110
107
|
|
|
111
108
|
it('should use default config when none provided', () => {
|
|
112
109
|
const { result } = renderHook(() => useSpringAnimation());
|
|
113
|
-
const { withSpring, withSequence } = require('react-native-reanimated');
|
|
114
110
|
|
|
115
111
|
act(() => {
|
|
116
112
|
result.current.bounce();
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
import { renderHook, act } from '@testing-library/react';
|
|
8
8
|
import { useTimingAnimation } from '../useTimingAnimation';
|
|
9
|
-
import {
|
|
9
|
+
import { ANIMATION_CONSTANTS } from '../../../domain/entities/Animation';
|
|
10
|
+
import { withTiming } from 'react-native-reanimated';
|
|
10
11
|
|
|
11
12
|
// Mock react-native-reanimated
|
|
12
13
|
jest.mock('react-native-reanimated', () => ({
|
|
@@ -25,7 +26,7 @@ jest.mock('react-native-reanimated', () => ({
|
|
|
25
26
|
// Mock AnimationConfigService
|
|
26
27
|
jest.mock('../../../infrastructure/services/TimingAnimationConfigService', () => ({
|
|
27
28
|
TimingAnimationConfigService: {
|
|
28
|
-
getTimingConfig: jest.fn((
|
|
29
|
+
getTimingConfig: jest.fn(() => ({
|
|
29
30
|
duration: ANIMATION_CONSTANTS.DURATION.NORMAL,
|
|
30
31
|
})),
|
|
31
32
|
},
|
|
@@ -58,7 +59,6 @@ describe('useTimingAnimation', () => {
|
|
|
58
59
|
describe('fadeIn', () => {
|
|
59
60
|
it('should animate opacity to 1 with default config', () => {
|
|
60
61
|
const { result } = renderHook(() => useTimingAnimation());
|
|
61
|
-
const { withTiming } = require('react-native-reanimated');
|
|
62
62
|
|
|
63
63
|
act(() => {
|
|
64
64
|
result.current.fadeIn();
|
|
@@ -72,7 +72,6 @@ describe('useTimingAnimation', () => {
|
|
|
72
72
|
|
|
73
73
|
it('should use custom config when provided', () => {
|
|
74
74
|
const { result } = renderHook(() => useTimingAnimation());
|
|
75
|
-
const { withTiming } = require('react-native-reanimated');
|
|
76
75
|
const customConfig = { duration: 500 };
|
|
77
76
|
|
|
78
77
|
act(() => {
|
|
@@ -86,7 +85,6 @@ describe('useTimingAnimation', () => {
|
|
|
86
85
|
describe('fadeOut', () => {
|
|
87
86
|
it('should animate opacity to 0 with default config', () => {
|
|
88
87
|
const { result } = renderHook(() => useTimingAnimation());
|
|
89
|
-
const { withTiming } = require('react-native-reanimated');
|
|
90
88
|
|
|
91
89
|
act(() => {
|
|
92
90
|
result.current.fadeOut();
|
|
@@ -102,7 +100,6 @@ describe('useTimingAnimation', () => {
|
|
|
102
100
|
describe('slideInUp', () => {
|
|
103
101
|
it('should slide from bottom to top with default distance', () => {
|
|
104
102
|
const { result } = renderHook(() => useTimingAnimation());
|
|
105
|
-
const { withTiming } = require('react-native-reanimated');
|
|
106
103
|
|
|
107
104
|
act(() => {
|
|
108
105
|
result.current.slideInUp();
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { renderHook, act } from '@testing-library/react';
|
|
8
8
|
import { useTransformAnimation } from '../useTransformAnimation';
|
|
9
|
+
import { withTiming, withSequence, withRepeat, Easing } from 'react-native-reanimated';
|
|
9
10
|
|
|
10
11
|
// Mock react-native-reanimated
|
|
11
12
|
jest.mock('react-native-reanimated', () => ({
|
|
@@ -45,7 +46,6 @@ describe('useTransformAnimation', () => {
|
|
|
45
46
|
describe('shake', () => {
|
|
46
47
|
it('should create shake animation sequence', () => {
|
|
47
48
|
const { result } = renderHook(() => useTransformAnimation());
|
|
48
|
-
const { withTiming, withSequence, withRepeat } = require('react-native-reanimated');
|
|
49
49
|
|
|
50
50
|
act(() => {
|
|
51
51
|
result.current.shake();
|
|
@@ -62,7 +62,6 @@ describe('useTransformAnimation', () => {
|
|
|
62
62
|
describe('pulse', () => {
|
|
63
63
|
it('should create pulse animation with default repeat count', () => {
|
|
64
64
|
const { result } = renderHook(() => useTransformAnimation());
|
|
65
|
-
const { withTiming, withSequence, withRepeat } = require('react-native-reanimated');
|
|
66
65
|
|
|
67
66
|
act(() => {
|
|
68
67
|
result.current.pulse();
|
|
@@ -77,7 +76,6 @@ describe('useTransformAnimation', () => {
|
|
|
77
76
|
|
|
78
77
|
it('should use custom repeat count', () => {
|
|
79
78
|
const { result } = renderHook(() => useTransformAnimation());
|
|
80
|
-
const { withTiming, withSequence, withRepeat } = require('react-native-reanimated');
|
|
81
79
|
const customRepeatCount = 3;
|
|
82
80
|
|
|
83
81
|
act(() => {
|
|
@@ -95,7 +93,6 @@ describe('useTransformAnimation', () => {
|
|
|
95
93
|
describe('spin', () => {
|
|
96
94
|
it('should create spin animation with default repeat count', () => {
|
|
97
95
|
const { result } = renderHook(() => useTransformAnimation());
|
|
98
|
-
const { withTiming, withRepeat, Easing } = require('react-native-reanimated');
|
|
99
96
|
|
|
100
97
|
act(() => {
|
|
101
98
|
result.current.spin();
|
|
@@ -110,7 +107,6 @@ describe('useTransformAnimation', () => {
|
|
|
110
107
|
|
|
111
108
|
it('should use custom repeat count', () => {
|
|
112
109
|
const { result } = renderHook(() => useTransformAnimation());
|
|
113
|
-
const { withTiming, withRepeat } = require('react-native-reanimated');
|
|
114
110
|
const customRepeatCount = 2;
|
|
115
111
|
|
|
116
112
|
act(() => {
|
|
@@ -8,11 +8,7 @@
|
|
|
8
8
|
import { GestureDetector } from 'react-native-gesture-handler';
|
|
9
9
|
import { useGestureState } from './useGestureState';
|
|
10
10
|
import { useGestureCreators } from './useGestureCreators';
|
|
11
|
-
|
|
12
|
-
TapGestureOptions,
|
|
13
|
-
PanGestureOptions,
|
|
14
|
-
PinchGestureOptions,
|
|
15
|
-
} from './useGestureCreators';
|
|
11
|
+
|
|
16
12
|
|
|
17
13
|
/**
|
|
18
14
|
* Hook for gesture handling
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react-native" />
|
|
3
|
-
|
|
4
1
|
declare module 'react-native-reanimated' {
|
|
5
2
|
import React from 'react';
|
|
6
|
-
import { ViewProps, ViewStyle } from 'react-native';
|
|
7
3
|
|
|
8
4
|
export interface WithTimingConfig {
|
|
9
5
|
duration?: number;
|
|
@@ -39,7 +35,7 @@ declare module 'react-native-reanimated' {
|
|
|
39
35
|
export function runOnUI<T>(fn: () => T): () => T;
|
|
40
36
|
export function runOnJS<T extends (...args: any[]) => any>(fn: T): T;
|
|
41
37
|
export function cancelAnimation(sharedValue: SharedValue<any>): void;
|
|
42
|
-
|
|
38
|
+
|
|
43
39
|
export const Easing: {
|
|
44
40
|
linear: (t: number) => number;
|
|
45
41
|
ease: (t: number) => number;
|
|
@@ -58,7 +54,6 @@ declare module 'react-native-reanimated' {
|
|
|
58
54
|
|
|
59
55
|
declare module 'react-native-gesture-handler' {
|
|
60
56
|
import React from 'react';
|
|
61
|
-
import { ViewStyle } from 'react-native';
|
|
62
57
|
|
|
63
58
|
export interface PanGestureHandlerProps {
|
|
64
59
|
onGestureEvent?: (event: any) => void;
|
|
@@ -28,10 +28,8 @@ export const Countdown: React.FC<CountdownProps> = ({
|
|
|
28
28
|
}) => {
|
|
29
29
|
const tokens = useAppDesignTokens();
|
|
30
30
|
const {
|
|
31
|
-
showIcon = true,
|
|
32
31
|
showLabel = true,
|
|
33
32
|
showToggle = alternateTargets.length > 0,
|
|
34
|
-
layout = 'grid',
|
|
35
33
|
size = 'medium',
|
|
36
34
|
showDays,
|
|
37
35
|
showHours = true,
|
|
@@ -63,7 +61,7 @@ export const Countdown: React.FC<CountdownProps> = ({
|
|
|
63
61
|
}
|
|
64
62
|
};
|
|
65
63
|
|
|
66
|
-
const defaultFormatLabel = (unit: 'days' | 'hours' | 'minutes' | 'seconds'
|
|
64
|
+
const defaultFormatLabel = (unit: 'days' | 'hours' | 'minutes' | 'seconds') => {
|
|
67
65
|
const labels = {
|
|
68
66
|
days: 'DAYS',
|
|
69
67
|
hours: 'HOURS',
|
|
@@ -81,10 +81,9 @@ export class AppNavigation {
|
|
|
81
81
|
* Navigate to a screen in a nested navigator (e.g. Tab > Stack > Screen)
|
|
82
82
|
*/
|
|
83
83
|
static navigateToNested(parentParams: { screen: string; params?: any }): void {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
// Kept simple for now.
|
|
84
|
+
if (this.navigationRef?.isReady()) {
|
|
85
|
+
this.navigationRef.navigate(parentParams.screen, parentParams.params);
|
|
86
|
+
}
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
/**
|