@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
@@ -10,7 +10,7 @@
10
10
 
11
11
  import type {HostInstance} from '../Renderer/shims/ReactNativeTypes';
12
12
 
13
- export type SyntheticEvent<+T> = $ReadOnly<{
13
+ export type NativeSyntheticEvent<+T> = $ReadOnly<{
14
14
  bubbles: ?boolean,
15
15
  cancelable: ?boolean,
16
16
  currentTarget: number | HostInstance,
@@ -32,7 +32,7 @@ export type SyntheticEvent<+T> = $ReadOnly<{
32
32
  }>;
33
33
 
34
34
  export type ResponderSyntheticEvent<T> = $ReadOnly<{
35
- ...SyntheticEvent<T>,
35
+ ...NativeSyntheticEvent<T>,
36
36
  touchHistory: $ReadOnly<{
37
37
  indexOfSingleActiveTouch: number,
38
38
  mostRecentTimeStamp: number,
@@ -54,15 +54,15 @@ export type ResponderSyntheticEvent<T> = $ReadOnly<{
54
54
  }>,
55
55
  }>;
56
56
 
57
- export type Layout = $ReadOnly<{
57
+ export type LayoutRectangle = $ReadOnly<{
58
58
  x: number,
59
59
  y: number,
60
60
  width: number,
61
61
  height: number,
62
62
  }>;
63
63
 
64
- export type TextLayout = $ReadOnly<{
65
- ...Layout,
64
+ export type TextLayoutLine = $ReadOnly<{
65
+ ...LayoutRectangle,
66
66
  ascender: number,
67
67
  capHeight: number,
68
68
  descender: number,
@@ -70,17 +70,17 @@ export type TextLayout = $ReadOnly<{
70
70
  xHeight: number,
71
71
  }>;
72
72
 
73
- export type LayoutEvent = SyntheticEvent<
73
+ export type LayoutChangeEvent = NativeSyntheticEvent<
74
74
  $ReadOnly<{
75
- layout: Layout,
75
+ layout: LayoutRectangle,
76
76
  }>,
77
77
  >;
78
78
 
79
- export type TextLayoutEvent = SyntheticEvent<
80
- $ReadOnly<{
81
- lines: Array<TextLayout>,
82
- }>,
83
- >;
79
+ export type TextLayoutEventData = $ReadOnly<{
80
+ lines: Array<TextLayoutLine>,
81
+ }>;
82
+
83
+ export type TextLayoutEvent = NativeSyntheticEvent<TextLayoutEventData>;
84
84
 
85
85
  /**
86
86
  * https://developer.mozilla.org/en-US/docs/Web/API/UIEvent
@@ -228,80 +228,116 @@ export interface NativePointerEvent extends NativeMouseEvent {
228
228
  +isPrimary: boolean;
229
229
  }
230
230
 
231
- export type PointerEvent = SyntheticEvent<NativePointerEvent>;
231
+ export type PointerEvent = NativeSyntheticEvent<NativePointerEvent>;
232
232
 
233
- export type PressEvent = ResponderSyntheticEvent<
234
- $ReadOnly<{
235
- altKey: ?boolean, // TODO(macOS)
236
- button: ?number, // TODO(macOS)
237
- changedTouches: $ReadOnlyArray<$PropertyType<PressEvent, 'nativeEvent'>>,
238
- ctrlKey: ?boolean, // TODO(macOS)
239
- force?: number,
240
- identifier: number,
241
- locationX: number,
242
- locationY: number,
243
- metaKey: ?boolean, // TODO(macOS)
244
- pageX: number,
245
- pageY: number,
246
- shiftKey: ?boolean, // TODO(macOS)
247
- target: ?number,
248
- timestamp: number,
249
- touches: $ReadOnlyArray<$PropertyType<PressEvent, 'nativeEvent'>>,
250
- }>,
251
- >;
233
+ export type NativeTouchEvent = $ReadOnly<{
234
+ altKey: ?boolean, // TODO(macOS)
252
235
 
253
- export type ScrollEvent = SyntheticEvent<
254
- $ReadOnly<{
255
- contentInset: $ReadOnly<{
256
- bottom: number,
257
- left: number,
258
- right: number,
259
- top: number,
260
- }>,
261
- contentOffset: $ReadOnly<{
262
- y: number,
263
- x: number,
264
- }>,
265
- contentSize: $ReadOnly<{
266
- height: number,
267
- width: number,
268
- }>,
269
- layoutMeasurement: $ReadOnly<{
270
- height: number,
271
- width: number,
272
- }>,
273
- targetContentOffset?: $ReadOnly<{
274
- y: number,
275
- x: number,
276
- }>,
277
- velocity?: $ReadOnly<{
278
- y: number,
279
- x: number,
280
- }>,
281
- zoomScale?: number,
282
- responderIgnoreScroll?: boolean,
283
- key?: string, // TODO(macOS)
284
- }>,
285
- >;
236
+ button: ?number, // TODO(macOS)
237
+ /**
238
+ * Array of all touch events that have changed since the last event
239
+ */
240
+ changedTouches: $ReadOnlyArray<NativeTouchEvent>,
286
241
 
287
- export type BlurEvent = SyntheticEvent<
288
- $ReadOnly<{
289
- target: number,
290
- ...
291
- }>,
292
- >;
242
+ ctrlKey: ?boolean, // TODO(macOS)
293
243
 
294
- export type FocusEvent = SyntheticEvent<
295
- $ReadOnly<{
296
- target: number,
297
- ...
298
- }>,
299
- >;
244
+ /**
245
+ * 3D Touch reported force
246
+ * @platform ios
247
+ */
248
+ force?: number,
249
+ /**
250
+ * The ID of the touch
251
+ */
252
+ identifier: number,
253
+ /**
254
+ * The X position of the touch, relative to the element
255
+ */
256
+ locationX: number,
257
+ /**
258
+ * The Y position of the touch, relative to the element
259
+ */
260
+ locationY: number,
261
+ /**
262
+ * The X position of the touch, relative to the screen
263
+ */
264
+
265
+ metaKey: ?boolean, // TODO(macOS)
266
+
267
+ pageX: number,
268
+ /**
269
+ * The Y position of the touch, relative to the screen
270
+ */
271
+ pageY: number,
272
+
273
+ shiftKey: ?boolean, // TODO(macOS)
274
+ /**
275
+ * The node id of the element receiving the touch event
276
+ */
277
+ target: ?number,
278
+ /**
279
+ * A time identifier for the touch, useful for velocity calculation
280
+ */
281
+ timestamp: number,
282
+ /**
283
+ * Array of all current touches on the screen
284
+ */
285
+ touches: $ReadOnlyArray<NativeTouchEvent>,
286
+ }>;
287
+
288
+ export type GestureResponderEvent = ResponderSyntheticEvent<NativeTouchEvent>;
289
+
290
+ export type NativeScrollRectangle = $ReadOnly<{
291
+ bottom: number,
292
+ left: number,
293
+ right: number,
294
+ top: number,
295
+ }>;
296
+
297
+ export type NativeScrollPoint = $ReadOnly<{
298
+ y: number,
299
+ x: number,
300
+ }>;
301
+
302
+ export type NativeScrollVelocity = $ReadOnly<{
303
+ y: number,
304
+ x: number,
305
+ }>;
306
+
307
+ export type NativeScrollSize = $ReadOnly<{
308
+ height: number,
309
+ width: number,
310
+ }>;
311
+
312
+ export type NativeScrollEvent = $ReadOnly<{
313
+ contentInset: NativeScrollRectangle,
314
+ contentOffset: NativeScrollPoint,
315
+ contentSize: NativeScrollSize,
316
+ layoutMeasurement: NativeScrollSize,
317
+ velocity?: NativeScrollVelocity,
318
+ zoomScale?: number,
319
+ responderIgnoreScroll?: boolean,
320
+ /**
321
+ * @platform ios
322
+ */
323
+ targetContentOffset?: NativeScrollPoint,
324
+ }>;
325
+
326
+ export type ScrollEvent = NativeSyntheticEvent<NativeScrollEvent>;
327
+
328
+ export type TargetedEvent = $ReadOnly<{
329
+ target: number,
330
+ ...
331
+ }>;
332
+
333
+ export type BlurEvent = NativeSyntheticEvent<TargetedEvent>;
334
+
335
+ export type FocusEvent = NativeSyntheticEvent<TargetedEvent>;
300
336
 
301
337
  // [Windows Mouse events on Windows don't match up with the version in core
302
338
  // introduced for react-native-web. Replace typings with our values to catch
303
339
  // anything dependent on react-native-web specific values
304
- export type MouseEvent = SyntheticEvent<
340
+ export type MouseEvent = NativeSyntheticEvent<
305
341
  $ReadOnly<{
306
342
  target: number,
307
343
  identifier: number,
@@ -328,7 +364,7 @@ export type MouseEvent = SyntheticEvent<
328
364
  // Windows]
329
365
 
330
366
  // [Windows
331
- export type KeyEvent = SyntheticEvent<
367
+ export type KeyEvent = NativeSyntheticEvent<
332
368
  $ReadOnly<{|
333
369
  altKey: boolean,
334
370
  ctrlKey: boolean,
@@ -10,7 +10,8 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const deepFreezeAndThrowOnMutationInDev = require('./Utilities/deepFreezeAndThrowOnMutationInDev');
13
+ const deepFreezeAndThrowOnMutationInDev =
14
+ require('./Utilities/deepFreezeAndThrowOnMutationInDev').default;
14
15
 
15
16
  /**
16
17
  * A collection of Unicode sequences for various characters and emoji.
@@ -93,4 +93,4 @@ const BackHandler: TBackHandler = {
93
93
  },
94
94
  };
95
95
 
96
- module.exports = BackHandler;
96
+ export default BackHandler;
@@ -14,14 +14,14 @@ type BackPressHandler = () => ?boolean;
14
14
  function emptyFunction(): void {}
15
15
 
16
16
  type TBackHandler = {
17
- +exitApp: () => void,
18
- +addEventListener: (
17
+ exitApp(): void,
18
+ addEventListener(
19
19
  eventName: BackPressEventName,
20
20
  handler: BackPressHandler,
21
- ) => {remove: () => void, ...},
21
+ ): {remove: () => void, ...},
22
22
  };
23
23
 
24
- let BackHandler: TBackHandler = {
24
+ const BackHandler: TBackHandler = {
25
25
  exitApp: emptyFunction,
26
26
  addEventListener(_eventName: BackPressEventName, _handler: BackPressHandler) {
27
27
  return {
@@ -30,4 +30,4 @@ let BackHandler: TBackHandler = {
30
30
  },
31
31
  };
32
32
 
33
- module.exports = BackHandler;
33
+ export default BackHandler;
@@ -93,4 +93,4 @@ const BackHandler: TBackHandler = {
93
93
  },
94
94
  };
95
95
 
96
- module.exports = BackHandler;
96
+ export default BackHandler;
@@ -35,7 +35,7 @@ const COLOR_SCHEME = {
35
35
  },
36
36
  };
37
37
 
38
- module.exports = {
38
+ export default {
39
39
  showMessage(message: string, type: 'load' | 'refresh') {
40
40
  if (NativeDevLoadingView) {
41
41
  const colorScheme =
@@ -69,4 +69,4 @@ if (__DEV__) {
69
69
  };
70
70
  }
71
71
 
72
- module.exports = DevSettings;
72
+ export default DevSettings;
@@ -10,4 +10,4 @@
10
10
 
11
11
  import NativeDeviceInfo from './NativeDeviceInfo';
12
12
 
13
- module.exports = NativeDeviceInfo;
13
+ export default NativeDeviceInfo;
@@ -16,4 +16,4 @@ const DeviceInfo: Spec = {
16
16
  getConstants: () => ({Dimensions: {}}),
17
17
  };
18
18
 
19
- module.exports = DeviceInfo;
19
+ export default DeviceInfo;
@@ -15,7 +15,7 @@
15
15
  * Note that a polyfill can technically fake this behavior but few does it.
16
16
  * Therefore, this is usually good enough for our purpose.
17
17
  */
18
- function isNativeFunction(f: Function): boolean {
18
+ export function isNativeFunction(f: Function): boolean {
19
19
  return typeof f === 'function' && f.toString().indexOf('[native code]') > -1;
20
20
  }
21
21
 
@@ -23,9 +23,7 @@ function isNativeFunction(f: Function): boolean {
23
23
  * @return whether or not the constructor of @param {object} o is an native
24
24
  * function named with @param {string} expectedName.
25
25
  */
26
- function hasNativeConstructor(o: Object, expectedName: string): boolean {
26
+ export function hasNativeConstructor(o: Object, expectedName: string): boolean {
27
27
  const con = Object.getPrototypeOf(o).constructor;
28
28
  return con.name === expectedName && isNativeFunction(con);
29
29
  }
30
-
31
- module.exports = {isNativeFunction, hasNativeConstructor};
@@ -25,18 +25,18 @@ class FocusManager {
25
25
  // $FlowIgnoreMe[incompatible-call]
26
26
  findNodeHandle(ref),
27
27
  UIManager.getViewManagerConfig('RCTView').Commands.aggressivefocus,
28
- null,
28
+ [],
29
29
  );
30
30
  } else {
31
31
  UIManager.dispatchViewManagerCommand(
32
32
  // $FlowIgnoreMe[incompatible-call]
33
33
  findNodeHandle(ref),
34
34
  UIManager.getViewManagerConfig('RCTView').Commands.politefocus,
35
- null,
35
+ [],
36
36
  );
37
37
  }
38
38
  }
39
39
  }
40
40
  }
41
41
 
42
- module.exports = FocusManager;
42
+ export default FocusManager;
@@ -21,4 +21,4 @@ import createPerformanceLogger from './createPerformanceLogger';
21
21
  */
22
22
  const GlobalPerformanceLogger: IPerformanceLogger = createPerformanceLogger();
23
23
 
24
- module.exports = GlobalPerformanceLogger;
24
+ export default GlobalPerformanceLogger;
@@ -14,8 +14,8 @@ import getDevServer from '../Core/Devtools/getDevServer';
14
14
  import LogBox from '../LogBox/LogBox';
15
15
  import NativeRedBox from '../NativeModules/specs/NativeRedBox';
16
16
 
17
- const DevSettings = require('./DevSettings');
18
- const Platform = require('./Platform');
17
+ const DevSettings = require('./DevSettings').default;
18
+ const Platform = require('./Platform').default;
19
19
  const invariant = require('invariant');
20
20
  const MetroHMRClient = require('metro-runtime/src/modules/HMRClient');
21
21
  const prettyFormat = require('pretty-format');
@@ -26,7 +26,6 @@ let hmrUnavailableReason: string | null = null;
26
26
  let currentCompileErrorMessage: string | null = null;
27
27
  let didConnect: boolean = false;
28
28
  let pendingLogs: Array<[LogLevel, $ReadOnlyArray<mixed>]> = [];
29
- let pendingFuseboxConsoleNotification = false;
30
29
 
31
30
  type LogLevel =
32
31
  | 'trace'
@@ -52,7 +51,6 @@ export type HMRClientNativeInterface = {
52
51
  isEnabled: boolean,
53
52
  scheme?: string,
54
53
  ): void,
55
- unstable_notifyFuseboxConsoleEnabled(): void,
56
54
  };
57
55
 
58
56
  /**
@@ -70,7 +68,7 @@ const HMRClient: HMRClientNativeInterface = {
70
68
  }
71
69
 
72
70
  invariant(hmrClient, 'Expected HMRClient.setup() call at startup.');
73
- const DevLoadingView = require('./DevLoadingView');
71
+ const DevLoadingView = require('./DevLoadingView').default;
74
72
 
75
73
  // We use this for internal logging only.
76
74
  // It doesn't affect the logic.
@@ -142,29 +140,6 @@ const HMRClient: HMRClientNativeInterface = {
142
140
  }
143
141
  },
144
142
 
145
- unstable_notifyFuseboxConsoleEnabled() {
146
- if (!hmrClient) {
147
- pendingFuseboxConsoleNotification = true;
148
- return;
149
- }
150
- hmrClient.send(
151
- JSON.stringify({
152
- type: 'log',
153
- level: 'info',
154
- data: [
155
- '\n' +
156
- '\u001B[7m' +
157
- ' \u001B[1m💡 JavaScript logs have moved!\u001B[22m They can now be ' +
158
- 'viewed in React Native DevTools. Tip: Type \u001B[1mj\u001B[22m in ' +
159
- 'the terminal to open (requires Google Chrome or Microsoft Edge).' +
160
- '\u001B[27m' +
161
- '\n',
162
- ],
163
- }),
164
- );
165
- pendingFuseboxConsoleNotification = false;
166
- },
167
-
168
143
  // Called once by the bridge on startup, even if Fast Refresh is off.
169
144
  // It creates the HMR client but doesn't actually set up the socket yet.
170
145
  setup(
@@ -181,7 +156,7 @@ const HMRClient: HMRClientNativeInterface = {
181
156
  invariant(!hmrClient, 'Cannot initialize hmrClient twice');
182
157
 
183
158
  // Moving to top gives errors due to NativeModules not being initialized
184
- const DevLoadingView = require('./DevLoadingView');
159
+ const DevLoadingView = require('./DevLoadingView').default;
185
160
 
186
161
  const serverHost = port !== null && port !== '' ? `${host}:${port}` : host;
187
162
 
@@ -341,9 +316,6 @@ function flushEarlyLogs(client: MetroHMRClient) {
341
316
  pendingLogs.forEach(([level, data]) => {
342
317
  HMRClient.log(level, data);
343
318
  });
344
- if (pendingFuseboxConsoleNotification) {
345
- HMRClient.unstable_notifyFuseboxConsoleEnabled();
346
- }
347
319
  } finally {
348
320
  pendingLogs.length = 0;
349
321
  }
@@ -387,4 +359,4 @@ function showCompileError() {
387
359
  throw error;
388
360
  }
389
361
 
390
- module.exports = HMRClient;
362
+ export default HMRClient;
@@ -25,7 +25,6 @@ const HMRClientProdShim: HMRClientNativeInterface = {
25
25
  disable() {},
26
26
  registerBundle() {},
27
27
  log() {},
28
- unstable_notifyFuseboxConsoleEnabled() {},
29
28
  };
30
29
 
31
- module.exports = HMRClientProdShim;
30
+ export default HMRClientProdShim;
@@ -11,7 +11,7 @@
11
11
  import type {
12
12
  Platform as PlatformType,
13
13
  PlatformSelectSpec,
14
- } from './Platform.flow';
14
+ } from './PlatformTypes';
15
15
 
16
16
  import NativePlatformConstantsAndroid from './NativePlatformConstantsAndroid';
17
17
 
@@ -84,4 +84,4 @@ const Platform: PlatformType = {
84
84
  spec.default,
85
85
  };
86
86
 
87
- module.exports = Platform;
87
+ export default Platform;
@@ -11,7 +11,7 @@
11
11
  import type {
12
12
  Platform as PlatformType,
13
13
  PlatformSelectSpec,
14
- } from './Platform.flow';
14
+ } from './PlatformTypes';
15
15
 
16
16
  import NativePlatformConstantsIOS from './NativePlatformConstantsIOS';
17
17
 
@@ -85,4 +85,4 @@ const Platform: PlatformType = {
85
85
  'ios' in spec ? spec.ios : 'native' in spec ? spec.native : spec.default,
86
86
  };
87
87
 
88
- module.exports = Platform;
88
+ export default Platform;
@@ -9,7 +9,7 @@
9
9
  import type {
10
10
  Platform as PlatformType,
11
11
  PlatformSelectSpec,
12
- } from './Platform.flow';
12
+ } from './PlatformTypes';
13
13
 
14
14
  import NativePlatformConstantsWin from './NativePlatformConstantsWin';
15
15
 
@@ -78,4 +78,4 @@ const Platform: PlatformType = {
78
78
  spec.default,
79
79
  };
80
80
 
81
- module.exports = Platform;
81
+ export default Platform;
@@ -14,6 +14,7 @@ export type PlatformSelectSpec<T> = {
14
14
  ios?: T,
15
15
  android?: T,
16
16
  win32?: T,
17
+ windows?: T,
17
18
  ...
18
19
  };
19
20
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const defineLazyObjectProperty = require('./defineLazyObjectProperty');
13
+ const defineLazyObjectProperty = require('./defineLazyObjectProperty').default;
14
14
 
15
15
  /**
16
16
  * Sets an object's property. If a property with the same name exists, this will
@@ -25,7 +25,7 @@ const defineLazyObjectProperty = require('./defineLazyObjectProperty');
25
25
  *
26
26
  * @see https://github.com/facebook/react-native/issues/934
27
27
  */
28
- function polyfillObjectProperty<T>(
28
+ export function polyfillObjectProperty<T>(
29
29
  object: {...},
30
30
  name: string,
31
31
  getValue: () => T,
@@ -49,8 +49,6 @@ function polyfillObjectProperty<T>(
49
49
  });
50
50
  }
51
51
 
52
- function polyfillGlobal<T>(name: string, getValue: () => T): void {
52
+ export function polyfillGlobal<T>(name: string, getValue: () => T): void {
53
53
  polyfillObjectProperty(global, name, getValue);
54
54
  }
55
-
56
- module.exports = {polyfillObjectProperty, polyfillGlobal};
@@ -53,4 +53,4 @@ const RCTLog = {
53
53
  },
54
54
  };
55
55
 
56
- module.exports = RCTLog;
56
+ export default RCTLog;
@@ -20,7 +20,7 @@ const Switch = require('../Components/Switch/Switch').default;
20
20
  const TextInput = require('../Components/TextInput/TextInput').default;
21
21
  const View = require('../Components/View/View').default;
22
22
  const Text = require('../Text/Text').default;
23
- const {VirtualizedList} = require('@react-native/virtualized-lists');
23
+ const {VirtualizedList} = require('@react-native/virtualized-lists').default;
24
24
 
25
25
  export type ReactTestInstance = $PropertyType<ReactTestRendererType, 'root'>;
26
26
  export type Predicate = (node: ReactTestInstance) => boolean;
@@ -39,4 +39,4 @@ const SceneTracker = {
39
39
  },
40
40
  };
41
41
 
42
- module.exports = SceneTracker;
42
+ export default SceneTracker;
@@ -11,6 +11,6 @@
11
11
 
12
12
  const GlobalPerformanceLogger = jest
13
13
  .unmock('../createPerformanceLogger')
14
- .genMockFromModule('../GlobalPerformanceLogger');
14
+ .genMockFromModule('../GlobalPerformanceLogger').default;
15
15
 
16
- module.exports = GlobalPerformanceLogger;
16
+ export default GlobalPerformanceLogger;
@@ -28,4 +28,4 @@ function binaryToBase64(data: ArrayBuffer | $ArrayBufferView): string {
28
28
  return base64.fromByteArray(new Uint8Array(buffer, byteOffset, byteLength));
29
29
  }
30
30
 
31
- module.exports = binaryToBase64;
31
+ export default binaryToBase64;
@@ -87,4 +87,4 @@ function identity(value: mixed) {
87
87
  return value;
88
88
  }
89
89
 
90
- module.exports = deepFreezeAndThrowOnMutationInDev;
90
+ export default deepFreezeAndThrowOnMutationInDev;
@@ -63,4 +63,4 @@ function defineLazyObjectProperty<T>(
63
63
  });
64
64
  }
65
65
 
66
- module.exports = defineLazyObjectProperty;
66
+ export default defineLazyObjectProperty;
@@ -25,7 +25,7 @@ function unstable_setLogListeners(listeners: ?LogListeners) {
25
25
  /*
26
26
  * @returns {bool} true if different, false if equal
27
27
  */
28
- const deepDiffer = function (
28
+ function deepDiffer(
29
29
  one: any,
30
30
  two: any,
31
31
  maxDepthOrOptions: Options | number = -1,
@@ -95,7 +95,7 @@ const deepDiffer = function (
95
95
  }
96
96
  }
97
97
  return false;
98
- };
98
+ }
99
99
 
100
100
  deepDiffer.unstable_setLogListeners = unstable_setLogListeners;
101
- module.exports = deepDiffer;
101
+ export default deepDiffer;
@@ -25,7 +25,7 @@ const dummyInsets = {
25
25
  bottom: undefined,
26
26
  };
27
27
 
28
- const insetsDiffer = function (one: Inset, two: Inset): boolean {
28
+ function insetsDiffer(one: Inset, two: Inset): boolean {
29
29
  one = one || dummyInsets;
30
30
  two = two || dummyInsets;
31
31
  return (
@@ -35,6 +35,6 @@ const insetsDiffer = function (one: Inset, two: Inset): boolean {
35
35
  one.right !== two.right ||
36
36
  one.bottom !== two.bottom)
37
37
  );
38
- };
38
+ }
39
39
 
40
- module.exports = insetsDiffer;
40
+ export default insetsDiffer;