@office-iss/react-native-win32 0.0.0-canary.262 → 0.0.0-canary.263

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.
Files changed (45) hide show
  1. package/.eslintrc.js +11 -0
  2. package/.flowconfig +1 -1
  3. package/CHANGELOG.json +40 -1
  4. package/CHANGELOG.md +17 -5
  5. package/Libraries/Animated/AnimatedEvent.js +1 -1
  6. package/Libraries/Animated/NativeAnimatedAllowlist.js +111 -0
  7. package/Libraries/Animated/animations/Animation.js +1 -1
  8. package/Libraries/Animated/animations/DecayAnimation.js +1 -1
  9. package/Libraries/Animated/animations/SpringAnimation.js +1 -1
  10. package/Libraries/Animated/animations/TimingAnimation.js +1 -1
  11. package/Libraries/Animated/components/AnimatedScrollView.js +1 -0
  12. package/Libraries/Animated/createAnimatedComponent.js +9 -8
  13. package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
  14. package/Libraries/Animated/nodes/AnimatedInterpolation.js +3 -2
  15. package/Libraries/Animated/nodes/AnimatedNode.js +42 -33
  16. package/Libraries/Animated/nodes/AnimatedObject.js +54 -45
  17. package/Libraries/Animated/nodes/AnimatedProps.js +75 -40
  18. package/Libraries/Animated/nodes/AnimatedStyle.js +103 -59
  19. package/Libraries/Animated/nodes/AnimatedTracking.js +1 -1
  20. package/Libraries/Animated/nodes/AnimatedTransform.js +102 -67
  21. package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
  22. package/Libraries/Animated/nodes/AnimatedWithChildren.js +21 -22
  23. package/Libraries/Animated/useAnimatedProps.js +18 -15
  24. package/Libraries/Core/ReactNativeVersion.js +1 -1
  25. package/Libraries/Image/Image.win32.js +1 -3
  26. package/Libraries/Inspector/Inspector.js +3 -2
  27. package/Libraries/Inspector/Inspector.win32.js +3 -2
  28. package/Libraries/Inspector/InspectorPanel.js +16 -10
  29. package/Libraries/LogBox/LogBoxNotificationContainer.js +3 -2
  30. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -12
  31. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +1 -12
  32. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +17 -15
  33. package/Libraries/Text/TextNativeComponent.win32.js +0 -1
  34. package/Libraries/vendor/emitter/EventEmitter.js +5 -5
  35. package/overrides.json +11 -11
  36. package/package.json +19 -18
  37. package/src/private/animated/NativeAnimatedHelper.js +438 -0
  38. package/src/private/animated/NativeAnimatedHelper.win32.js +440 -0
  39. package/src/private/animated/NativeAnimatedValidation.js +64 -0
  40. package/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js +27 -0
  41. package/src/private/featureflags/ReactNativeFeatureFlags.js +1 -7
  42. package/Libraries/Animated/NativeAnimatedHelper.js +0 -615
  43. package/Libraries/Animated/NativeAnimatedHelper.win32.js +0 -617
  44. package/src/private/hooks/DebouncedEffectImplementation.js +0 -148
  45. package/src/private/hooks/useDebouncedEffect.js +0 -23
