@office-iss/react-native-win32 0.0.0-canary.285 → 0.0.0-canary.286

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 (217) hide show
  1. package/.flowconfig +1 -1
  2. package/CHANGELOG.json +16 -1
  3. package/CHANGELOG.md +16 -8
  4. package/IntegrationTests/LayoutEventsTest.js +16 -11
  5. package/Libraries/Alert/Alert.js +51 -5
  6. package/Libraries/Alert/Alert.win32.js +50 -5
  7. package/Libraries/Animated/animations/Animation.js +1 -4
  8. package/Libraries/Animated/nodes/AnimatedObject.js +1 -0
  9. package/Libraries/AppState/AppState.js +24 -7
  10. package/Libraries/BatchedBridge/MessageQueue.js +3 -2
  11. package/Libraries/BatchedBridge/NativeModules.js +2 -1
  12. package/Libraries/Blob/Blob.js +1 -1
  13. package/Libraries/Blob/FileReader_old.js +9 -9
  14. package/Libraries/Blob/URL.js +1 -1
  15. package/Libraries/Blob/URLSearchParams.js +9 -9
  16. package/Libraries/Components/Button.js +3 -3
  17. package/Libraries/Components/Button.win32.js +3 -6
  18. package/Libraries/Components/LayoutConformance/LayoutConformance.js +1 -1
  19. package/Libraries/Components/Pressable/Pressable.js +9 -9
  20. package/Libraries/Components/Pressable/Pressable.win32.js +9 -9
  21. package/Libraries/Components/Pressable/useAndroidRippleForView.js +7 -7
  22. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +7 -1
  23. package/Libraries/Components/RefreshControl/RefreshControl.js +1 -1
  24. package/Libraries/Components/ScrollView/ScrollView.js +74 -59
  25. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +5 -5
  26. package/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +5 -2
  27. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +3 -3
  28. package/Libraries/Components/Switch/Switch.js +2 -2
  29. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +3 -1
  30. package/Libraries/Components/TextInput/TextInput.flow.js +15 -13
  31. package/Libraries/Components/TextInput/TextInput.js +16 -14
  32. package/Libraries/Components/TextInput/TextInput.win32.js +16 -14
  33. package/Libraries/Components/TextInput/TextInputState.js +1 -1
  34. package/Libraries/Components/TextInput/TextInputState.win32.js +1 -1
  35. package/Libraries/Components/Touchable/Touchable.js +16 -16
  36. package/Libraries/Components/Touchable/Touchable.win32.js +16 -16
  37. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -2
  38. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +7 -7
  39. package/Libraries/Components/View/ReactNativeStyleAttributes.js +16 -2
  40. package/Libraries/Components/View/ViewAccessibility.js +243 -3
  41. package/Libraries/Components/View/ViewAccessibility.win32.js +243 -3
  42. package/Libraries/Components/View/ViewPropTypes.d.ts +14 -14
  43. package/Libraries/Components/View/ViewPropTypes.js +35 -226
  44. package/Libraries/Components/View/ViewPropTypes.win32.js +37 -229
  45. package/Libraries/Core/Devtools/symbolicateStackTrace.js +1 -1
  46. package/Libraries/Core/InitializeCore.js +2 -1
  47. package/Libraries/Core/ReactNativeVersion.js +1 -1
  48. package/Libraries/Core/Timers/JSTimers.js +6 -4
  49. package/Libraries/Core/setUpBatchedBridge.js +9 -5
  50. package/Libraries/Core/setUpDeveloperTools.js +3 -29
  51. package/Libraries/Core/setUpReactDevTools.js +1 -1
  52. package/Libraries/Core/setUpReactRefresh.js +1 -1
  53. package/Libraries/Core/setUpXHR.js +5 -2
  54. package/Libraries/EventEmitter/NativeEventEmitter.js +8 -2
  55. package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +5 -4
  56. package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +3 -2
  57. package/Libraries/Events/CustomEvent.js +1 -1
  58. package/Libraries/Events/EventPolyfill.js +2 -2
  59. package/Libraries/Image/AssetSourceResolver.js +1 -1
  60. package/Libraries/Image/ImageProps.js +8 -5
  61. package/Libraries/Image/ImageViewNativeComponent.js +1 -1
  62. package/Libraries/Image/resolveAssetSource.win32.js +1 -1
  63. package/Libraries/Interaction/InteractionManager.js +1 -1
  64. package/Libraries/Interaction/InteractionManagerStub.js +9 -1
  65. package/Libraries/Interaction/JSEventLoopWatchdog.js +1 -1
  66. package/Libraries/Interaction/PanResponder.js +32 -29
  67. package/Libraries/Interaction/TaskQueue.js +1 -1
  68. package/Libraries/LayoutAnimation/LayoutAnimation.js +18 -4
  69. package/Libraries/Lists/FillRateHelper.js +3 -3
  70. package/Libraries/Lists/FlatList.js +13 -13
  71. package/Libraries/Lists/SectionList.js +3 -1
  72. package/Libraries/Lists/SectionListModern.js +3 -1
  73. package/Libraries/Lists/ViewabilityHelper.js +3 -2
  74. package/Libraries/Lists/VirtualizeUtils.js +3 -3
  75. package/Libraries/Lists/VirtualizedList.js +5 -5
  76. package/Libraries/Lists/VirtualizedListContext.js +4 -2
  77. package/Libraries/Lists/VirtualizedSectionList.js +4 -2
  78. package/Libraries/LogBox/LogBox.js +9 -1
  79. package/Libraries/LogBox/UI/AnsiHighlight.js +7 -3
  80. package/Libraries/LogBox/UI/LogBoxButton.js +4 -2
  81. package/Libraries/LogBox/UI/LogBoxInspector.js +1 -1
  82. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +11 -3
  83. package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +2 -0
  84. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +8 -2
  85. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +8 -2
  86. package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +2 -0
  87. package/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js +4 -2
  88. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +3 -1
  89. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +3 -1
  90. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +2 -2
  91. package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +5 -3
  92. package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.win32.js +5 -3
  93. package/Libraries/LogBox/UI/LogBoxNotification.js +6 -2
  94. package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +3 -1
  95. package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +2 -0
  96. package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +4 -1
  97. package/Libraries/Modal/Modal.js +74 -81
  98. package/Libraries/NativeComponent/BaseViewConfig.android.js +16 -6
  99. package/Libraries/NativeComponent/BaseViewConfig.ios.js +19 -9
  100. package/Libraries/NativeComponent/BaseViewConfig.win32.js +19 -9
  101. package/Libraries/NativeComponent/StaticViewConfigValidator.js +5 -1
  102. package/Libraries/Network/FormData.js +1 -1
  103. package/Libraries/Network/XMLHttpRequest.js +5 -6
  104. package/Libraries/Network/XMLHttpRequest_new.js +3 -2
  105. package/Libraries/Network/XMLHttpRequest_old.js +3 -2
  106. package/Libraries/Network/convertRequestBody.js +4 -3
  107. package/Libraries/Network/fetch.js +4 -3
  108. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +63 -61
  109. package/Libraries/Pressability/Pressability.js +23 -23
  110. package/Libraries/Pressability/Pressability.win32.js +23 -23
  111. package/Libraries/PushNotificationIOS/PushNotificationIOS.js +119 -16
  112. package/Libraries/ReactNative/AppContainer-dev.js +2 -1
  113. package/Libraries/ReactNative/AppRegistry.js +3 -3
  114. package/Libraries/ReactNative/PaperUIManager.js +3 -2
  115. package/Libraries/ReactNative/PaperUIManager.win32.js +3 -2
  116. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +2 -1
  117. package/Libraries/ReactNative/RootTag.js +1 -1
  118. package/Libraries/ReactNative/getNativeComponentAttributes.js +4 -4
  119. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +6 -4
  120. package/Libraries/Renderer/shims/ReactNativeTypes.js +4 -5
  121. package/Libraries/Settings/Settings.js +2 -2
  122. package/Libraries/Settings/Settings.win32.js +2 -2
  123. package/Libraries/Share/Share.js +10 -3
  124. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +1 -1
  125. package/Libraries/StyleSheet/StyleSheet.js +1 -1
  126. package/Libraries/StyleSheet/StyleSheet.win32.js +2 -2
  127. package/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js +1 -1
  128. package/Libraries/StyleSheet/flattenStyle.js +1 -1
  129. package/Libraries/StyleSheet/normalizeColor.js +1 -1
  130. package/Libraries/StyleSheet/processAspectRatio.js +1 -1
  131. package/Libraries/StyleSheet/processColor.js +2 -2
  132. package/Libraries/StyleSheet/processFilter.js +4 -0
  133. package/Libraries/StyleSheet/processFontVariant.js +1 -1
  134. package/Libraries/StyleSheet/processTransform.js +1 -1
  135. package/Libraries/StyleSheet/setNormalizedColorAlpha.js +1 -1
  136. package/Libraries/Text/Text.js +15 -15
  137. package/Libraries/Text/Text.win32.js +15 -15
  138. package/Libraries/Text/TextAncestor.js +1 -1
  139. package/Libraries/Text/TextNativeComponent.js +2 -2
  140. package/Libraries/Text/TextNativeComponent.win32.js +2 -2
  141. package/Libraries/Text/TextProps.js +11 -11
  142. package/Libraries/Text/TextProps.win32.js +11 -11
  143. package/Libraries/Types/CodegenTypes.js +3 -3
  144. package/Libraries/Types/CoreEventTypes.js +103 -72
  145. package/Libraries/Types/CoreEventTypes.win32.js +115 -79
  146. package/Libraries/UTFSequence.js +2 -1
  147. package/Libraries/Utilities/BackHandler.android.js +1 -1
  148. package/Libraries/Utilities/BackHandler.ios.js +5 -5
  149. package/Libraries/Utilities/BackHandler.win32.js +1 -1
  150. package/Libraries/Utilities/DevLoadingView.js +1 -1
  151. package/Libraries/Utilities/DevSettings.js +1 -1
  152. package/Libraries/Utilities/DeviceInfo.js +1 -1
  153. package/Libraries/Utilities/DeviceInfo.win32.js +1 -1
  154. package/Libraries/Utilities/FeatureDetection.js +2 -4
  155. package/Libraries/Utilities/FocusManager.win32.js +3 -3
  156. package/Libraries/Utilities/GlobalPerformanceLogger.js +1 -1
  157. package/Libraries/Utilities/HMRClient.js +5 -33
  158. package/Libraries/Utilities/HMRClientProdShim.js +1 -2
  159. package/Libraries/Utilities/Platform.android.js +2 -2
  160. package/Libraries/Utilities/Platform.ios.js +2 -2
  161. package/Libraries/Utilities/Platform.win32.js +2 -2
  162. package/Libraries/Utilities/{Platform.flow.win32.js → PlatformTypes.js} +1 -0
  163. package/Libraries/Utilities/PolyfillFunctions.js +3 -5
  164. package/Libraries/Utilities/RCTLog.js +1 -1
  165. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  166. package/Libraries/Utilities/SceneTracker.js +1 -1
  167. package/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js +2 -2
  168. package/Libraries/Utilities/binaryToBase64.js +1 -1
  169. package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +1 -1
  170. package/Libraries/Utilities/defineLazyObjectProperty.js +1 -1
  171. package/Libraries/Utilities/differ/deepDiffer.js +3 -3
  172. package/Libraries/Utilities/differ/insetsDiffer.js +3 -3
  173. package/Libraries/Utilities/differ/matricesDiffer.js +3 -6
  174. package/Libraries/Utilities/differ/pointsDiffer.js +3 -3
  175. package/Libraries/Utilities/differ/sizesDiffer.js +3 -3
  176. package/Libraries/Utilities/dismissKeyboard.js +1 -1
  177. package/Libraries/Utilities/infoLog.js +1 -1
  178. package/Libraries/Utilities/logError.js +1 -1
  179. package/Libraries/Utilities/mapWithSeparator.js +1 -1
  180. package/Libraries/Utilities/warnOnce.js +1 -1
  181. package/Libraries/Vibration/Vibration.js +3 -3
  182. package/Libraries/vendor/emitter/EventEmitter.js +21 -9
  183. package/index.js +113 -199
  184. package/index.win32.js +21 -13
  185. package/jest/setup.js +9 -2
  186. package/overrides.json +35 -34
  187. package/package.json +15 -15
  188. package/src/private/devmenu/DevMenu.js +1 -1
  189. package/src/private/featureflags/ReactNativeFeatureFlags.js +22 -23
  190. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +4 -7
  191. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -4
  192. package/src/private/inspector/BoxInspector.js +1 -1
  193. package/src/private/inspector/ElementBox.js +3 -2
  194. package/src/private/inspector/ElementProperties.js +5 -3
  195. package/src/private/inspector/Inspector.js +2 -2
  196. package/src/private/inspector/InspectorOverlay.js +4 -4
  197. package/src/private/inspector/InspectorPanel.js +1 -1
  198. package/src/private/inspector/NetworkOverlay.js +4 -4
  199. package/src/private/inspector/PerformanceOverlay.js +3 -2
  200. package/src/private/inspector/ReactDevToolsOverlay.js +3 -3
  201. package/src/private/inspector/StyleInspector.js +1 -1
  202. package/src/private/inspector/XHRInterceptor.js +5 -2
  203. package/src/private/renderer/errorhandling/ErrorHandlers.js +2 -1
  204. package/src/private/specs_DEPRECATED/modules/NativeExceptionsManager.js +1 -1
  205. package/src/private/specs_DEPRECATED/modules/NativePermissionsAndroid.js +5 -4
  206. package/src/private/specs_DEPRECATED/modules/NativeUIManager.js +92 -19
  207. package/src/private/webapis/dom/events/CustomEvent.js +5 -7
  208. package/src/private/webapis/dom/events/Event.js +5 -5
  209. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -0
  210. package/src/private/webapis/html/events/MessageEvent.js +12 -19
  211. package/src/private/webapis/websockets/events/CloseEvent.js +9 -11
  212. package/src/private/webapis/xhr/events/ProgressEvent.js +9 -11
  213. package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +14 -14
  214. package/Libraries/Alert/Alert.flow.js +0 -62
  215. package/Libraries/Alert/RCTAlertManager.flow.js +0 -20
  216. package/Libraries/Utilities/Platform.flow.js +0 -91
  217. package/flow/react.js +0 -15
