vitest-native 0.2.0 → 0.3.0
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/CHANGELOG.md +20 -0
- package/README.md +31 -1
- package/dist/helpers.cjs +10 -0
- package/dist/helpers.d.cts +7 -1
- package/dist/helpers.d.mts +7 -1
- package/dist/helpers.mjs +10 -1
- package/dist/index.cjs +58 -28
- package/dist/index.mjs +57 -28
- package/dist/{preset-map-D224CC5w.mjs → preset-map-BTpoNH3G.mjs} +1 -0
- package/dist/{preset-map-Bt4dXkZO.cjs → preset-map-DxU6UgYS.cjs} +1 -0
- package/dist/{presets-D4jrt194.cjs → presets-B-spxZz7.cjs} +431 -75
- package/dist/{presets-C9tAPD15.mjs → presets-DvrcfEPz.mjs} +431 -75
- package/dist/presets.cjs +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/setup.cjs +719 -85
- package/dist/setup.mjs +719 -85
- package/package.json +4 -1
|
@@ -13,6 +13,10 @@ function reanimated() {
|
|
|
13
13
|
"useDerivedValue",
|
|
14
14
|
"useAnimatedScrollHandler",
|
|
15
15
|
"useAnimatedGestureHandler",
|
|
16
|
+
"useAnimatedReaction",
|
|
17
|
+
"useAnimatedKeyboard",
|
|
18
|
+
"useReducedMotion",
|
|
19
|
+
"useFrameCallback",
|
|
16
20
|
"withTiming",
|
|
17
21
|
"withSpring",
|
|
18
22
|
"withDecay",
|
|
@@ -25,15 +29,69 @@ function reanimated() {
|
|
|
25
29
|
"Easing",
|
|
26
30
|
"FadeIn",
|
|
27
31
|
"FadeOut",
|
|
32
|
+
"FadeInDown",
|
|
33
|
+
"FadeInUp",
|
|
34
|
+
"FadeInLeft",
|
|
35
|
+
"FadeInRight",
|
|
36
|
+
"FadeOutDown",
|
|
37
|
+
"FadeOutUp",
|
|
38
|
+
"FadeOutLeft",
|
|
39
|
+
"FadeOutRight",
|
|
28
40
|
"SlideInRight",
|
|
41
|
+
"SlideInLeft",
|
|
42
|
+
"SlideInUp",
|
|
43
|
+
"SlideInDown",
|
|
44
|
+
"SlideOutRight",
|
|
29
45
|
"SlideOutLeft",
|
|
46
|
+
"SlideOutUp",
|
|
47
|
+
"SlideOutDown",
|
|
48
|
+
"ZoomIn",
|
|
49
|
+
"ZoomOut",
|
|
50
|
+
"BounceIn",
|
|
51
|
+
"BounceOut",
|
|
52
|
+
"BounceInDown",
|
|
53
|
+
"BounceInUp",
|
|
54
|
+
"BounceInLeft",
|
|
55
|
+
"BounceInRight",
|
|
56
|
+
"FlipInEasyX",
|
|
57
|
+
"FlipInEasyY",
|
|
58
|
+
"FlipOutEasyX",
|
|
59
|
+
"FlipOutEasyY",
|
|
60
|
+
"LightSpeedInLeft",
|
|
61
|
+
"LightSpeedInRight",
|
|
62
|
+
"LightSpeedOutLeft",
|
|
63
|
+
"LightSpeedOutRight",
|
|
64
|
+
"PinwheelIn",
|
|
65
|
+
"PinwheelOut",
|
|
66
|
+
"StretchInX",
|
|
67
|
+
"StretchInY",
|
|
68
|
+
"StretchOutX",
|
|
69
|
+
"StretchOutY",
|
|
70
|
+
"RotateInDownLeft",
|
|
71
|
+
"RotateInDownRight",
|
|
72
|
+
"RotateInUpLeft",
|
|
73
|
+
"RotateInUpRight",
|
|
74
|
+
"RotateOutDownLeft",
|
|
75
|
+
"RotateOutDownRight",
|
|
76
|
+
"RotateOutUpLeft",
|
|
77
|
+
"RotateOutUpRight",
|
|
30
78
|
"Layout",
|
|
79
|
+
"LinearTransition",
|
|
80
|
+
"SequencedTransition",
|
|
81
|
+
"FadingTransition",
|
|
82
|
+
"JumpingTransition",
|
|
83
|
+
"CurvedTransition",
|
|
84
|
+
"EntryExitTransition",
|
|
31
85
|
"interpolate",
|
|
32
86
|
"Extrapolation",
|
|
33
87
|
"useAnimatedRef",
|
|
34
88
|
"measure",
|
|
35
89
|
"scrollTo",
|
|
36
|
-
"cancelAnimation"
|
|
90
|
+
"cancelAnimation",
|
|
91
|
+
"makeMutable",
|
|
92
|
+
"SharedTransition",
|
|
93
|
+
"ReduceMotion",
|
|
94
|
+
"KeyboardState"
|
|
37
95
|
],
|
|
38
96
|
factory: () => {
|
|
39
97
|
function createSharedValue(init) {
|
|
@@ -78,6 +136,23 @@ function reanimated() {
|
|
|
78
136
|
function useAnimatedGestureHandler(_handler) {
|
|
79
137
|
return vi.fn();
|
|
80
138
|
}
|
|
139
|
+
function useAnimatedReaction(_prepare, _react, _deps) {}
|
|
140
|
+
function useAnimatedKeyboard() {
|
|
141
|
+
return {
|
|
142
|
+
state: createSharedValue(0),
|
|
143
|
+
height: createSharedValue(0)
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function useReducedMotion() {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
function useFrameCallback(_callback, _autostart) {
|
|
150
|
+
return {
|
|
151
|
+
setActive: vi.fn(),
|
|
152
|
+
isActive: false,
|
|
153
|
+
callbackId: 0
|
|
154
|
+
};
|
|
155
|
+
}
|
|
81
156
|
function withTiming(toValue, _config, callback) {
|
|
82
157
|
callback?.({
|
|
83
158
|
finished: true,
|
|
@@ -124,6 +199,24 @@ function reanimated() {
|
|
|
124
199
|
Animated.displayName = `Animated(${component.displayName || component.name || "Component"})`;
|
|
125
200
|
return Animated;
|
|
126
201
|
}
|
|
202
|
+
function createLayoutAnim() {
|
|
203
|
+
const obj = {};
|
|
204
|
+
obj.duration = vi.fn().mockReturnValue(obj);
|
|
205
|
+
obj.delay = vi.fn().mockReturnValue(obj);
|
|
206
|
+
obj.easing = vi.fn().mockReturnValue(obj);
|
|
207
|
+
obj.damping = vi.fn().mockReturnValue(obj);
|
|
208
|
+
obj.stiffness = vi.fn().mockReturnValue(obj);
|
|
209
|
+
obj.mass = vi.fn().mockReturnValue(obj);
|
|
210
|
+
obj.overshootClamping = vi.fn().mockReturnValue(obj);
|
|
211
|
+
obj.restDisplacementThreshold = vi.fn().mockReturnValue(obj);
|
|
212
|
+
obj.restSpeedThreshold = vi.fn().mockReturnValue(obj);
|
|
213
|
+
obj.springify = vi.fn().mockReturnValue(obj);
|
|
214
|
+
obj.withCallback = vi.fn().mockReturnValue(obj);
|
|
215
|
+
obj.withInitialValues = vi.fn().mockReturnValue(obj);
|
|
216
|
+
obj.randomDelay = vi.fn().mockReturnValue(obj);
|
|
217
|
+
obj.build = vi.fn();
|
|
218
|
+
return obj;
|
|
219
|
+
}
|
|
127
220
|
return {
|
|
128
221
|
default: { createAnimatedComponent },
|
|
129
222
|
useSharedValue,
|
|
@@ -132,6 +225,10 @@ function reanimated() {
|
|
|
132
225
|
useDerivedValue,
|
|
133
226
|
useAnimatedScrollHandler,
|
|
134
227
|
useAnimatedGestureHandler,
|
|
228
|
+
useAnimatedReaction,
|
|
229
|
+
useAnimatedKeyboard,
|
|
230
|
+
useReducedMotion,
|
|
231
|
+
useFrameCallback,
|
|
135
232
|
withTiming,
|
|
136
233
|
withSpring,
|
|
137
234
|
withDecay,
|
|
@@ -151,28 +248,61 @@ function reanimated() {
|
|
|
151
248
|
out: vi.fn((fn) => fn),
|
|
152
249
|
inOut: vi.fn((fn) => fn)
|
|
153
250
|
},
|
|
154
|
-
FadeIn:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
SlideInRight:
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
251
|
+
FadeIn: createLayoutAnim(),
|
|
252
|
+
FadeOut: createLayoutAnim(),
|
|
253
|
+
FadeInDown: createLayoutAnim(),
|
|
254
|
+
FadeInUp: createLayoutAnim(),
|
|
255
|
+
FadeInLeft: createLayoutAnim(),
|
|
256
|
+
FadeInRight: createLayoutAnim(),
|
|
257
|
+
FadeOutDown: createLayoutAnim(),
|
|
258
|
+
FadeOutUp: createLayoutAnim(),
|
|
259
|
+
FadeOutLeft: createLayoutAnim(),
|
|
260
|
+
FadeOutRight: createLayoutAnim(),
|
|
261
|
+
SlideInRight: createLayoutAnim(),
|
|
262
|
+
SlideInLeft: createLayoutAnim(),
|
|
263
|
+
SlideInUp: createLayoutAnim(),
|
|
264
|
+
SlideInDown: createLayoutAnim(),
|
|
265
|
+
SlideOutRight: createLayoutAnim(),
|
|
266
|
+
SlideOutLeft: createLayoutAnim(),
|
|
267
|
+
SlideOutUp: createLayoutAnim(),
|
|
268
|
+
SlideOutDown: createLayoutAnim(),
|
|
269
|
+
ZoomIn: createLayoutAnim(),
|
|
270
|
+
ZoomOut: createLayoutAnim(),
|
|
271
|
+
BounceIn: createLayoutAnim(),
|
|
272
|
+
BounceOut: createLayoutAnim(),
|
|
273
|
+
BounceInDown: createLayoutAnim(),
|
|
274
|
+
BounceInUp: createLayoutAnim(),
|
|
275
|
+
BounceInLeft: createLayoutAnim(),
|
|
276
|
+
BounceInRight: createLayoutAnim(),
|
|
277
|
+
FlipInEasyX: createLayoutAnim(),
|
|
278
|
+
FlipInEasyY: createLayoutAnim(),
|
|
279
|
+
FlipOutEasyX: createLayoutAnim(),
|
|
280
|
+
FlipOutEasyY: createLayoutAnim(),
|
|
281
|
+
LightSpeedInLeft: createLayoutAnim(),
|
|
282
|
+
LightSpeedInRight: createLayoutAnim(),
|
|
283
|
+
LightSpeedOutLeft: createLayoutAnim(),
|
|
284
|
+
LightSpeedOutRight: createLayoutAnim(),
|
|
285
|
+
PinwheelIn: createLayoutAnim(),
|
|
286
|
+
PinwheelOut: createLayoutAnim(),
|
|
287
|
+
StretchInX: createLayoutAnim(),
|
|
288
|
+
StretchInY: createLayoutAnim(),
|
|
289
|
+
StretchOutX: createLayoutAnim(),
|
|
290
|
+
StretchOutY: createLayoutAnim(),
|
|
291
|
+
RotateInDownLeft: createLayoutAnim(),
|
|
292
|
+
RotateInDownRight: createLayoutAnim(),
|
|
293
|
+
RotateInUpLeft: createLayoutAnim(),
|
|
294
|
+
RotateInUpRight: createLayoutAnim(),
|
|
295
|
+
RotateOutDownLeft: createLayoutAnim(),
|
|
296
|
+
RotateOutDownRight: createLayoutAnim(),
|
|
297
|
+
RotateOutUpLeft: createLayoutAnim(),
|
|
298
|
+
RotateOutUpRight: createLayoutAnim(),
|
|
299
|
+
Layout: createLayoutAnim(),
|
|
300
|
+
LinearTransition: createLayoutAnim(),
|
|
301
|
+
SequencedTransition: createLayoutAnim(),
|
|
302
|
+
FadingTransition: createLayoutAnim(),
|
|
303
|
+
JumpingTransition: createLayoutAnim(),
|
|
304
|
+
CurvedTransition: createLayoutAnim(),
|
|
305
|
+
EntryExitTransition: createLayoutAnim(),
|
|
176
306
|
interpolate: vi.fn((_value, input, output) => output[0]),
|
|
177
307
|
Extrapolation: {
|
|
178
308
|
CLAMP: "clamp",
|
|
@@ -189,7 +319,26 @@ function reanimated() {
|
|
|
189
319
|
pageY: 0
|
|
190
320
|
})),
|
|
191
321
|
scrollTo: vi.fn(),
|
|
192
|
-
cancelAnimation: vi.fn()
|
|
322
|
+
cancelAnimation: vi.fn(),
|
|
323
|
+
makeMutable: vi.fn((init) => createSharedValue(init)),
|
|
324
|
+
SharedTransition: {
|
|
325
|
+
duration: vi.fn().mockReturnThis(),
|
|
326
|
+
custom: vi.fn().mockReturnThis(),
|
|
327
|
+
progressAnimation: vi.fn().mockReturnThis(),
|
|
328
|
+
defaultTransitionType: vi.fn().mockReturnThis()
|
|
329
|
+
},
|
|
330
|
+
ReduceMotion: {
|
|
331
|
+
System: "system",
|
|
332
|
+
Always: "always",
|
|
333
|
+
Never: "never"
|
|
334
|
+
},
|
|
335
|
+
KeyboardState: {
|
|
336
|
+
UNKNOWN: 0,
|
|
337
|
+
OPENING: 1,
|
|
338
|
+
OPEN: 2,
|
|
339
|
+
CLOSING: 3,
|
|
340
|
+
CLOSED: 4
|
|
341
|
+
}
|
|
193
342
|
};
|
|
194
343
|
}
|
|
195
344
|
} }
|
|
@@ -368,19 +517,25 @@ function safeAreaContext() {
|
|
|
368
517
|
"Metrics"
|
|
369
518
|
],
|
|
370
519
|
factory: () => {
|
|
520
|
+
const defaultInsets = {
|
|
521
|
+
top: 47,
|
|
522
|
+
right: 0,
|
|
523
|
+
bottom: 34,
|
|
524
|
+
left: 0
|
|
525
|
+
};
|
|
526
|
+
const defaultFrame = {
|
|
527
|
+
x: 0,
|
|
528
|
+
y: 0,
|
|
529
|
+
width: 390,
|
|
530
|
+
height: 844
|
|
531
|
+
};
|
|
532
|
+
const state = {
|
|
533
|
+
insets: { ...defaultInsets },
|
|
534
|
+
frame: { ...defaultFrame }
|
|
535
|
+
};
|
|
371
536
|
const initialMetrics = {
|
|
372
|
-
frame:
|
|
373
|
-
|
|
374
|
-
y: 0,
|
|
375
|
-
width: 390,
|
|
376
|
-
height: 844
|
|
377
|
-
},
|
|
378
|
-
insets: {
|
|
379
|
-
top: 47,
|
|
380
|
-
right: 0,
|
|
381
|
-
bottom: 34,
|
|
382
|
-
left: 0
|
|
383
|
-
}
|
|
537
|
+
frame: state.frame,
|
|
538
|
+
insets: state.insets
|
|
384
539
|
};
|
|
385
540
|
const SafeAreaProvider = React.forwardRef((props, ref) => React.createElement("SafeAreaProvider", {
|
|
386
541
|
...props,
|
|
@@ -392,19 +547,19 @@ function safeAreaContext() {
|
|
|
392
547
|
ref
|
|
393
548
|
}, props.children));
|
|
394
549
|
SafeAreaView.displayName = "SafeAreaView";
|
|
395
|
-
const SafeAreaInsetsContext = React.createContext(
|
|
396
|
-
const SafeAreaFrameContext = React.createContext(
|
|
550
|
+
const SafeAreaInsetsContext = React.createContext(state.insets);
|
|
551
|
+
const SafeAreaFrameContext = React.createContext(state.frame);
|
|
397
552
|
function useSafeAreaInsets() {
|
|
398
|
-
return
|
|
553
|
+
return state.insets;
|
|
399
554
|
}
|
|
400
555
|
function useSafeAreaFrame() {
|
|
401
|
-
return
|
|
556
|
+
return state.frame;
|
|
402
557
|
}
|
|
403
558
|
function withSafeAreaInsets(WrappedComponent) {
|
|
404
559
|
const WithSafeAreaInsets = React.forwardRef((props, ref) => React.createElement(WrappedComponent, {
|
|
405
560
|
...props,
|
|
406
561
|
ref,
|
|
407
|
-
insets:
|
|
562
|
+
insets: state.insets
|
|
408
563
|
}));
|
|
409
564
|
WithSafeAreaInsets.displayName = `withSafeAreaInsets(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
|
|
410
565
|
return WithSafeAreaInsets;
|
|
@@ -422,10 +577,17 @@ function safeAreaContext() {
|
|
|
422
577
|
useSafeAreaFrame,
|
|
423
578
|
withSafeAreaInsets,
|
|
424
579
|
initialWindowMetrics: initialMetrics,
|
|
425
|
-
initialWindowSafeAreaInsets:
|
|
580
|
+
initialWindowSafeAreaInsets: state.insets,
|
|
426
581
|
EdgeInsets: vi.fn(),
|
|
427
582
|
Rect: vi.fn(),
|
|
428
|
-
Metrics: vi.fn()
|
|
583
|
+
Metrics: vi.fn(),
|
|
584
|
+
_setInsets: (insets) => {
|
|
585
|
+
Object.assign(state.insets, insets);
|
|
586
|
+
},
|
|
587
|
+
_reset: () => {
|
|
588
|
+
Object.assign(state.insets, defaultInsets);
|
|
589
|
+
Object.assign(state.frame, defaultFrame);
|
|
590
|
+
}
|
|
429
591
|
};
|
|
430
592
|
}
|
|
431
593
|
} }
|
|
@@ -433,27 +595,123 @@ function safeAreaContext() {
|
|
|
433
595
|
}
|
|
434
596
|
//#endregion
|
|
435
597
|
//#region src/presets/navigation.ts
|
|
598
|
+
/** Builds a minimal navigation prop matching useNavigation()'s shape. */
|
|
599
|
+
function createMockNavigation() {
|
|
600
|
+
return {
|
|
601
|
+
navigate: vi.fn(),
|
|
602
|
+
goBack: vi.fn(),
|
|
603
|
+
reset: vi.fn(),
|
|
604
|
+
setParams: vi.fn(),
|
|
605
|
+
setOptions: vi.fn(),
|
|
606
|
+
dispatch: vi.fn(),
|
|
607
|
+
canGoBack: vi.fn(() => false),
|
|
608
|
+
getParent: vi.fn(() => void 0),
|
|
609
|
+
getState: vi.fn(() => ({
|
|
610
|
+
index: 0,
|
|
611
|
+
key: "root",
|
|
612
|
+
routeNames: [],
|
|
613
|
+
routes: [],
|
|
614
|
+
type: "stack",
|
|
615
|
+
stale: false
|
|
616
|
+
})),
|
|
617
|
+
isFocused: vi.fn(() => true),
|
|
618
|
+
addListener: vi.fn(() => vi.fn()),
|
|
619
|
+
removeListener: vi.fn(),
|
|
620
|
+
getId: vi.fn(() => void 0)
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Creates a Screen component mock that handles all three React Navigation patterns:
|
|
625
|
+
* 1. <Screen component={Comp} /> — renders Comp with route & navigation props
|
|
626
|
+
* 2. <Screen>{(props) => <Comp />}</Screen> — calls render function
|
|
627
|
+
* 3. <Screen><Something /></Screen> — passes children through
|
|
628
|
+
*
|
|
629
|
+
* Accepts NavigationContext and NavigationRouteContext so that hooks like
|
|
630
|
+
* useNavigation() and useRoute() inside the screen component return values
|
|
631
|
+
* consistent with the route/navigation props passed to the component.
|
|
632
|
+
*/
|
|
633
|
+
function createMockScreen(NavContext, RouteContext) {
|
|
634
|
+
const Screen = React.forwardRef(({ component: Component, children, ...rest }, ref) => {
|
|
635
|
+
const route = {
|
|
636
|
+
key: rest.name ?? "",
|
|
637
|
+
name: rest.name ?? "",
|
|
638
|
+
params: rest.initialParams
|
|
639
|
+
};
|
|
640
|
+
const nav = createMockNavigation();
|
|
641
|
+
const content = Component ? React.createElement(Component, {
|
|
642
|
+
route,
|
|
643
|
+
navigation: nav
|
|
644
|
+
}) : typeof children === "function" ? children({
|
|
645
|
+
route,
|
|
646
|
+
navigation: nav
|
|
647
|
+
}) : children;
|
|
648
|
+
return React.createElement("Screen", {
|
|
649
|
+
...rest,
|
|
650
|
+
ref
|
|
651
|
+
}, React.createElement(NavContext.Provider, { value: nav }, React.createElement(RouteContext.Provider, { value: route }, content)));
|
|
652
|
+
});
|
|
653
|
+
Screen.displayName = "Screen";
|
|
654
|
+
return Screen;
|
|
655
|
+
}
|
|
436
656
|
function navigation() {
|
|
657
|
+
const NavigationContext = React.createContext(null);
|
|
658
|
+
const NavigationRouteContext = React.createContext(null);
|
|
659
|
+
const NavigationContainerRefContext = React.createContext(null);
|
|
660
|
+
const NavigationHelpersContext = React.createContext(null);
|
|
661
|
+
const CurrentRenderContext = React.createContext(void 0);
|
|
662
|
+
const ThemeContext = React.createContext({
|
|
663
|
+
dark: false,
|
|
664
|
+
colors: {}
|
|
665
|
+
});
|
|
666
|
+
const PreventRemoveContext = React.createContext(null);
|
|
667
|
+
const Screen = createMockScreen(NavigationContext, NavigationRouteContext);
|
|
437
668
|
return {
|
|
438
669
|
name: "navigation",
|
|
439
670
|
modules: {
|
|
440
671
|
"@react-navigation/native": {
|
|
441
672
|
exports: [
|
|
442
673
|
"NavigationContainer",
|
|
674
|
+
"useLinkTo",
|
|
675
|
+
"Link",
|
|
443
676
|
"useNavigation",
|
|
444
677
|
"useRoute",
|
|
445
678
|
"useFocusEffect",
|
|
446
679
|
"useIsFocused",
|
|
447
680
|
"useNavigationState",
|
|
681
|
+
"useScrollToTop",
|
|
682
|
+
"useNavigationContainerRef",
|
|
448
683
|
"createNavigationContainerRef",
|
|
684
|
+
"createNavigatorFactory",
|
|
685
|
+
"useNavigationBuilder",
|
|
449
686
|
"NavigationContext",
|
|
450
687
|
"NavigationRouteContext",
|
|
688
|
+
"NavigationContainerRefContext",
|
|
689
|
+
"NavigationHelpersContext",
|
|
690
|
+
"CurrentRenderContext",
|
|
691
|
+
"ThemeContext",
|
|
692
|
+
"ThemeProvider",
|
|
693
|
+
"useTheme",
|
|
694
|
+
"NavigationIndependentTree",
|
|
695
|
+
"useNavigationIndependentTree",
|
|
696
|
+
"PreventRemoveContext",
|
|
697
|
+
"PreventRemoveProvider",
|
|
698
|
+
"usePreventRemove",
|
|
699
|
+
"usePreventRemoveContext",
|
|
451
700
|
"CommonActions",
|
|
452
701
|
"StackActions",
|
|
453
702
|
"TabActions",
|
|
454
703
|
"DrawerActions",
|
|
455
|
-
"
|
|
456
|
-
"
|
|
704
|
+
"findFocusedRoute",
|
|
705
|
+
"getFocusedRouteNameFromRoute",
|
|
706
|
+
"getActionFromState",
|
|
707
|
+
"getPathFromState",
|
|
708
|
+
"getStateFromPath",
|
|
709
|
+
"useStateForPath",
|
|
710
|
+
"validatePathConfig",
|
|
711
|
+
"BaseNavigationContainer",
|
|
712
|
+
"createComponentForStaticNavigation",
|
|
713
|
+
"createPathConfigForStaticNavigation",
|
|
714
|
+
"BaseRouter"
|
|
457
715
|
],
|
|
458
716
|
factory: () => {
|
|
459
717
|
const NavigationContainer = React.forwardRef((props, ref) => React.createElement("NavigationContainer", {
|
|
@@ -477,29 +735,39 @@ function navigation() {
|
|
|
477
735
|
type: "stack",
|
|
478
736
|
stale: false
|
|
479
737
|
}));
|
|
738
|
+
const defaultNavigation = {
|
|
739
|
+
navigate,
|
|
740
|
+
goBack,
|
|
741
|
+
reset,
|
|
742
|
+
setParams,
|
|
743
|
+
setOptions,
|
|
744
|
+
dispatch,
|
|
745
|
+
canGoBack,
|
|
746
|
+
getParent,
|
|
747
|
+
getState,
|
|
748
|
+
isFocused: vi.fn(() => true),
|
|
749
|
+
addListener: vi.fn(() => vi.fn()),
|
|
750
|
+
removeListener: vi.fn(),
|
|
751
|
+
getId: vi.fn(() => void 0)
|
|
752
|
+
};
|
|
753
|
+
const defaultRoute = {
|
|
754
|
+
key: "test-route-key",
|
|
755
|
+
name: "TestScreen",
|
|
756
|
+
params: {}
|
|
757
|
+
};
|
|
480
758
|
function useNavigation() {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
setOptions,
|
|
487
|
-
dispatch,
|
|
488
|
-
canGoBack,
|
|
489
|
-
getParent,
|
|
490
|
-
getState,
|
|
491
|
-
isFocused: vi.fn(() => true),
|
|
492
|
-
addListener: vi.fn(() => vi.fn()),
|
|
493
|
-
removeListener: vi.fn(),
|
|
494
|
-
getId: vi.fn(() => void 0)
|
|
495
|
-
};
|
|
759
|
+
try {
|
|
760
|
+
const ctx = React.useContext(NavigationContext);
|
|
761
|
+
if (ctx) return ctx;
|
|
762
|
+
} catch {}
|
|
763
|
+
return defaultNavigation;
|
|
496
764
|
}
|
|
497
765
|
function useRoute() {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
766
|
+
try {
|
|
767
|
+
const ctx = React.useContext(NavigationRouteContext);
|
|
768
|
+
if (ctx) return ctx;
|
|
769
|
+
} catch {}
|
|
770
|
+
return defaultRoute;
|
|
503
771
|
}
|
|
504
772
|
function useFocusEffect(callback) {
|
|
505
773
|
React.useEffect(callback, []);
|
|
@@ -529,8 +797,40 @@ function navigation() {
|
|
|
529
797
|
addListener: vi.fn(() => vi.fn())
|
|
530
798
|
};
|
|
531
799
|
}
|
|
532
|
-
|
|
533
|
-
|
|
800
|
+
function useNavigationContainerRef() {
|
|
801
|
+
return createNavigationContainerRef();
|
|
802
|
+
}
|
|
803
|
+
const defaultTheme = {
|
|
804
|
+
dark: false,
|
|
805
|
+
colors: {
|
|
806
|
+
primary: "rgb(0, 122, 255)",
|
|
807
|
+
background: "rgb(242, 242, 242)",
|
|
808
|
+
card: "rgb(255, 255, 255)",
|
|
809
|
+
text: "rgb(28, 28, 30)",
|
|
810
|
+
border: "rgb(216, 216, 216)",
|
|
811
|
+
notification: "rgb(255, 59, 48)"
|
|
812
|
+
}
|
|
813
|
+
};
|
|
814
|
+
function ThemeProvider({ value, children }) {
|
|
815
|
+
return React.createElement(ThemeContext.Provider, { value: value ?? defaultTheme }, children);
|
|
816
|
+
}
|
|
817
|
+
function useTheme() {
|
|
818
|
+
return defaultTheme;
|
|
819
|
+
}
|
|
820
|
+
function NavigationIndependentTree({ children }) {
|
|
821
|
+
return children;
|
|
822
|
+
}
|
|
823
|
+
function useNavigationIndependentTree() {
|
|
824
|
+
return true;
|
|
825
|
+
}
|
|
826
|
+
function PreventRemoveProvider({ children }) {
|
|
827
|
+
return children;
|
|
828
|
+
}
|
|
829
|
+
const BaseNavigationContainer = React.forwardRef((props, ref) => React.createElement("BaseNavigationContainer", {
|
|
830
|
+
...props,
|
|
831
|
+
ref
|
|
832
|
+
}, props.children));
|
|
833
|
+
BaseNavigationContainer.displayName = "BaseNavigationContainer";
|
|
534
834
|
return {
|
|
535
835
|
default: { NavigationContainer },
|
|
536
836
|
NavigationContainer,
|
|
@@ -539,9 +839,29 @@ function navigation() {
|
|
|
539
839
|
useFocusEffect,
|
|
540
840
|
useIsFocused,
|
|
541
841
|
useNavigationState,
|
|
842
|
+
useNavigationContainerRef,
|
|
542
843
|
createNavigationContainerRef,
|
|
844
|
+
createNavigatorFactory: vi.fn(() => vi.fn()),
|
|
845
|
+
useNavigationBuilder: vi.fn(() => ({
|
|
846
|
+
state: getState(),
|
|
847
|
+
navigation: useNavigation(),
|
|
848
|
+
descriptors: {},
|
|
849
|
+
NavigationContent: ({ children }) => children
|
|
850
|
+
})),
|
|
543
851
|
NavigationContext,
|
|
544
852
|
NavigationRouteContext,
|
|
853
|
+
NavigationContainerRefContext,
|
|
854
|
+
NavigationHelpersContext,
|
|
855
|
+
CurrentRenderContext,
|
|
856
|
+
ThemeContext,
|
|
857
|
+
ThemeProvider,
|
|
858
|
+
useTheme,
|
|
859
|
+
NavigationIndependentTree,
|
|
860
|
+
useNavigationIndependentTree,
|
|
861
|
+
PreventRemoveContext,
|
|
862
|
+
PreventRemoveProvider,
|
|
863
|
+
usePreventRemove: vi.fn(),
|
|
864
|
+
usePreventRemoveContext: vi.fn(() => null),
|
|
545
865
|
CommonActions: {
|
|
546
866
|
navigate: vi.fn(),
|
|
547
867
|
reset: vi.fn(),
|
|
@@ -561,6 +881,25 @@ function navigation() {
|
|
|
561
881
|
toggleDrawer: vi.fn(),
|
|
562
882
|
jumpTo: vi.fn()
|
|
563
883
|
},
|
|
884
|
+
findFocusedRoute: vi.fn((state) => state?.routes?.[state?.index ?? 0]),
|
|
885
|
+
getFocusedRouteNameFromRoute: vi.fn((route) => route?.state?.routes?.[route?.state?.index ?? 0]?.name),
|
|
886
|
+
getActionFromState: vi.fn(() => void 0),
|
|
887
|
+
getPathFromState: vi.fn(() => "/"),
|
|
888
|
+
getStateFromPath: vi.fn(() => void 0),
|
|
889
|
+
useStateForPath: vi.fn(() => void 0),
|
|
890
|
+
validatePathConfig: vi.fn(),
|
|
891
|
+
BaseNavigationContainer,
|
|
892
|
+
createComponentForStaticNavigation: vi.fn(() => () => null),
|
|
893
|
+
createPathConfigForStaticNavigation: vi.fn(() => ({})),
|
|
894
|
+
BaseRouter: {
|
|
895
|
+
getInitialState: vi.fn(() => getState()),
|
|
896
|
+
getRehydratedState: vi.fn((state) => state),
|
|
897
|
+
getStateForRouteNamesChange: vi.fn((state) => state),
|
|
898
|
+
getStateForRouteFocus: vi.fn((state) => state),
|
|
899
|
+
getStateForAction: vi.fn((state) => state),
|
|
900
|
+
shouldActionChangeFocus: vi.fn(() => false)
|
|
901
|
+
},
|
|
902
|
+
useScrollToTop: vi.fn(),
|
|
564
903
|
useLinkTo: vi.fn(() => vi.fn()),
|
|
565
904
|
Link: React.forwardRef((props, ref) => React.createElement("Link", {
|
|
566
905
|
...props,
|
|
@@ -578,10 +917,7 @@ function navigation() {
|
|
|
578
917
|
...props,
|
|
579
918
|
ref
|
|
580
919
|
}, props.children)),
|
|
581
|
-
Screen
|
|
582
|
-
...props,
|
|
583
|
-
ref
|
|
584
|
-
}, props.children)),
|
|
920
|
+
Screen,
|
|
585
921
|
Group: React.forwardRef((props, ref) => React.createElement("Group", {
|
|
586
922
|
...props,
|
|
587
923
|
ref
|
|
@@ -603,10 +939,29 @@ function navigation() {
|
|
|
603
939
|
...props,
|
|
604
940
|
ref
|
|
605
941
|
}, props.children)),
|
|
606
|
-
Screen
|
|
942
|
+
Screen,
|
|
943
|
+
Group: React.forwardRef((props, ref) => React.createElement("Group", {
|
|
944
|
+
...props,
|
|
945
|
+
ref
|
|
946
|
+
}, props.children))
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
return {
|
|
950
|
+
default: { createBottomTabNavigator },
|
|
951
|
+
createBottomTabNavigator
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
},
|
|
955
|
+
"@react-navigation/drawer": {
|
|
956
|
+
exports: ["createDrawerNavigator"],
|
|
957
|
+
factory: () => {
|
|
958
|
+
function createDrawerNavigator() {
|
|
959
|
+
return {
|
|
960
|
+
Navigator: React.forwardRef((props, ref) => React.createElement("DrawerNavigator", {
|
|
607
961
|
...props,
|
|
608
962
|
ref
|
|
609
963
|
}, props.children)),
|
|
964
|
+
Screen,
|
|
610
965
|
Group: React.forwardRef((props, ref) => React.createElement("Group", {
|
|
611
966
|
...props,
|
|
612
967
|
ref
|
|
@@ -614,8 +969,8 @@ function navigation() {
|
|
|
614
969
|
};
|
|
615
970
|
}
|
|
616
971
|
return {
|
|
617
|
-
default: {
|
|
618
|
-
|
|
972
|
+
default: { createDrawerNavigator },
|
|
973
|
+
createDrawerNavigator
|
|
619
974
|
};
|
|
620
975
|
}
|
|
621
976
|
},
|
|
@@ -750,7 +1105,8 @@ function asyncStorage() {
|
|
|
750
1105
|
else store.set(key, value);
|
|
751
1106
|
});
|
|
752
1107
|
}),
|
|
753
|
-
flushGetRequests: vi.fn(() => {})
|
|
1108
|
+
flushGetRequests: vi.fn(() => {}),
|
|
1109
|
+
_resetStore: () => store.clear()
|
|
754
1110
|
};
|
|
755
1111
|
return {
|
|
756
1112
|
...exports,
|
package/dist/presets.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_presets = require("./presets-
|
|
2
|
+
const require_presets = require("./presets-B-spxZz7.cjs");
|
|
3
3
|
exports.asyncStorage = require_presets.asyncStorage;
|
|
4
4
|
exports.expo = require_presets.expo;
|
|
5
5
|
exports.gestureHandler = require_presets.gestureHandler;
|
package/dist/presets.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as navigation, c as reanimated, i as asyncStorage, n as expo, o as safeAreaContext, r as screens, s as gestureHandler } from "./presets-
|
|
1
|
+
import { a as navigation, c as reanimated, i as asyncStorage, n as expo, o as safeAreaContext, r as screens, s as gestureHandler } from "./presets-DvrcfEPz.mjs";
|
|
2
2
|
export { asyncStorage, expo, gestureHandler, navigation, reanimated, safeAreaContext, screens };
|