@office-iss/react-native-win32 0.81.2 → 0.82.0-preview.2

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 (209) hide show
  1. package/.flowconfig +3 -11
  2. package/CHANGELOG.json +118 -43
  3. package/CHANGELOG.md +45 -27
  4. package/IntegrationTests/IntegrationTestsApp.js +2 -2
  5. package/IntegrationTests/LayoutEventsTest.js +3 -3
  6. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +7 -3
  7. package/Libraries/Alert/RCTAlertManager.android.js +4 -2
  8. package/Libraries/Animated/Animated.d.ts +2 -0
  9. package/Libraries/Animated/AnimatedEvent.js +1 -1
  10. package/Libraries/Animated/AnimatedExports.js.flow +1 -0
  11. package/Libraries/Animated/AnimatedImplementation.js +4 -2
  12. package/Libraries/Animated/AnimatedMock.js +1 -1
  13. package/Libraries/Animated/Easing.js +2 -0
  14. package/Libraries/Animated/NativeAnimatedAllowlist.js +1 -0
  15. package/Libraries/Animated/animations/Animation.js +19 -20
  16. package/Libraries/Animated/animations/TimingAnimation.js +2 -0
  17. package/Libraries/Animated/components/AnimatedScrollView.js +3 -2
  18. package/Libraries/Animated/components/AnimatedSectionList.js +1 -1
  19. package/Libraries/Animated/nodes/AnimatedColor.js +9 -9
  20. package/Libraries/Animated/nodes/AnimatedInterpolation.js +4 -4
  21. package/Libraries/Animated/nodes/AnimatedNode.js +14 -7
  22. package/Libraries/Animated/nodes/AnimatedObject.js +7 -7
  23. package/Libraries/Animated/nodes/AnimatedProps.js +32 -32
  24. package/Libraries/Animated/nodes/AnimatedStyle.js +23 -21
  25. package/Libraries/Animated/nodes/AnimatedTransform.js +6 -6
  26. package/Libraries/Animated/nodes/AnimatedValue.js +18 -26
  27. package/Libraries/AppState/AppState.js +8 -4
  28. package/Libraries/BatchedBridge/BatchedBridge.js +1 -0
  29. package/Libraries/BatchedBridge/MessageQueue.js +5 -0
  30. package/Libraries/BatchedBridge/NativeModules.js +1 -1
  31. package/Libraries/Blob/BlobManager.js +1 -1
  32. package/Libraries/Blob/URLSearchParams.js +2 -0
  33. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +2 -2
  34. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +2 -2
  35. package/Libraries/Components/Button.js +1 -1
  36. package/Libraries/Components/Button.win32.js +1 -1
  37. package/Libraries/Components/Pressable/Pressable.js +10 -1
  38. package/Libraries/Components/Pressable/Pressable.win32.js +9 -0
  39. package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
  40. package/Libraries/Components/ScrollView/ScrollView.js +13 -4
  41. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
  42. package/Libraries/Components/StatusBar/StatusBar.js +2 -2
  43. package/Libraries/Components/Switch/Switch.js +1 -1
  44. package/Libraries/Components/TextInput/TextInput.flow.js +12 -5
  45. package/Libraries/Components/TextInput/TextInput.flow.win32.js +12 -5
  46. package/Libraries/Components/TextInput/TextInput.js +14 -5
  47. package/Libraries/Components/TextInput/TextInput.win32.js +15 -7
  48. package/Libraries/Components/TextInput/TextInputState.js +1 -1
  49. package/Libraries/Components/TextInput/TextInputState.win32.js +1 -1
  50. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +2 -3
  51. package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
  52. package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
  53. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
  54. package/Libraries/Components/Touchable/TouchableOpacity.js +1 -1
  55. package/Libraries/Components/Touchable/TouchableWin32.js +1 -1
  56. package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
  57. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +3 -3
  58. package/Libraries/Components/View/View.js +81 -167
  59. package/Libraries/Components/View/View.win32.js +3 -1
  60. package/Libraries/Core/Devtools/loadBundleFromServer.js +1 -1
  61. package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +1 -1
  62. package/Libraries/Core/ExceptionsManager.js +4 -2
  63. package/Libraries/Core/ReactFiberErrorDialog.js +3 -3
  64. package/Libraries/Core/ReactNativeVersion.js +37 -10
  65. package/Libraries/Core/Timers/JSTimers.js +4 -1
  66. package/Libraries/Core/Timers/NativeTiming.js +1 -0
  67. package/Libraries/Core/Timers/immediateShim.js +2 -1
  68. package/Libraries/Core/Timers/queueMicrotask.js +1 -0
  69. package/Libraries/Core/setUpPerformance.js +3 -4
  70. package/Libraries/Debugging/DebuggingOverlayRegistry.js +5 -3
  71. package/Libraries/Image/Image.android.js +327 -111
  72. package/Libraries/Image/Image.ios.js +6 -1
  73. package/Libraries/Image/Image.win32.js +6 -1
  74. package/Libraries/Image/ImageSourceUtils.js +8 -2
  75. package/Libraries/Image/assetPaths.js +1 -1
  76. package/Libraries/Image/resolveAssetSource.js +1 -1
  77. package/Libraries/Image/resolveAssetSource.win32.js +6 -7
  78. package/Libraries/Interaction/InteractionManager.js +118 -167
  79. package/Libraries/Interaction/PanResponder.js +7 -52
  80. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -0
  81. package/Libraries/Lists/FlatList.js +5 -6
  82. package/Libraries/LogBox/Data/LogBoxData.js +5 -2
  83. package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
  84. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +2 -2
  85. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -1
  86. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +1 -1
  87. package/Libraries/Modal/Modal.js +3 -3
  88. package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
  89. package/Libraries/NativeComponent/ViewConfig.js +2 -2
  90. package/Libraries/Network/RCTNetworking.android.js +1 -1
  91. package/Libraries/Network/RCTNetworking.ios.js +1 -1
  92. package/Libraries/Network/RCTNetworking.win32.js +1 -1
  93. package/Libraries/Network/XMLHttpRequest.js +20 -5
  94. package/Libraries/Network/convertRequestBody.js +1 -1
  95. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +10 -9
  96. package/Libraries/Pressability/HoverState.js +2 -0
  97. package/Libraries/Pressability/HoverState.win32.js +2 -0
  98. package/Libraries/Pressability/Pressability.js +1 -1
  99. package/Libraries/Pressability/Pressability.win32.js +1 -1
  100. package/Libraries/PushNotificationIOS/PushNotificationIOS.js +2 -2
  101. package/Libraries/ReactNative/AppRegistryImpl.js +4 -2
  102. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -0
  103. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +3 -3
  104. package/Libraries/ReactNative/RendererImplementation.js +116 -116
  105. package/Libraries/ReactNative/UIManager.js +3 -3
  106. package/Libraries/ReactNative/renderApplication.js +1 -0
  107. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -1
  108. package/Libraries/Renderer/implementations/ReactFabric-dev.js +38 -35
  109. package/Libraries/Renderer/implementations/ReactFabric-prod.js +51 -22
  110. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +54 -24
  111. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +36 -33
  112. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5 -5
  113. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5 -5
  114. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
  115. package/Libraries/Share/Share.js +4 -0
  116. package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +2 -2
  117. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +2 -2
  118. package/Libraries/StyleSheet/PlatformColorValueTypes.win32.js +4 -0
  119. package/Libraries/StyleSheet/StyleSheet.d.ts +7 -22
  120. package/Libraries/StyleSheet/StyleSheetExports.js +2 -8
  121. package/Libraries/StyleSheet/StyleSheetExports.js.flow +11 -18
  122. package/Libraries/StyleSheet/flattenStyle.js +2 -2
  123. package/Libraries/StyleSheet/processAspectRatio.js +2 -0
  124. package/Libraries/StyleSheet/processFilter.js +5 -5
  125. package/Libraries/StyleSheet/splitLayoutProps.js +2 -2
  126. package/Libraries/Text/Text.js +534 -234
  127. package/Libraries/Text/Text.win32.js +647 -274
  128. package/Libraries/Text/TextNativeComponent.js +2 -2
  129. package/Libraries/Text/TextNativeComponent.win32.js +2 -2
  130. package/Libraries/Utilities/Appearance.d.ts +3 -5
  131. package/Libraries/Utilities/Appearance.js +5 -17
  132. package/Libraries/Utilities/HMRClient.js +2 -1
  133. package/Libraries/Utilities/Platform.android.js +3 -3
  134. package/Libraries/Utilities/Platform.d.ts +1 -0
  135. package/Libraries/Utilities/Platform.ios.js +1 -1
  136. package/Libraries/Utilities/Platform.win32.js +3 -3
  137. package/Libraries/Utilities/PlatformTypes.js +1 -1
  138. package/Libraries/Utilities/ReactNativeTestTools.js +12 -0
  139. package/Libraries/Utilities/SceneTracker.js +1 -1
  140. package/Libraries/Utilities/codegenNativeCommands.js +1 -1
  141. package/Libraries/Utilities/codegenNativeComponent.js +1 -1
  142. package/Libraries/Utilities/createPerformanceLogger.js +32 -0
  143. package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +2 -0
  144. package/Libraries/Utilities/differ/pointsDiffer.js +1 -1
  145. package/Libraries/Utilities/useMergeRefs.js +1 -1
  146. package/Libraries/WebSocket/WebSocketInterceptor.js +2 -0
  147. package/Libraries/promiseRejectionTrackingOptions.js +17 -31
  148. package/Libraries/vendor/emitter/EventEmitter.js +1 -1
  149. package/flow/bom.js.flow +223 -1
  150. package/flow/prettier.js.flow +14 -0
  151. package/index.js +14 -2
  152. package/index.win32.js +16 -2
  153. package/jest/local-setup.js +2 -2
  154. package/jest/mock.js +1 -1
  155. package/jest/mockComponent.js +9 -9
  156. package/jest/mockNativeComponent.js +3 -2
  157. package/jest/mocks/Modal.js +1 -1
  158. package/jest/mocks/ScrollView.js +1 -1
  159. package/jest/mocks/ViewNativeComponent.js +1 -1
  160. package/jest/setup.js +23 -12
  161. package/overrides.json +23 -23
  162. package/package.json +28 -27
  163. package/saveAssetPlugin.js +2 -2
  164. package/src/private/animated/NativeAnimatedHelper.js +16 -5
  165. package/src/private/animated/NativeAnimatedHelper.win32.js +16 -5
  166. package/src/private/animated/createAnimatedPropsHook.js +11 -60
  167. package/src/private/animated/createAnimatedPropsMemoHook.js +8 -54
  168. package/src/private/components/virtualview/VirtualView.js +43 -12
  169. package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +93 -0
  170. package/src/private/components/virtualview/VirtualViewNativeComponent.js +6 -0
  171. package/src/private/devsupport/devmenu/elementinspector/Inspector.js +2 -2
  172. package/src/private/devsupport/devmenu/elementinspector/ReactDevToolsOverlay.js +2 -2
  173. package/src/private/featureflags/ReactNativeFeatureFlags.js +85 -52
  174. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
  175. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +15 -6
  176. package/src/private/renderer/errorhandling/ErrorHandlers.js +3 -3
  177. package/src/private/setup/{setUpPerformanceObserver.js → setUpPerformanceModern.js} +43 -18
  178. package/src/private/specs_DEPRECATED/modules/NativeTiming.js +1 -0
  179. package/src/private/types/HostInstance.js +4 -1
  180. package/src/private/webapis/dom/nodes/ReactNativeDocument.js +22 -2
  181. package/src/private/webapis/dom/nodes/ReactNativeElement.js +1 -1
  182. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +5 -3
  183. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +16 -13
  184. package/src/private/webapis/dom/nodes/internals/NodeInternals.js +45 -22
  185. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -1
  186. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +26 -192
  187. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +15 -12
  188. package/src/private/webapis/dom/oldstylecollections/NodeList.js +14 -11
  189. package/src/private/webapis/geometry/DOMRectList.js +2 -2
  190. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +19 -74
  191. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +0 -4
  192. package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +1 -1
  193. package/src/private/webapis/performance/EventTiming.js +40 -25
  194. package/src/private/webapis/performance/LongTasks.js +35 -2
  195. package/src/private/webapis/performance/Performance.js +347 -166
  196. package/src/private/webapis/performance/PerformanceEntry.js +40 -23
  197. package/src/private/webapis/performance/PerformanceObserver.js +37 -29
  198. package/src/private/webapis/performance/ReactNativeStartupTiming.js +3 -24
  199. package/src/private/webapis/performance/ResourceTiming.js +29 -18
  200. package/src/private/webapis/performance/UserTiming.js +92 -34
  201. package/src/private/webapis/performance/UserTimingExtensibility.js.flow +38 -0
  202. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -4
  203. package/src/private/webapis/performance/internals/Utilities.js +9 -0
  204. package/src/private/webapis/performance/specs/NativePerformance.js +23 -23
  205. package/src/private/webapis/structuredClone/structuredClone.js +10 -10
  206. package/src-win/Libraries/Components/Touchable/TouchableWin32.tsx +1 -1
  207. package/Libraries/Interaction/InteractionManagerStub.js +0 -184
  208. package/Libraries/Interaction/TaskQueue.js +0 -183
  209. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +0 -31