@@ -1,148 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow strict-local
8
- * @format
9
- * @oncall react_native
10
- */
11
-
12
- 'use strict';
13
-
14
- // $FlowFixMe[untyped-type-import] used as an opaque type
15
- import type {Task} from 'scheduler';
16
- // $FlowFixMe[untyped-type-import] used as an opaque type
17
- import typeof Scheduler from 'scheduler';
18
-
19
- import {useCallback, useEffect, useRef} from 'react';
20
-
21
- type EffectStatus =
22
- // The effect is scheduled but has not yet run. The cleanup function is from
23
- // the last execution, if there was one. If the effect gets rescheduled, the
24
- // cleanup function must be propagated so that it can run before the updated
25
- // effect
26
- | {
27
- kind: 'scheduled',
28
- // $FlowFixMe[value-as-type] Task is opaque
29
- task: Task,
30
- previousCleanup: null | (() => void),
31
- }
32
- // The effect has been executed and returned a cleanup function. If it ran
33
- // but didn't return a cleanup function, the effect status is set to null.
34
- | {
35
- cleanup: () => void,
36
- kind: 'executed',
37
- };
38
-
39
- /**
40
- * Similar to `useEffect`, this hook schedules a passive effect (@param fn) to
41
- * run on mount and whenever the dependency array (@param deps) changes.
42
- * However, unlike `useEffect` the effect is debounced so that it runs after
43
- * a delay (idle priority callback), reseting if another render occurs. Another
44
- * render can occur for example when a layout effect runs and sets state.
45
- * Updates triggered in layout effects cause the next render to flush
46
- * synchronously and will by default run passive effects first before the
47
- * re-render (to flush effects with the original state), and then again after
48
- * the re-render (to flush effects with the updated state).
49
- *
50
- * Instead, this hook will run the effect once per batched render, after it has
51
- * committed/painted. The effect is scheduled at idle priority, and if another
52
- * render occurs in the meantime it reschedules the effect. Thus the effect
53
- * will only run when the component stops re-rendering. When the effect does
54
- * run, it is guaranteed to be the latest version of the effect.
55
- *
56
- * @see https://react.dev/reference/react/useEffect for more on normal passive
57
- * effect behavior.
58
- */
59
- export default function useDebouncedEffectImplementation(
60
- fn: () => void | (() => void),
61
- deps?: ?$ReadOnlyArray<mixed>,
62
- // $FlowFixMe[value-as-type] used as an opaque type
63
- scheduler: Scheduler,
64
- ): void {
65
- const statusRef = useRef<null | EffectStatus>(null);
66
-
67
- const scheduleTask = useCallback(
68
- (
69
- effectFn: null | (() => void | (() => void)),
70
- previousCleanup: null | (() => void),
71
- ): void => {
72
- const status = statusRef.current;
73
- if (status != null && status.kind === 'scheduled') {
74
- scheduler.unstable_cancelCallback(status.task);
75
- }
76
- if (effectFn == null && previousCleanup == null) {
77
- statusRef.current = null;
78
- return;
79
- }
80
- const task = scheduler.unstable_scheduleCallback(
81
- scheduler.unstable_IdlePriority,
82
- () => {
83
- if (previousCleanup != null) {
84
- previousCleanup();
85
- }
86
- let cleanup = null;
87
- if (effectFn != null) {
88
- cleanup = effectFn() ?? null;
89
- }
90
- if (cleanup == null) {
91
- statusRef.current = null;
92
- } else {
93
- statusRef.current = {
94
- kind: 'executed',
95
- cleanup,
96
- };
97
- }
98
- },
99
- );
100
- statusRef.current = {
101
- kind: 'scheduled',
102
- task,
103
- previousCleanup,
104
- };
105
- },
106
- // eslint-disable-next-line react-hooks/exhaustive-deps
107
- [],
108
- );
109
-
110
- useEffect(() => {
111
- const statusInEffect = statusRef.current;
112
- if (statusInEffect == null) {
113
- scheduleTask(fn, null);
114
- } else if (statusInEffect.kind === 'scheduled') {
115
- // Need to cancel & reschedule, maintaining the same cleanup function.
116
- scheduleTask(fn, statusInEffect.previousCleanup);
117
- } else {
118
- // Already executed, we need to schedule a new task and call the cleanup
119
- // function from the last execution
120
- scheduleTask(fn, statusInEffect.cleanup);
121
- }
122
-
123
- return () => {
124
- // Rather than immediately run cleanup, we schedule the cleanup task.
125
- // If the effect is about to update, then we'll cancel this task and
126
- // reschedule with both the cleanup and the new effect function (see above)
127
- const statusAtCleanup = statusRef.current;
128
- if (statusAtCleanup == null) {
129
- // nothing to do, nothing is scheduled and if the task ran already, it
130
- // didn't have a cleanup function
131
- return;
132
- } else if (statusAtCleanup.kind === 'scheduled') {
133
- // The task is scheduled but has not yet run. Reschedule just the
134
- // cleanup function (the effect function portion may be
135
- // overridden momentarily if the effect is about to update, but that's
136
- // okay).
137
- // Note that if cleanup is null, this will just clear the pending task
138
- // and not schedule a new one
139
- scheduleTask(null, statusAtCleanup.previousCleanup);
140
- } else {
141
- // If kind === executed, then we know there is a cleanup function that
142
- // still needs to run so schedule it
143
- scheduleTask(null, statusAtCleanup.cleanup);
144
- }
145
- };
146
- // eslint-disable-next-line react-hooks/exhaustive-deps
147
- }, deps);
148
- }
@@ -1,23 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow strict-local
8
- * @format
9
- * @oncall react_native
10
- */
11
-
12
- 'use strict';
13
-
14
- import useDebouncedEffectImplementation from './DebouncedEffectImplementation';
15
- // $FlowFixMe[untyped-import] used as an opaque type
16
- import Scheduler from 'scheduler';
17
-
18
- export default function useDebouncedEffect(
19
- fn: () => void | (() => void),
20
- deps?: ?$ReadOnlyArray<mixed>,
21
- ): void {
22
- return useDebouncedEffectImplementation(fn, deps, Scheduler);
23
- }