@@ -15,25 +15,21 @@ import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
15
15
  import type {
16
16
  BlurEvent,
17
17
  FocusEvent,
18
- Layout,
19
- LayoutEvent,
18
+ LayoutChangeEvent,
19
+ LayoutRectangle,
20
20
  MouseEvent,
21
21
  PointerEvent,
22
- PressEvent,
22
+ GestureResponderEvent,
23
23
  KeyEvent, // [Windows]
24
24
  } from '../../Types/CoreEventTypes';
25
25
  import type {
26
26
  AccessibilityActionEvent,
27
- AccessibilityActionInfo,
28
- AccessibilityRole,
29
- AccessibilityState,
30
- AccessibilityValue,
31
- Role,
27
+ AccessibilityProps,
32
28
  } from './ViewAccessibility';
33
29
  import type {Node} from 'react';
34
30
 
35
- export type ViewLayout = Layout;
36
- export type ViewLayoutEvent = LayoutEvent;
31
+ export type ViewLayout = LayoutRectangle;
32
+ export type ViewLayoutEvent = LayoutChangeEvent;
37
33
 
38
34
  type DirectEventProps = $ReadOnly<{
39
35
  /**
@@ -62,7 +58,7 @@ type DirectEventProps = $ReadOnly<{
62
58
  *
63
59
  * See https://reactnative.dev/docs/view#onlayout
64
60
  */
65
- onLayout?: ?(event: LayoutEvent) => mixed,
61
+ onLayout?: ?(event: LayoutChangeEvent) => mixed,
66
62
 
67
63
  /**
68
64
  * When `accessible` is `true`, the system will invoke this function when the
@@ -120,14 +116,14 @@ type FocusEventProps = $ReadOnly<{
120
116
  }>;
121
117
 
122
118
  type TouchEventProps = $ReadOnly<{
123
- onTouchCancel?: ?(e: PressEvent) => void,
124
- onTouchCancelCapture?: ?(e: PressEvent) => void,
125
- onTouchEnd?: ?(e: PressEvent) => void,
126
- onTouchEndCapture?: ?(e: PressEvent) => void,
127
- onTouchMove?: ?(e: PressEvent) => void,
128
- onTouchMoveCapture?: ?(e: PressEvent) => void,
129
- onTouchStart?: ?(e: PressEvent) => void,
130
- onTouchStartCapture?: ?(e: PressEvent) => void,
119
+ onTouchCancel?: ?(e: GestureResponderEvent) => void,
120
+ onTouchCancelCapture?: ?(e: GestureResponderEvent) => void,
121
+ onTouchEnd?: ?(e: GestureResponderEvent) => void,
122
+ onTouchEndCapture?: ?(e: GestureResponderEvent) => void,
123
+ onTouchMove?: ?(e: GestureResponderEvent) => void,
124
+ onTouchMoveCapture?: ?(e: GestureResponderEvent) => void,
125
+ onTouchStart?: ?(e: GestureResponderEvent) => void,
126
+ onTouchStartCapture?: ?(e: GestureResponderEvent) => void,
131
127
  }>;
132
128
 
133
129
  /**
@@ -135,7 +131,7 @@ type TouchEventProps = $ReadOnly<{
135
131
  * `TouchableHighlight` or `TouchableOpacity`. Check out `Touchable.js`,
136
132
  * `ScrollResponder.js` and `ResponderEventPlugin.js` for more discussion.
137
133
  */
138
- type GestureResponderEventProps = $ReadOnly<{
134
+ export type GestureResponderHandlers = $ReadOnly<{
139
135
  /**
140
136
  * Does this view want to "claim" touch responsiveness? This is called for
141
137
  * every touch move on the `View` when it is not the responder.
@@ -145,7 +141,7 @@ type GestureResponderEventProps = $ReadOnly<{
145
141
  *
146
142
  * See https://reactnative.dev/docs/view#onmoveshouldsetresponder
147
143
  */
148
- onMoveShouldSetResponder?: ?(e: PressEvent) => boolean,
144
+ onMoveShouldSetResponder?: ?(e: GestureResponderEvent) => boolean,
149
145
 
150
146
  /**
151
147
  * If a parent `View` wants to prevent a child `View` from becoming responder
@@ -156,7 +152,7 @@ type GestureResponderEventProps = $ReadOnly<{
156
152
  *
157
153
  * See https://reactnative.dev/docs/view#onMoveShouldsetrespondercapture
158
154
  */
159
- onMoveShouldSetResponderCapture?: ?(e: PressEvent) => boolean,
155
+ onMoveShouldSetResponderCapture?: ?(e: GestureResponderEvent) => boolean,
160
156
 
161
157
  /**
162
158
  * The View is now responding for touch events. This is the time to highlight
@@ -170,7 +166,7 @@ type GestureResponderEventProps = $ReadOnly<{
170
166
  *
171
167
  * See https://reactnative.dev/docs/view#onrespondergrant
172
168
  */
173
- onResponderGrant?: ?(e: PressEvent) => void | boolean,
169
+ onResponderGrant?: ?(e: GestureResponderEvent) => void | boolean,
174
170
 
175
171
  /**
176
172
  * The user is moving their finger.
@@ -180,7 +176,7 @@ type GestureResponderEventProps = $ReadOnly<{
180
176
  *
181
177
  * See https://reactnative.dev/docs/view#onrespondermove
182
178
  */
183
- onResponderMove?: ?(e: PressEvent) => void,
179
+ onResponderMove?: ?(e: GestureResponderEvent) => void,
184
180
 
185
181
  /**
186
182
  * Another responder is already active and will not release it to that `View`
@@ -191,7 +187,7 @@ type GestureResponderEventProps = $ReadOnly<{
191
187
  *
192
188
  * See https://reactnative.dev/docs/view#onresponderreject
193
189
  */
194
- onResponderReject?: ?(e: PressEvent) => void,
190
+ onResponderReject?: ?(e: GestureResponderEvent) => void,
195
191
 
196
192
  /**
197
193
  * Fired at the end of the touch.
@@ -201,10 +197,10 @@ type GestureResponderEventProps = $ReadOnly<{
201
197
  *
202
198
  * See https://reactnative.dev/docs/view#onresponderrelease
203
199
  */
204
- onResponderRelease?: ?(e: PressEvent) => void,
200
+ onResponderRelease?: ?(e: GestureResponderEvent) => void,
205
201
 
206
- onResponderStart?: ?(e: PressEvent) => void,
207
- onResponderEnd?: ?(e: PressEvent) => void,
202
+ onResponderStart?: ?(e: GestureResponderEvent) => void,
203
+ onResponderEnd?: ?(e: GestureResponderEvent) => void,
208
204
 
209
205
  /**
210
206
  * The responder has been taken from the `View`. Might be taken by other
@@ -217,7 +213,7 @@ type GestureResponderEventProps = $ReadOnly<{
217
213
  *
218
214
  * See https://reactnative.dev/docs/view#onresponderterminate
219
215
  */
220
- onResponderTerminate?: ?(e: PressEvent) => void,
216
+ onResponderTerminate?: ?(e: GestureResponderEvent) => void,
221
217
 
222
218
  /**
223
219
  * Some other `View` wants to become responder and is asking this `View` to
@@ -228,7 +224,7 @@ type GestureResponderEventProps = $ReadOnly<{
228
224
  *
229
225
  * See https://reactnative.dev/docs/view#onresponderterminationrequest
230
226
  */
231
- onResponderTerminationRequest?: ?(e: PressEvent) => boolean,
227
+ onResponderTerminationRequest?: ?(e: GestureResponderEvent) => boolean,
232
228
 
233
229
  /**
234
230
  * Does this view want to become responder on the start of a touch?
@@ -238,7 +234,7 @@ type GestureResponderEventProps = $ReadOnly<{
238
234
  *
239
235
  * See https://reactnative.dev/docs/view#onstartshouldsetresponder
240
236
  */
241
- onStartShouldSetResponder?: ?(e: PressEvent) => boolean,
237
+ onStartShouldSetResponder?: ?(e: GestureResponderEvent) => boolean,
242
238
 
243
239
  /**
244
240
  * If a parent `View` wants to prevent a child `View` from becoming responder
@@ -249,7 +245,7 @@ type GestureResponderEventProps = $ReadOnly<{
249
245
  *
250
246
  * See https://reactnative.dev/docs/view#onstartshouldsetrespondercapture
251
247
  */
252
- onStartShouldSetResponderCapture?: ?(e: PressEvent) => boolean,
248
+ onStartShouldSetResponderCapture?: ?(e: GestureResponderEvent) => boolean,
253
249
  }>;
254
250
 
255
251
  type AndroidDrawableThemeAttr = $ReadOnly<{
@@ -266,43 +262,7 @@ type AndroidDrawableRipple = $ReadOnly<{
266
262
 
267
263
  type AndroidDrawable = AndroidDrawableThemeAttr | AndroidDrawableRipple;
268
264
 
269
- type AndroidViewProps = $ReadOnly<{
270
- /**
271
- * Identifies the element that labels the element it is applied to. When the assistive technology focuses on the component with this props,
272
- * the text is read aloud. The value should should match the nativeID of the related element.
273
- *
274
- * @platform android
275
- */
276
- accessibilityLabelledBy?: ?string | ?Array<string>,
277
-
278
- /**
279
- * Identifies the element that labels the element it is applied to. When the assistive technology focuses on the component with this props,
280
- * the text is read aloud. The value should should match the nativeID of the related element.
281
- *
282
- * @platform android
283
- */
284
- 'aria-labelledby'?: ?string,
285
-
286
- /**
287
- * Indicates to accessibility services whether the user should be notified
288
- * when this view changes. Works for Android API >= 19 only.
289
- *
290
- * @platform android
291
- *
292
- * See https://reactnative.dev/docs/view#accessibilityliveregion
293
- */
294
- accessibilityLiveRegion?: ?('none' | 'polite' | 'assertive'),
295
-
296
- /**
297
- * Indicates to accessibility services whether the user should be notified
298
- * when this view changes. Works for Android API >= 19 only.
299
- *
300
- * @platform android
301
- *
302
- * See https://reactnative.dev/docs/view#accessibilityliveregion
303
- */
304
- 'aria-live'?: ?('polite' | 'assertive' | 'off'),
305
-
265
+ export type ViewPropsAndroid = $ReadOnly<{
306
266
  nativeBackgroundAndroid?: ?AndroidDrawable,
307
267
  nativeForegroundAndroid?: ?AndroidDrawable,
308
268
 
@@ -316,17 +276,6 @@ type AndroidViewProps = $ReadOnly<{
316
276
  */
317
277
  renderToHardwareTextureAndroid?: ?boolean,
318
278
 
319
- /**
320
- * Controls how view is important for accessibility which is if it
321
- * fires accessibility events and if it is reported to accessibility services
322
- * that query the screen. Works for Android only.
323
- *
324
- * @platform android
325
- *
326
- * See https://reactnative.dev/docs/view#importantforaccessibility
327
- */
328
- importantForAccessibility?: ?('auto' | 'yes' | 'no' | 'no-hide-descendants'),
329
-
330
279
  /**
331
280
  * Whether to force the Android TV focus engine to move focus to this view.
332
281
  *
@@ -394,70 +343,10 @@ type AndroidViewProps = $ReadOnly<{
394
343
  *
395
344
  * @platform android
396
345
  */
397
- onClick?: ?(event: PressEvent) => mixed,
346
+ onClick?: ?(event: GestureResponderEvent) => mixed,
398
347
  }>;
399
348
 
400
- type IOSViewProps = $ReadOnly<{
401
- /**
402
- * Prevents view from being inverted if set to true and color inversion is turned on.
403
- *
404
- * @platform ios
405
- */
406
- accessibilityIgnoresInvertColors?: ?boolean,
407
-
408
- /**
409
- * A value indicating whether VoiceOver should ignore the elements
410
- * within views that are siblings of the receiver.
411
- * Default is `false`.
412
- *
413
- * @platform ios
414
- *
415
- * See https://reactnative.dev/docs/view#accessibilityviewismodal
416
- */
417
- accessibilityViewIsModal?: ?boolean,
418
-
419
- /**
420
- * @platform ios
421
- *
422
- * See https://reactnative.dev/docs/view#accessibilityshowslargecontentviewer
423
- */
424
- accessibilityShowsLargeContentViewer?: ?boolean,
425
-
426
- /**
427
- * @platform ios
428
- *
429
- * See https://reactnative.dev/docs/view#accessibilitylargecontenttitle
430
- */
431
- accessibilityLargeContentTitle?: ?string,
432
-
433
- /**
434
- * The aria-modal attribute indicates content contained within a modal with aria-modal="true"
435
- * should be accessible to the user.
436
- * Default is `false`.
437
- *
438
- * @platform ios
439
- */
440
- 'aria-modal'?: ?boolean,
441
-
442
- /**
443
- * A value indicating whether the accessibility elements contained within
444
- * this accessibility element are hidden.
445
- *
446
- * @platform ios
447
- *
448
- * See https://reactnative.dev/docs/view#accessibilityElementsHidden
449
- */
450
- accessibilityElementsHidden?: ?boolean,
451
-
452
- /**
453
- * Indicates to the accessibility services that the UI component is in
454
- * a specific language. The provided string should be formatted following
455
- * the BCP 47 specification (https://www.rfc-editor.org/info/bcp47).
456
- *
457
- * @platform ios
458
- */
459
- accessibilityLanguage?: ?Stringish,
460
-
349
+ export type ViewPropsIOS = $ReadOnly<{
461
350
  /**
462
351
  * Whether this `View` should be rendered as a bitmap before compositing.
463
352
  *
@@ -479,7 +368,7 @@ export type HandledKeyboardEvent = $ReadOnly<{|
479
368
  handledEventPhase?: number,
480
369
  |}>;
481
370
 
482
- type WindowsViewProps = $ReadOnly<{|
371
+ type ViewPropsWindows = $ReadOnly<{|
483
372
  /**
484
373
  * Key up event
485
374
  *
@@ -529,99 +418,18 @@ type WindowsViewProps = $ReadOnly<{|
529
418
 
530
419
  export type ViewProps = $ReadOnly<{
531
420
  ...DirectEventProps,
532
- ...GestureResponderEventProps,
421
+ ...GestureResponderHandlers,
533
422
  ...MouseEventProps,
534
423
  ...PointerEventProps,
535
424
  ...FocusEventProps,
536
425
  ...TouchEventProps,
537
- ...AndroidViewProps,
538
- ...IOSViewProps,
539
- ...WindowsViewProps, // [Windows]
540
-
426
+ ...ViewPropsAndroid,
427
+ ...ViewPropsIOS,
428
+ ...AccessibilityProps,
429
+ ...ViewPropsWindows, // [Windows]
541
430
  children?: Node,
542
431
  style?: ?ViewStyleProp,
543
432
 
544
- /**
545
- * When `true`, indicates that the view is an accessibility element.
546
- * By default, all the touchable elements are accessible.
547
- *
548
- * See https://reactnative.dev/docs/view#accessible
549
- */
550
- accessible?: ?boolean,
551
-
552
- /**
553
- * Overrides the text that's read by the screen reader when the user interacts
554
- * with the element. By default, the label is constructed by traversing all
555
- * the children and accumulating all the `Text` nodes separated by space.
556
- *
557
- * See https://reactnative.dev/docs/view#accessibilitylabel
558
- */
559
- accessibilityLabel?: ?Stringish,
560
-
561
- /**
562
- * An accessibility hint helps users understand what will happen when they perform
563
- * an action on the accessibility element when that result is not obvious from the
564
- * accessibility label.
565
- *
566
- *
567
- * See https://reactnative.dev/docs/view#accessibilityHint
568
- */
569
- accessibilityHint?: ?Stringish,
570
-
571
- /**
572
- * Alias for accessibilityLabel https://reactnative.dev/docs/view#accessibilitylabel
573
- * https://github.com/facebook/react-native/issues/34424
574
- */
575
- 'aria-label'?: ?Stringish,
576
-
577
- /**
578
- * Indicates to accessibility services to treat UI component like a specific role.
579
- */
580
- accessibilityRole?: ?AccessibilityRole,
581
-
582
- /**
583
- * Alias for accessibilityRole
584
- */
585
- role?: ?Role,
586
-
587
- /**
588
- * Indicates to accessibility services that UI Component is in a specific State.
589
- */
590
- accessibilityState?: ?AccessibilityState,
591
- accessibilityValue?: ?AccessibilityValue,
592
-
593
- /**
594
- * alias for accessibilityState
595
- * It represents textual description of a component's value, or for range-based components, such as sliders and progress bars.
596
- */
597
- 'aria-valuemax'?: ?AccessibilityValue['max'],
598
- 'aria-valuemin'?: ?AccessibilityValue['min'],
599
- 'aria-valuenow'?: ?AccessibilityValue['now'],
600
- 'aria-valuetext'?: ?AccessibilityValue['text'],
601
-
602
- /**
603
- * Provides an array of custom actions available for accessibility.
604
- *
605
- */
606
- accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
607
-
608
- /**
609
- * alias for accessibilityState
610
- *
611
- * see https://reactnative.dev/docs/accessibility#accessibilitystate
612
- */
613
- 'aria-busy'?: ?boolean,
614
- 'aria-checked'?: ?boolean | 'mixed',
615
- 'aria-disabled'?: ?boolean,
616
- 'aria-expanded'?: ?boolean,
617
- 'aria-selected'?: ?boolean,
618
- /** A value indicating whether the accessibility elements contained within
619
- * this accessibility element are hidden.
620
- *
621
- * See https://reactnative.dev/docs/view#aria-hidden
622
- */
623
- 'aria-hidden'?: ?boolean,
624
-
625
433
  /**
626
434
  * Views that are only used to layout their children or otherwise don't draw
627
435
  * anything may be automatically removed from the native hierarchy as an
@@ -39,7 +39,7 @@ export default async function symbolicateStackTrace(
39
39
  }
40
40
 
41
41
  // Lazy-load `fetch` until the first symbolication call to avoid circular requires.
42
- const fetch = global.fetch ?? require('../../Network/fetch');
42
+ const fetch = global.fetch ?? require('../../Network/fetch').fetch;
43
43
  const response = await fetch(devServer.url + 'symbolicate', {
44
44
  method: 'POST',
45
45
  headers: {
@@ -51,7 +51,8 @@ if (__DEV__) {
51
51
 
52
52
  require('../ReactNative/AppRegistry');
53
53
 
54
- const GlobalPerformanceLogger = require('../Utilities/GlobalPerformanceLogger');
54
+ const GlobalPerformanceLogger =
55
+ require('../Utilities/GlobalPerformanceLogger').default;
55
56
  // We could just call GlobalPerformanceLogger.markPoint at the top of the file,
56
57
  // but then we'd be excluding the time it took to require the logger.
57
58
  // Instead, we just use Date.now and backdate the timestamp.
@@ -17,5 +17,5 @@ export const version: $ReadOnly<{
17
17
  major: 0,
18
18
  minor: 79,
19
19
  patch: 0,
20
- prerelease: 'nightly-20250206-fb8a6a5bb',
20
+ prerelease: 'nightly-20250220-41b597c73',
21
21
  };
@@ -36,6 +36,7 @@ const IDLE_CALLBACK_FRAME_DEADLINE = 1;
36
36
  const callbacks: Array<?Function> = [];
37
37
  const types: Array<?JSTimerType> = [];
38
38
  const timerIDs: Array<?number> = [];
39
+ const freeIdxs: Array<number> = [];
39
40
  let reactNativeMicrotasks: Array<number> = [];
40
41
  let requestIdleCallbacks: Array<number> = [];
41
42
  const requestIdleCallbackTimeouts: {[number]: number, ...} = {};
@@ -47,11 +48,11 @@ let hasEmittedTimeDriftWarning = false;
47
48
 
48
49
  // Returns a free index if one is available, and the next consecutive index otherwise.
49
50
  function _getFreeIndex(): number {
50
- let freeIndex = timerIDs.indexOf(null);
51
- if (freeIndex === -1) {
52
- freeIndex = timerIDs.length;
51
+ const freeIdx = freeIdxs.pop();
52
+ if (freeIdx === undefined) {
53
+ return timerIDs.length;
53
54
  }
54
- return freeIndex;
55
+ return freeIdx;
55
56
  }
56
57
 
57
58
  function _allocateCallback(func: Function, type: JSTimerType): number {
@@ -171,6 +172,7 @@ function _clearIndex(i: number) {
171
172
  timerIDs[i] = null;
172
173
  callbacks[i] = null;
173
174
  types[i] = null;
175
+ freeIdxs.push(i);
174
176
  }
175
177
 
176
178
  function _freeCallback(timerID: number) {
@@ -16,7 +16,7 @@ registerModule('Systrace', () => require('../Performance/Systrace'));
16
16
  if (!(global.RN$Bridgeless === true)) {
17
17
  registerModule('JSTimers', () => require('./Timers/JSTimers').default);
18
18
  }
19
- registerModule('RCTLog', () => require('../Utilities/RCTLog'));
19
+ registerModule('RCTLog', () => require('../Utilities/RCTLog').default);
20
20
  registerModule(
21
21
  'RCTDeviceEventEmitter',
22
22
  () => require('../EventEmitter/RCTDeviceEventEmitter').default,
@@ -25,12 +25,16 @@ registerModule(
25
25
  'RCTNativeAppEventEmitter',
26
26
  () => require('../EventEmitter/RCTNativeAppEventEmitter').default,
27
27
  );
28
- registerModule('GlobalPerformanceLogger', () =>
29
- require('../Utilities/GlobalPerformanceLogger'),
28
+ registerModule(
29
+ 'GlobalPerformanceLogger',
30
+ () => require('../Utilities/GlobalPerformanceLogger').default,
30
31
  );
31
32
 
32
33
  if (__DEV__) {
33
- registerModule('HMRClient', () => require('../Utilities/HMRClient'));
34
+ registerModule('HMRClient', () => require('../Utilities/HMRClient').default);
34
35
  } else {
35
- registerModule('HMRClient', () => require('../Utilities/HMRClientProdShim'));
36
+ registerModule(
37
+ 'HMRClient',
38
+ () => require('../Utilities/HMRClientProdShim').default,
39
+ );
36
40
  }
@@ -17,28 +17,11 @@ declare var console: {[string]: $FlowFixMe};
17
17
  * You can use this module directly, or just require InitializeCore.
18
18
  */
19
19
  if (__DEV__) {
20
- // Note we can't check if console is "native" because it would appear "native" in JSC and Hermes.
21
- // We also can't check any properties that don't exist in the Chrome worker environment.
22
- // So we check a navigator property that's set to a particular value ("Netscape") in all real browsers.
23
- const isLikelyARealBrowser =
24
- global.navigator != null &&
25
- /* _
26
- * | |
27
- * _ __ ___| |_ ___ ___ __ _ _ __ ___
28
- * | '_ \ / _ \ __/ __|/ __/ _` | '_ \ / _ \
29
- * | | | | __/ |_\__ \ (_| (_| | |_) | __/
30
- * |_| |_|\___|\__|___/\___\__,_| .__/ \___|
31
- * | |
32
- * |_|
33
- */
34
- global.navigator.appName === 'Netscape'; // Any real browser
35
-
36
20
  if (!Platform.isTesting) {
37
- const HMRClient = require('../Utilities/HMRClient');
21
+ const HMRClient = require('../Utilities/HMRClient').default;
38
22
 
39
- if (global.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__) {
40
- HMRClient.unstable_notifyFuseboxConsoleEnabled();
41
- } else if (console._isPolyfilled) {
23
+ // TODO(T214991636): Remove legacy Metro log forwarding
24
+ if (console._isPolyfilled) {
42
25
  // We assume full control over the console and send JavaScript logs to Metro.
43
26
  [
44
27
  'trace',
@@ -57,15 +40,6 @@ if (__DEV__) {
57
40
  originalFunction.apply(console, args);
58
41
  };
59
42
  });
60
- } else {
61
- // We assume the environment has a real rich console (like Chrome), and don't hijack it to log to Metro.
62
- // It's likely the developer is using rich console to debug anyway, and hijacking it would
63
- // lose the filenames in console.log calls: https://github.com/facebook/react-native/issues/26788.
64
- HMRClient.log('log', [
65
- `JavaScript logs will appear in your ${
66
- isLikelyARealBrowser ? 'browser' : 'environment'
67
- } console`,
68
- ]);
69
43
  }
70
44
  }
71
45
 
@@ -72,7 +72,7 @@ if (__DEV__) {
72
72
 
73
73
  const ReactNativeStyleAttributes =
74
74
  require('../Components/View/ReactNativeStyleAttributes').default;
75
- const resolveRNStyle = require('../StyleSheet/flattenStyle');
75
+ const resolveRNStyle = require('../StyleSheet/flattenStyle').default;
76
76
 
77
77
  function handleReactDevToolsSettingsUpdate(settings: Object) {
78
78
  reactDevToolsSettingsManager.setGlobalHookSettings(
@@ -11,7 +11,7 @@
11
11
  'use strict';
12
12
 
13
13
  if (__DEV__) {
14
- const DevSettings = require('../Utilities/DevSettings');
14
+ const DevSettings = require('../Utilities/DevSettings').default;
15
15
 
16
16
  if (typeof DevSettings.reload !== 'function') {
17
17
  throw new Error('Could not find the reload() implementation.');
@@ -18,8 +18,11 @@ const {polyfillGlobal} = require('../Utilities/PolyfillFunctions');
18
18
  *
19
19
  * You can use this module directly, or just require InitializeCore.
20
20
  */
21
- polyfillGlobal('XMLHttpRequest', () => require('../Network/XMLHttpRequest'));
22
- polyfillGlobal('FormData', () => require('../Network/FormData'));
21
+ polyfillGlobal(
22
+ 'XMLHttpRequest',
23
+ () => require('../Network/XMLHttpRequest').default,
24
+ );
25
+ polyfillGlobal('FormData', () => require('../Network/FormData').default);
23
26
 
24
27
  polyfillGlobal('fetch', () => require('../Network/fetch').fetch);
25
28
  polyfillGlobal('Headers', () => require('../Network/fetch').Headers);
@@ -26,6 +26,9 @@ interface NativeModule {
26
26
 
27
27
  export type {EventSubscription};
28
28
 
29
+ // $FlowFixMe[unclear-type] unclear type of events
30
+ type UnsafeObject = Object;
31
+
29
32
  /**
30
33
  * `NativeEventEmitter` is intended for use by Native Modules to emit events to
31
34
  * JavaScript listeners. If a `NativeModule` is supplied to the constructor, it
@@ -36,8 +39,11 @@ export type {EventSubscription};
36
39
  * This means event names must be globally unique, and it means that call sites
37
40
  * can theoretically listen to `RCTDeviceEventEmitter` (although discouraged).
38
41
  */
39
- export default class NativeEventEmitter<TEventToArgsMap: {...}>
40
- implements IEventEmitter<TEventToArgsMap>
42
+ export default class NativeEventEmitter<
43
+ TEventToArgsMap: $ReadOnly<
44
+ Record<string, $ReadOnlyArray<UnsafeObject>>,
45
+ > = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
46
+ > implements IEventEmitter<TEventToArgsMap>
41
47
  {
42
48
  _nativeModule: ?NativeModule;
43
49
 
@@ -23,7 +23,7 @@ type RCTDeviceEventDefinitions = {[name: string]: Array<any>};
23
23
  *
24
24
  * NativeModules that emit events should instead subclass `NativeEventEmitter`.
25
25
  */
26
- class RCTDeviceEventEmitter extends EventEmitter<RCTDeviceEventDefinitions> {
26
+ class RCTDeviceEventEmitterImpl extends EventEmitter<RCTDeviceEventDefinitions> {
27
27
  // Add systrace to RCTDeviceEventEmitter.emit method for debugging
28
28
  emit<TEvent: $Keys<RCTDeviceEventDefinitions>>(
29
29
  eventType: TEvent,
@@ -34,11 +34,12 @@ class RCTDeviceEventEmitter extends EventEmitter<RCTDeviceEventDefinitions> {
34
34
  endEvent();
35
35
  }
36
36
  }
37
- const instance = new RCTDeviceEventEmitter();
37
+ const RCTDeviceEventEmitter: IEventEmitter<RCTDeviceEventDefinitions> =
38
+ new RCTDeviceEventEmitterImpl();
38
39
 
39
40
  Object.defineProperty(global, '__rctDeviceEventEmitter', {
40
41
  configurable: true,
41
- value: instance,
42
+ value: RCTDeviceEventEmitter,
42
43
  });
43
44
 
44
- export default (instance: IEventEmitter<RCTDeviceEventDefinitions>);
45
+ export default (RCTDeviceEventEmitter: IEventEmitter<RCTDeviceEventDefinitions>);
@@ -18,8 +18,9 @@ import RCTDeviceEventEmitter from '../RCTDeviceEventEmitter';
18
18
  /**
19
19
  * Mock `NativeEventEmitter` to ignore Native Modules.
20
20
  */
21
- export default class NativeEventEmitter<TEventToArgsMap: {...}>
22
- implements IEventEmitter<TEventToArgsMap>
21
+ export default class NativeEventEmitter<
22
+ TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<mixed>>>,
23
+ > implements IEventEmitter<TEventToArgsMap>
23
24
  {
24
25
  addListener<TEvent: $Keys<TEventToArgsMap>>(
25
26
  eventType: TEvent,
@@ -25,7 +25,7 @@ class CustomEvent extends EventPolyfill {
25
25
  const {bubbles, cancelable, composed} = options;
26
26
  super(typeArg, {bubbles, cancelable, composed});
27
27
 
28
- this.detail = options.detail; // this would correspond to `NativeEvent` in SyntheticEvent
28
+ this.detail = options.detail; // this would correspond to `NativeEvent` in NativeSyntheticEvent
29
29
  }
30
30
  }
31
31
 
@@ -152,9 +152,9 @@ class EventPolyfill implements IEvent {
152
152
  /** @deprecated */
153
153
  srcElement: Element; // TODO: nullable
154
154
 
155
- // React Native-specific: proxy data to a SyntheticEvent when
155
+ // React Native-specific: proxy data to a NativeSyntheticEvent when
156
156
  // certain methods are called.
157
- // SyntheticEvent will also have a reference to this instance -
157
+ // NativeSyntheticEvent will also have a reference to this instance -
158
158
  // it is circular - and both classes use this reference to keep
159
159
  // data with the other in sync.
160
160
  _syntheticEvent: mixed;