@@ -4,176 +4,32 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow strict-local
7
+ * @flow strict
8
8
  * @format
9
9
  */
10
10
 
11
11
  import type {EventSubscription} from '../vendor/emitter/EventEmitter';
12
- import type {Task} from './TaskQueue';
13
12
 
14
- import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
15
- import EventEmitter from '../vendor/emitter/EventEmitter';
16
-
17
- const BatchedBridge = require('../BatchedBridge/BatchedBridge').default;
18
- const TaskQueue = require('./TaskQueue').default;
19
13
  const invariant = require('invariant');
20
14
 
21
- export type {Task, SimpleTask, PromiseTask} from './TaskQueue';
22
-
23
- export type Handle = number;
24
-
25
- const _emitter = new EventEmitter<{
26
- interactionComplete: [],
27
- interactionStart: [],
28
- }>();
29
-
30
- const DEBUG_DELAY: 0 = 0;
31
- const DEBUG: false = false;
32
-
33
- const InteractionManagerImpl = {
34
- Events: {
35
- interactionStart: 'interactionStart',
36
- interactionComplete: 'interactionComplete',
37
- },
38
-
39
- /**
40
- * Schedule a function to run after all interactions have completed. Returns a cancellable
41
- * "promise".
42
- */
43
- runAfterInteractions(task: ?Task): {
44
- then: <U>(
45
- onFulfill?: ?(void) => ?(Promise<U> | U),
46
- onReject?: ?(error: mixed) => ?(Promise<U> | U),
47
- ) => Promise<U>,
48
- cancel: () => void,
49
- ...
50
- } {
51
- const tasks: Array<Task> = [];
52
- const promise = new Promise((resolve: () => void) => {
53
- _scheduleUpdate();
54
- if (task) {
55
- tasks.push(task);
56
- }
57
- tasks.push({
58
- run: resolve,
59
- name: 'resolve ' + ((task && task.name) || '?'),
60
- });
61
- _taskQueue.enqueueTasks(tasks);
62
- });
63
- return {
64
- // $FlowFixMe[method-unbinding] added when improving typing for this parameters
65
- then: promise.then.bind(promise),
66
- cancel: function () {
67
- _taskQueue.cancelTasks(tasks);
68
- },
69
- };
70
- },
71
-
72
- /**
73
- * Notify manager that an interaction has started.
74
- */
75
- createInteractionHandle(): Handle {
76
- DEBUG && console.log('InteractionManager: create interaction handle');
77
- _scheduleUpdate();
78
- const handle = ++_inc;
79
- _addInteractionSet.add(handle);
80
- return handle;
81
- },
82
-
83
- /**
84
- * Notify manager that an interaction has completed.
85
- */
86
- clearInteractionHandle(handle: Handle) {
87
- DEBUG && console.log('InteractionManager: clear interaction handle');
88
- invariant(!!handle, 'InteractionManager: Must provide a handle to clear.');
89
- _scheduleUpdate();
90
- _addInteractionSet.delete(handle);
91
- _deleteInteractionSet.add(handle);
92
- },
93
-
94
- // $FlowFixMe[unclear-type] unclear type of _emitter
95
- // $FlowFixMe[method-unbinding] added when improving typing for this parameters
96
- addListener: _emitter.addListener.bind(_emitter) as (
97
- eventType: string,
98
- // $FlowFixMe[unclear-type] unclear type of arguments
99
- listener: (...args: any) => mixed,
100
- context: mixed,
101
- ) => EventSubscription,
102
-
103
- /**
104
- * A positive number will use setTimeout to schedule any tasks after the
105
- * eventLoopRunningTime hits the deadline value, otherwise all tasks will be
106
- * executed in one setImmediate batch (default).
107
- */
108
- setDeadline(deadline: number) {
109
- _deadline = deadline;
110
- },
15
+ export type SimpleTask = {
16
+ name: string,
17
+ run: () => void,
111
18
  };
19
+ export type PromiseTask = {
20
+ name: string,
21
+ gen: () => Promise<void>,
22
+ };
23
+ export type Task = SimpleTask | PromiseTask | (() => void);
112
24
 
113
- const _interactionSet = new Set<number | Handle>();
114
- const _addInteractionSet = new Set<number | Handle>();
115
- const _deleteInteractionSet = new Set<Handle>();
116
- const _taskQueue = new TaskQueue({onMoreTasks: _scheduleUpdate});
117
- let _nextUpdateHandle: $FlowFixMe | TimeoutID = 0;
118
- let _inc = 0;
119
- let _deadline = -1;
120
-
121
- /**
122
- * Schedule an asynchronous update to the interaction state.
123
- */
124
- function _scheduleUpdate() {
125
- if (!_nextUpdateHandle) {
126
- if (_deadline > 0) {
127
- _nextUpdateHandle = setTimeout(_processUpdate, 0 + DEBUG_DELAY);
128
- } else {
129
- _nextUpdateHandle = setImmediate(_processUpdate);
130
- }
131
- }
132
- }
133
-
134
- /**
135
- * Notify listeners, process queue, etc
136
- */
137
- function _processUpdate() {
138
- _nextUpdateHandle = 0;
139
-
140
- const interactionCount = _interactionSet.size;
141
- _addInteractionSet.forEach(handle => _interactionSet.add(handle));
142
- _deleteInteractionSet.forEach(handle => _interactionSet.delete(handle));
143
- const nextInteractionCount = _interactionSet.size;
144
-
145
- if (interactionCount !== 0 && nextInteractionCount === 0) {
146
- // transition from 1+ --> 0 interactions
147
- /* $FlowFixMe[prop-missing] Natural Inference rollout. See
148
- * https://fburl.com/workplace/6291gfvu */
149
- /* $FlowFixMe[invalid-computed-prop] Natural Inference rollout. See
150
- * https://fburl.com/workplace/6291gfvu */
151
- _emitter.emit(InteractionManager.Events.interactionComplete);
152
- } else if (interactionCount === 0 && nextInteractionCount !== 0) {
153
- // transition from 0 --> 1+ interactions
154
- /* $FlowFixMe[prop-missing] Natural Inference rollout. See
155
- * https://fburl.com/workplace/6291gfvu */
156
- /* $FlowFixMe[invalid-computed-prop] Natural Inference rollout. See
157
- * https://fburl.com/workplace/6291gfvu */
158
- _emitter.emit(InteractionManager.Events.interactionStart);
159
- }
25
+ export type Handle = number;
160
26
 
161
- // process the queue regardless of a transition
162
- if (nextInteractionCount === 0) {
163
- while (_taskQueue.hasTasksToProcess()) {
164
- _taskQueue.processNext();
165
- if (
166
- _deadline > 0 &&
167
- BatchedBridge.getEventLoopRunningTime() >= _deadline
168
- ) {
169
- // Hit deadline before processing all tasks, so process more later.
170
- _scheduleUpdate();
171
- break;
172
- }
173
- }
174
- }
175
- _addInteractionSet.clear();
176
- _deleteInteractionSet.clear();
27
+ // NOTE: The original implementation of `InteractionManager` never rejected
28
+ // the returned promise. This preserves that behavior in the stub.
29
+ function reject(error: Error): void {
30
+ setTimeout(() => {
31
+ throw error;
32
+ }, 0);
177
33
  }
178
34
 
179
35
  /**
@@ -227,11 +83,106 @@ function _processUpdate() {
227
83
  *
228
84
  * @deprecated
229
85
  */
230
- const InteractionManager = (
231
- ReactNativeFeatureFlags.disableInteractionManager()
232
- ? // $FlowFixMe[incompatible-variance]
233
- require('./InteractionManagerStub').default
234
- : InteractionManagerImpl
235
- ) as typeof InteractionManagerImpl;
86
+ const InteractionManagerStub = {
87
+ Events: {
88
+ interactionStart: 'interactionStart',
89
+ interactionComplete: 'interactionComplete',
90
+ },
91
+
92
+ /**
93
+ * Schedule a function to run after all interactions have completed. Returns a cancellable
94
+ * "promise".
95
+ *
96
+ * @deprecated
97
+ */
98
+ runAfterInteractions(task: ?Task): {
99
+ then: <U>(
100
+ onFulfill?: ?(void) => ?(Promise<U> | U),
101
+ onReject?: ?(error: mixed) => ?(Promise<U> | U),
102
+ ) => Promise<U>,
103
+ cancel: () => void,
104
+ ...
105
+ } {
106
+ let immediateID: ?$FlowFixMe;
107
+ const promise = new Promise(resolve => {
108
+ immediateID = setImmediate(() => {
109
+ if (typeof task === 'object' && task !== null) {
110
+ if (typeof task.gen === 'function') {
111
+ task.gen().then(resolve, reject);
112
+ } else if (typeof task.run === 'function') {
113
+ try {
114
+ task.run();
115
+ resolve();
116
+ } catch (error) {
117
+ reject(error);
118
+ }
119
+ } else {
120
+ reject(new TypeError(`Task "${task.name}" missing gen or run.`));
121
+ }
122
+ } else if (typeof task === 'function') {
123
+ try {
124
+ task();
125
+ resolve();
126
+ } catch (error) {
127
+ reject(error);
128
+ }
129
+ } else {
130
+ reject(new TypeError('Invalid task of type: ' + typeof task));
131
+ }
132
+ });
133
+ });
134
+
135
+ return {
136
+ // $FlowFixMe[method-unbinding] added when improving typing for this parameters
137
+ then: promise.then.bind(promise),
138
+ cancel() {
139
+ clearImmediate(immediateID);
140
+ },
141
+ };
142
+ },
143
+
144
+ /**
145
+ * Notify manager that an interaction has started.
146
+ *
147
+ * @deprecated
148
+ */
149
+ createInteractionHandle(): Handle {
150
+ return -1;
151
+ },
152
+
153
+ /**
154
+ * Notify manager that an interaction has completed.
155
+ *
156
+ * @deprecated
157
+ */
158
+ clearInteractionHandle(handle: Handle) {
159
+ invariant(!!handle, 'InteractionManager: Must provide a handle to clear.');
160
+ },
161
+
162
+ /**
163
+ * @deprecated
164
+ */
165
+ addListener(
166
+ eventType: string,
167
+ // $FlowFixMe[unclear-type]
168
+ listener: (...args: any) => mixed,
169
+ context: mixed,
170
+ ): EventSubscription {
171
+ return {
172
+ remove() {},
173
+ };
174
+ },
175
+
176
+ /**
177
+ * A positive number will use setTimeout to schedule any tasks after the
178
+ * eventLoopRunningTime hits the deadline value, otherwise all tasks will be
179
+ * executed in one setImmediate batch (default).
180
+ *
181
+ * @deprecated
182
+ */
183
+ setDeadline(deadline: number) {
184
+ // Do nothing.
185
+ },
186
+ };
236
187
 
237
- export default InteractionManager;
188
+ export default InteractionManagerStub;
@@ -12,7 +12,6 @@
12
12
 
13
13
  import type {GestureResponderEvent} from '../Types/CoreEventTypes';
14
14
 
15
- const InteractionManager = require('./InteractionManager').default;
16
15
  const TouchHistoryMath = require('./TouchHistoryMath').default;
17
16
 
18
17
  const currentCentroidXOfTouchesChangedAfter =
@@ -31,9 +30,6 @@ const currentCentroidY = TouchHistoryMath.currentCentroidY;
31
30
  * single-touch gestures resilient to extra touches, and can be used to
32
31
  * recognize simple multi-touch gestures.
33
32
  *
34
- * By default, `PanResponder` holds an `InteractionManager` handle to block
35
- * long-running JS events from interrupting active gestures.
36
- *
37
33
  * It provides a predictable wrapper of the responder handlers provided by the
38
34
  * [gesture responder system](docs/gesture-responder-system.html).
39
35
  * For each handler, it provides a new `gestureState` object alongside the
@@ -405,9 +401,6 @@ const PanResponder = {
405
401
  getInteractionHandle: () => ?number,
406
402
  panHandlers: GestureResponderHandlerMethods,
407
403
  } {
408
- const interactionState = {
409
- handle: (null: ?number),
410
- };
411
404
  const gestureState: PanResponderGestureState = {
412
405
  // Useful for debugging
413
406
  stateID: Math.random(),
@@ -422,7 +415,7 @@ const PanResponder = {
422
415
  numberActiveTouches: 0,
423
416
  _accountsForMovesUpTo: 0,
424
417
  };
425
- const panHandlers = {
418
+ const panHandlers: GestureResponderHandlerMethods = {
426
419
  onStartShouldSetResponder(event: GestureResponderEvent): boolean {
427
420
  return config.onStartShouldSetPanResponder == null
428
421
  ? false
@@ -464,10 +457,6 @@ const PanResponder = {
464
457
  },
465
458
 
466
459
  onResponderGrant(event: GestureResponderEvent): boolean {
467
- if (!interactionState.handle) {
468
- interactionState.handle =
469
- InteractionManager.createInteractionHandle();
470
- }
471
460
  gestureState.x0 = currentCentroidX(event.touchHistory);
472
461
  gestureState.y0 = currentCentroidY(event.touchHistory);
473
462
  gestureState.dx = 0;
@@ -482,21 +471,11 @@ const PanResponder = {
482
471
  },
483
472
 
484
473
  onResponderReject(event: GestureResponderEvent): void {
485
- clearInteractionHandle(
486
- interactionState,
487
- config.onPanResponderReject,
488
- event,
489
- gestureState,
490
- );
474
+ config.onPanResponderReject?.call(undefined, event, gestureState);
491
475
  },
492
476
 
493
477
  onResponderRelease(event: GestureResponderEvent): void {
494
- clearInteractionHandle(
495
- interactionState,
496
- config.onPanResponderRelease,
497
- event,
498
- gestureState,
499
- );
478
+ config.onPanResponderRelease?.call(undefined, event, gestureState);
500
479
  PanResponder._initializeGestureState(gestureState);
501
480
  },
502
481
 
@@ -529,21 +508,11 @@ const PanResponder = {
529
508
  onResponderEnd(event: GestureResponderEvent): void {
530
509
  const touchHistory = event.touchHistory;
531
510
  gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
532
- clearInteractionHandle(
533
- interactionState,
534
- config.onPanResponderEnd,
535
- event,
536
- gestureState,
537
- );
511
+ config.onPanResponderEnd?.call(undefined, event, gestureState);
538
512
  },
539
513
 
540
514
  onResponderTerminate(event: GestureResponderEvent): void {
541
- clearInteractionHandle(
542
- interactionState,
543
- config.onPanResponderTerminate,
544
- event,
545
- gestureState,
546
- );
515
+ config.onPanResponderTerminate?.call(undefined, event, gestureState);
547
516
  PanResponder._initializeGestureState(gestureState);
548
517
  },
549
518
 
@@ -556,27 +525,13 @@ const PanResponder = {
556
525
  return {
557
526
  panHandlers,
558
527
  getInteractionHandle(): ?number {
559
- return interactionState.handle;
528
+ // TODO: Deprecate and delete this method.
529
+ return null;
560
530
  },
561
531
  };
562
532
  },
563
533
  };
564
534
 
565
- function clearInteractionHandle(
566
- interactionState: {handle: ?number, ...},
567
- callback: ?(ActiveCallback | PassiveCallback),
568
- event: GestureResponderEvent,
569
- gestureState: PanResponderGestureState,
570
- ) {
571
- if (interactionState.handle) {
572
- InteractionManager.clearInteractionHandle(interactionState.handle);
573
- interactionState.handle = null;
574
- }
575
- if (callback) {
576
- callback(event, gestureState);
577
- }
578
- }
579
-
580
535
  export type PanResponderInstance = ReturnType<(typeof PanResponder)['create']>;
581
536
 
582
537
  export default PanResponder;
@@ -108,6 +108,8 @@ function configureNext(
108
108
  if (UIManager?.configureNextLayoutAnimation) {
109
109
  UIManager.configureNextLayoutAnimation(
110
110
  config,
111
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
112
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
111
113
  onAnimationComplete ?? function () {},
112
114
  onAnimationDidFail ??
113
115
  function () {} /* this should never be called in Non-Fabric */,
@@ -432,7 +432,7 @@ class FlatList<ItemT = any> extends React.PureComponent<FlatListProps<ItemT>> {
432
432
  }));
433
433
  } else if (this.props.onViewableItemsChanged) {
434
434
  this._virtualizedListPairs.push({
435
- /* $FlowFixMe[incompatible-call] (>=0.63.0 site=react_native_fb) This
435
+ /* $FlowFixMe[incompatible-type] (>=0.63.0 site=react_native_fb) This
436
436
  * comment suppresses an error found when Flow v0.63 was deployed. To
437
437
  * see the error delete this comment and run Flow. */
438
438
  viewabilityConfig: this.props.viewabilityConfig,
@@ -569,7 +569,7 @@ class FlatList<ItemT = any> extends React.PureComponent<FlatListProps<ItemT>> {
569
569
  .join(':');
570
570
  }
571
571
 
572
- // $FlowFixMe[incompatible-call] Can't call keyExtractor with an array
572
+ // $FlowFixMe[incompatible-type] Can't call keyExtractor with an array
573
573
  return keyExtractor(items, index);
574
574
  };
575
575
 
@@ -626,11 +626,10 @@ class FlatList<ItemT = any> extends React.PureComponent<FlatListProps<ItemT>> {
626
626
  const render = (props: ListRenderItemInfo<ItemT>): React.Node => {
627
627
  if (ListItemComponent) {
628
628
  // $FlowFixMe[not-a-component] Component isn't valid
629
- // $FlowFixMe[incompatible-type-arg] Component isn't valid
630
- // $FlowFixMe[incompatible-return] Component isn't valid
629
+ // $FlowFixMe[incompatible-type] Component isn't valid
631
630
  return <ListItemComponent {...props} />;
632
631
  } else if (renderItem) {
633
- // $FlowFixMe[incompatible-call]
632
+ // $FlowFixMe[incompatible-type]
634
633
  return renderItem(props);
635
634
  } else {
636
635
  return null;
@@ -648,7 +647,7 @@ class FlatList<ItemT = any> extends React.PureComponent<FlatListProps<ItemT>> {
648
647
  <View style={StyleSheet.compose(styles.row, columnWrapperStyle)}>
649
648
  {item.map((it, kk) => {
650
649
  const element = render({
651
- // $FlowFixMe[incompatible-call]
650
+ // $FlowFixMe[incompatible-type]
652
651
  item: it,
653
652
  index: index * cols + kk,
654
653
  separators: info.separators,
@@ -20,7 +20,6 @@ import type {
20
20
 
21
21
  import DebuggerSessionObserver from '../../../src/private/devsupport/rndevtools/FuseboxSessionObserver';
22
22
  import parseErrorStack from '../../Core/Devtools/parseErrorStack';
23
- import NativeDevSettings from '../../NativeModules/specs/NativeDevSettings';
24
23
  import NativeLogBox from '../../NativeModules/specs/NativeLogBox';
25
24
  import LogBoxLog from './LogBoxLog';
26
25
  import {parseLogBoxException} from './parseLogBoxLog';
@@ -443,7 +442,7 @@ export function withSubscription(
443
442
  componentDidCatch(err: Error, errorInfo: {componentStack: string, ...}) {
444
443
  /* $FlowFixMe[class-object-subtyping] added when improving typing for
445
444
  * this parameters */
446
- // $FlowFixMe[incompatible-call]
445
+ // $FlowFixMe[incompatible-type]
447
446
  reportLogBoxError(err, errorInfo.componentStack);
448
447
  }
449
448
 
@@ -493,6 +492,10 @@ function showFuseboxWarningsMigrationMessageOnce() {
493
492
  return;
494
493
  }
495
494
  hasShownFuseboxWarningsMigrationMessage = true;
495
+
496
+ const NativeDevSettings =
497
+ require('../../NativeModules/specs/NativeDevSettings').default;
498
+
496
499
  appendNewLog(
497
500
  new LogBoxLog({
498
501
  level: 'warn',
@@ -509,7 +509,7 @@ export function parseLogBoxLog(args: $ReadOnlyArray<mixed>): {
509
509
  return {
510
510
  ...parseInterpolation(argsWithoutComponentStack),
511
511
  componentStack,
512
- /* $FlowFixMe[incompatible-return] Natural Inference rollout. See
512
+ /* $FlowFixMe[incompatible-type] Natural Inference rollout. See
513
513
  * https://fburl.com/workplace/6291gfvu */
514
514
  componentStackType,
515
515
  };
@@ -61,7 +61,7 @@ export default function LogBoxInspectorHeader(props: Props): React.Node {
61
61
  id="logbox_header_button_prev"
62
62
  disabled={props.total <= 1}
63
63
  level={props.level}
64
- image={require('./LogBoxImages/chevron-left.png')}
64
+ image={new String('')}
65
65
  onPress={() => props.onSelectIndex(prevIndex)}
66
66
  />
67
67
  <View style={styles.title}>
@@ -73,7 +73,7 @@ export default function LogBoxInspectorHeader(props: Props): React.Node {
73
73
  id="logbox_header_button_next"
74
74
  disabled={props.total <= 1}
75
75
  level={props.level}
76
- image={require('./LogBoxImages/chevron-right.png')}
76
+ image={new String('')}
77
77
  onPress={() => props.onSelectIndex(nextIndex)}
78
78
  />
79
79
  </View>
@@ -42,7 +42,7 @@ function LogBoxInspectorSourceMapStatus(props: Props): React.Node {
42
42
  useNativeDriver: true,
43
43
  }),
44
44
  );
45
- // $FlowFixMe[incompatible-call]
45
+ // $FlowFixMe[incompatible-type]
46
46
  setState({
47
47
  animation,
48
48
  rotate: animated.interpolate({
@@ -44,7 +44,7 @@ function LogBoxInspectorSourceMapStatus(props: Props): React.Node {
44
44
  useNativeDriver: true,
45
45
  }),
46
46
  );
47
- // $FlowFixMe[incompatible-call]
47
+ // $FlowFixMe[incompatible-type]
48
48
  setState({
49
49
  animation,
50
50
  rotate: animated.interpolate({
@@ -292,7 +292,7 @@ class Modal extends React.Component<ModalProps, ModalState> {
292
292
  backgroundColor:
293
293
  this.props.transparent === true
294
294
  ? 'transparent'
295
- : this.props.backdropColor ?? 'white',
295
+ : (this.props.backdropColor ?? 'white'),
296
296
  };
297
297
 
298
298
  let animationType = this.props.animationType || 'none';
@@ -370,13 +370,13 @@ const styles = StyleSheet.create({
370
370
  modal: {
371
371
  position: 'absolute',
372
372
  },
373
- /* $FlowFixMe[incompatible-call] Natural Inference rollout. See
373
+ /* $FlowFixMe[incompatible-type] Natural Inference rollout. See
374
374
  * https://fburl.com/workplace/6291gfvu */
375
375
  container: {
376
376
  /* $FlowFixMe[invalid-computed-prop] (>=0.111.0 site=react_native_fb) This
377
377
  * comment suppresses an error found when Flow v0.111 was deployed. To see
378
378
  * the error, delete this comment and run Flow. */
379
- // $FlowFixMe[incompatible-call]
379
+ // $FlowFixMe[incompatible-type]
380
380
  [side]: 0,
381
381
  top: 0,
382
382
  flex: 1,
@@ -108,7 +108,7 @@ export function get<Config: {...}>(
108
108
  return viewConfig;
109
109
  });
110
110
 
111
- // $FlowFixMe[incompatible-return] `NativeComponent` is actually string!
111
+ // $FlowFixMe[incompatible-type] `NativeComponent` is actually string!
112
112
  return name;
113
113
  }
114
114
 
@@ -32,7 +32,7 @@ export function createViewConfig(
32
32
  PlatformBaseViewConfig.directEventTypes,
33
33
  partialViewConfig.directEventTypes,
34
34
  ),
35
- // $FlowFixMe[incompatible-return]
35
+ // $FlowFixMe[incompatible-type]
36
36
  validAttributes: composeIndexers(
37
37
  // $FlowFixMe[incompatible-call] `style` property confuses Flow.
38
38
  PlatformBaseViewConfig.validAttributes,
@@ -47,6 +47,6 @@ function composeIndexers<T>(
47
47
  maybeB: ?{+[string]: T},
48
48
  ): {+[string]: T} {
49
49
  return maybeA == null || maybeB == null
50
- ? maybeA ?? maybeB ?? {}
50
+ ? (maybeA ?? maybeB ?? {})
51
51
  : {...maybeA, ...maybeB};
52
52
  }
@@ -53,7 +53,7 @@ const RCTNetworking = {
53
53
  listener: (...RCTNetworkingEventDefinitions[K]) => mixed,
54
54
  context?: mixed,
55
55
  ): EventSubscription {
56
- // $FlowFixMe[incompatible-call]
56
+ // $FlowFixMe[incompatible-type]
57
57
  return emitter.addListener(eventType, listener, context);
58
58
  },
59
59
 
@@ -23,7 +23,7 @@ const RCTNetworking = {
23
23
  listener: (...RCTNetworkingEventDefinitions[K]) => mixed,
24
24
  context?: mixed,
25
25
  ): EventSubscription {
26
- // $FlowFixMe[incompatible-call]
26
+ // $FlowFixMe[incompatible-type]
27
27
  return RCTDeviceEventEmitter.addListener(eventType, listener, context);
28
28
  },
29
29
 
@@ -23,7 +23,7 @@ const RCTNetworking = {
23
23
  listener: (...RCTNetworkingEventDefinitions[K]) => mixed,
24
24
  context?: mixed,
25
25
  ): EventSubscription {
26
- // $FlowFixMe[incompatible-call]
26
+ // $FlowFixMe[incompatible-type]
27
27
  return RCTDeviceEventEmitter.addListener(eventType, listener, context);
28
28
  },
29
29