@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
@@ -24,7 +24,7 @@ import type {
24
24
  } from '@react-native/assets-registry/registry';
25
25
 
26
26
  const PixelRatio = require('../Utilities/PixelRatio').default;
27
- const Platform = require('../Utilities/Platform');
27
+ const Platform = require('../Utilities/Platform').default;
28
28
  const {pickScale} = require('./AssetUtils');
29
29
  const {
30
30
  getAndroidResourceFolderName,
@@ -17,13 +17,16 @@ import type {
17
17
  ImageStyleProp,
18
18
  ViewStyleProp,
19
19
  } from '../StyleSheet/StyleSheet';
20
- import type {LayoutEvent, SyntheticEvent} from '../Types/CoreEventTypes';
20
+ import type {
21
+ LayoutChangeEvent,
22
+ NativeSyntheticEvent,
23
+ } from '../Types/CoreEventTypes';
21
24
  import typeof Image from './Image';
22
25
  import type {ImageResizeMode} from './ImageResizeMode';
23
26
  import type {ImageSource} from './ImageSource';
24
27
  import type {ElementRef, Node, RefSetter} from 'react';
25
28
 
26
- export type ImageLoadEvent = SyntheticEvent<
29
+ export type ImageLoadEvent = NativeSyntheticEvent<
27
30
  $ReadOnly<{
28
31
  source: $ReadOnly<{
29
32
  width: number,
@@ -52,7 +55,7 @@ type IOSImageProps = $ReadOnly<{
52
55
  * See https://reactnative.dev/docs/image#onprogress
53
56
  */
54
57
  onProgress?: ?(
55
- event: SyntheticEvent<$ReadOnly<{loaded: number, total: number}>>,
58
+ event: NativeSyntheticEvent<$ReadOnly<{loaded: number, total: number}>>,
56
59
  ) => void,
57
60
  }>;
58
61
 
@@ -163,7 +166,7 @@ export type ImageProps = $ReadOnly<{
163
166
  * See https://reactnative.dev/docs/image#onerror
164
167
  */
165
168
  onError?: ?(
166
- event: SyntheticEvent<
169
+ event: NativeSyntheticEvent<
167
170
  $ReadOnly<{
168
171
  error: string,
169
172
  }>,
@@ -177,7 +180,7 @@ export type ImageProps = $ReadOnly<{
177
180
  * See https://reactnative.dev/docs/image#onlayout
178
181
  */
179
182
 
180
- onLayout?: ?(event: LayoutEvent) => mixed,
183
+ onLayout?: ?(event: LayoutChangeEvent) => mixed,
181
184
 
182
185
  /**
183
186
  * Invoked when load completes successfully.
@@ -142,7 +142,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
142
142
  validAttributes: {
143
143
  blurRadius: true,
144
144
  capInsets: {
145
- diff: require('../Utilities/differ/insetsDiffer'),
145
+ diff: require('../Utilities/differ/insetsDiffer').default,
146
146
  },
147
147
  defaultSource: {
148
148
  process: require('./resolveAssetSource').default,
@@ -9,7 +9,7 @@
9
9
  'use strict';
10
10
 
11
11
  const resolveAssetSource = require('./resolveAssetSource.js'); // Get base impl
12
- const Platform = require('../Utilities/Platform');
12
+ const Platform = require('../Utilities/Platform').default;
13
13
  const ensureShortPath = require('./assetPaths.js');
14
14
 
15
15
  type IPackagerAsset = {
@@ -14,7 +14,7 @@ import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNa
14
14
  import EventEmitter from '../vendor/emitter/EventEmitter';
15
15
 
16
16
  const BatchedBridge = require('../BatchedBridge/BatchedBridge').default;
17
- const infoLog = require('../Utilities/infoLog');
17
+ const infoLog = require('../Utilities/infoLog').default;
18
18
  const TaskQueue = require('./TaskQueue').default;
19
19
  const invariant = require('invariant');
20
20
 
@@ -25,6 +25,14 @@ type Task =
25
25
  }
26
26
  | (() => void);
27
27
 
28
+ // NOTE: The original implementation of `InteractionManager` never rejected
29
+ // the returned promise. This preserves that behavior in the stub.
30
+ function reject(error: Error): void {
31
+ setTimeout(() => {
32
+ throw error;
33
+ }, 0);
34
+ }
35
+
28
36
  /**
29
37
  * InteractionManager allows long-running work to be scheduled after any
30
38
  * interactions/animations have completed. In particular, this allows JavaScript
@@ -97,7 +105,7 @@ const InteractionManagerStub = {
97
105
  ...
98
106
  } {
99
107
  let immediateID: ?$FlowIssue;
100
- const promise = new Promise((resolve, reject) => {
108
+ const promise = new Promise(resolve => {
101
109
  immediateID = setImmediate(() => {
102
110
  if (typeof task === 'object' && task !== null) {
103
111
  if (typeof task.gen === 'function') {
@@ -10,7 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const infoLog = require('../Utilities/infoLog');
13
+ const infoLog = require('../Utilities/infoLog').default;
14
14
 
15
15
  type Handler = {
16
16
  onIterate?: () => void,
@@ -10,7 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import type {PressEvent} from '../Types/CoreEventTypes';
13
+ import type {GestureResponderEvent} from '../Types/CoreEventTypes';
14
14
 
15
15
  const InteractionManager = require('./InteractionManager').default;
16
16
  const TouchHistoryMath = require('./TouchHistoryMath').default;
@@ -184,25 +184,28 @@ export type GestureState = {
184
184
  };
185
185
 
186
186
  type ActiveCallback = (
187
- event: PressEvent,
187
+ event: GestureResponderEvent,
188
188
  gestureState: GestureState,
189
189
  ) => boolean;
190
190
 
191
- type PassiveCallback = (event: PressEvent, gestureState: GestureState) => mixed;
191
+ type PassiveCallback = (
192
+ event: GestureResponderEvent,
193
+ gestureState: GestureState,
194
+ ) => mixed;
192
195
 
193
196
  export type PanHandlers = {
194
- onMoveShouldSetResponder: (event: PressEvent) => boolean,
195
- onMoveShouldSetResponderCapture: (event: PressEvent) => boolean,
196
- onResponderEnd: (event: PressEvent) => void,
197
- onResponderGrant: (event: PressEvent) => boolean,
198
- onResponderMove: (event: PressEvent) => void,
199
- onResponderReject: (event: PressEvent) => void,
200
- onResponderRelease: (event: PressEvent) => void,
201
- onResponderStart: (event: PressEvent) => void,
202
- onResponderTerminate: (event: PressEvent) => void,
203
- onResponderTerminationRequest: (event: PressEvent) => boolean,
204
- onStartShouldSetResponder: (event: PressEvent) => boolean,
205
- onStartShouldSetResponderCapture: (event: PressEvent) => boolean,
197
+ onMoveShouldSetResponder: (event: GestureResponderEvent) => boolean,
198
+ onMoveShouldSetResponderCapture: (event: GestureResponderEvent) => boolean,
199
+ onResponderEnd: (event: GestureResponderEvent) => void,
200
+ onResponderGrant: (event: GestureResponderEvent) => boolean,
201
+ onResponderMove: (event: GestureResponderEvent) => void,
202
+ onResponderReject: (event: GestureResponderEvent) => void,
203
+ onResponderRelease: (event: GestureResponderEvent) => void,
204
+ onResponderStart: (event: GestureResponderEvent) => void,
205
+ onResponderTerminate: (event: GestureResponderEvent) => void,
206
+ onResponderTerminationRequest: (event: GestureResponderEvent) => boolean,
207
+ onStartShouldSetResponder: (event: GestureResponderEvent) => boolean,
208
+ onStartShouldSetResponderCapture: (event: GestureResponderEvent) => boolean,
206
209
  };
207
210
 
208
211
  type PanResponderConfig = $ReadOnly<{
@@ -330,7 +333,7 @@ const PanResponder = {
330
333
  */
331
334
  _updateGestureStateOnMove(
332
335
  gestureState: GestureState,
333
- touchHistory: $PropertyType<PressEvent, 'touchHistory'>,
336
+ touchHistory: $PropertyType<GestureResponderEvent, 'touchHistory'>,
334
337
  ) {
335
338
  gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
336
339
  gestureState.moveX = currentCentroidXOfTouchesChangedAfter(
@@ -420,17 +423,17 @@ const PanResponder = {
420
423
  _accountsForMovesUpTo: 0,
421
424
  };
422
425
  const panHandlers = {
423
- onStartShouldSetResponder(event: PressEvent): boolean {
426
+ onStartShouldSetResponder(event: GestureResponderEvent): boolean {
424
427
  return config.onStartShouldSetPanResponder == null
425
428
  ? false
426
429
  : config.onStartShouldSetPanResponder(event, gestureState);
427
430
  },
428
- onMoveShouldSetResponder(event: PressEvent): boolean {
431
+ onMoveShouldSetResponder(event: GestureResponderEvent): boolean {
429
432
  return config.onMoveShouldSetPanResponder == null
430
433
  ? false
431
434
  : config.onMoveShouldSetPanResponder(event, gestureState);
432
435
  },
433
- onStartShouldSetResponderCapture(event: PressEvent): boolean {
436
+ onStartShouldSetResponderCapture(event: GestureResponderEvent): boolean {
434
437
  // TODO: Actually, we should reinitialize the state any time
435
438
  // touches.length increases from 0 active to > 0 active.
436
439
  if (event.nativeEvent.touches.length === 1) {
@@ -443,7 +446,7 @@ const PanResponder = {
443
446
  : false;
444
447
  },
445
448
 
446
- onMoveShouldSetResponderCapture(event: PressEvent): boolean {
449
+ onMoveShouldSetResponderCapture(event: GestureResponderEvent): boolean {
447
450
  const touchHistory = event.touchHistory;
448
451
  // Responder system incorrectly dispatches should* to current responder
449
452
  // Filter out any touch moves past the first one - we would have
@@ -460,7 +463,7 @@ const PanResponder = {
460
463
  : false;
461
464
  },
462
465
 
463
- onResponderGrant(event: PressEvent): boolean {
466
+ onResponderGrant(event: GestureResponderEvent): boolean {
464
467
  if (!interactionState.handle) {
465
468
  interactionState.handle =
466
469
  InteractionManager.createInteractionHandle();
@@ -478,7 +481,7 @@ const PanResponder = {
478
481
  : config.onShouldBlockNativeResponder(event, gestureState);
479
482
  },
480
483
 
481
- onResponderReject(event: PressEvent): void {
484
+ onResponderReject(event: GestureResponderEvent): void {
482
485
  clearInteractionHandle(
483
486
  interactionState,
484
487
  config.onPanResponderReject,
@@ -487,7 +490,7 @@ const PanResponder = {
487
490
  );
488
491
  },
489
492
 
490
- onResponderRelease(event: PressEvent): void {
493
+ onResponderRelease(event: GestureResponderEvent): void {
491
494
  clearInteractionHandle(
492
495
  interactionState,
493
496
  config.onPanResponderRelease,
@@ -497,7 +500,7 @@ const PanResponder = {
497
500
  PanResponder._initializeGestureState(gestureState);
498
501
  },
499
502
 
500
- onResponderStart(event: PressEvent): void {
503
+ onResponderStart(event: GestureResponderEvent): void {
501
504
  const touchHistory = event.touchHistory;
502
505
  gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
503
506
  if (config.onPanResponderStart) {
@@ -505,7 +508,7 @@ const PanResponder = {
505
508
  }
506
509
  },
507
510
 
508
- onResponderMove(event: PressEvent): void {
511
+ onResponderMove(event: GestureResponderEvent): void {
509
512
  const touchHistory = event.touchHistory;
510
513
  // Guard against the dispatch of two touch moves when there are two
511
514
  // simultaneously changed touches.
@@ -523,7 +526,7 @@ const PanResponder = {
523
526
  }
524
527
  },
525
528
 
526
- onResponderEnd(event: PressEvent): void {
529
+ onResponderEnd(event: GestureResponderEvent): void {
527
530
  const touchHistory = event.touchHistory;
528
531
  gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
529
532
  clearInteractionHandle(
@@ -534,7 +537,7 @@ const PanResponder = {
534
537
  );
535
538
  },
536
539
 
537
- onResponderTerminate(event: PressEvent): void {
540
+ onResponderTerminate(event: GestureResponderEvent): void {
538
541
  clearInteractionHandle(
539
542
  interactionState,
540
543
  config.onPanResponderTerminate,
@@ -544,7 +547,7 @@ const PanResponder = {
544
547
  PanResponder._initializeGestureState(gestureState);
545
548
  },
546
549
 
547
- onResponderTerminationRequest(event: PressEvent): boolean {
550
+ onResponderTerminationRequest(event: GestureResponderEvent): boolean {
548
551
  return config.onPanResponderTerminationRequest == null
549
552
  ? true
550
553
  : config.onPanResponderTerminationRequest(event, gestureState);
@@ -562,7 +565,7 @@ const PanResponder = {
562
565
  function clearInteractionHandle(
563
566
  interactionState: {handle: ?number, ...},
564
567
  callback: ?(ActiveCallback | PassiveCallback),
565
- event: PressEvent,
568
+ event: GestureResponderEvent,
566
569
  gestureState: GestureState,
567
570
  ) {
568
571
  if (interactionState.handle) {
@@ -10,7 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const infoLog = require('../Utilities/infoLog');
13
+ const infoLog = require('../Utilities/infoLog').default;
14
14
  const invariant = require('invariant');
15
15
 
16
16
  type SimpleTask = {
@@ -20,11 +20,25 @@ import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNa
20
20
  import {getFabricUIManager} from '../ReactNative/FabricUIManager';
21
21
  import Platform from '../Utilities/Platform';
22
22
 
23
+ export type {
24
+ LayoutAnimationType,
25
+ LayoutAnimationProperty,
26
+ LayoutAnimationAnimationConfig as LayoutAnimationAnim,
27
+ } from '../Renderer/shims/ReactNativeTypes';
28
+
23
29
  const UIManager = require('../ReactNative/UIManager').default;
24
30
 
25
31
  // Reexport type
26
32
  export type LayoutAnimationConfig = LayoutAnimationConfig_;
27
33
 
34
+ export type LayoutAnimationTypes = $ReadOnly<{
35
+ [type in LayoutAnimationType]: type,
36
+ }>;
37
+
38
+ export type LayoutAnimationProperties = $ReadOnly<{
39
+ [prop in LayoutAnimationProperty]: prop,
40
+ }>;
41
+
28
42
  type OnAnimationDidEndCallback = () => void;
29
43
  type OnAnimationDidFailCallback = () => void;
30
44
 
@@ -103,8 +117,8 @@ function configureNext(
103
117
 
104
118
  function create(
105
119
  duration: number,
106
- type: LayoutAnimationType,
107
- property: LayoutAnimationProperty,
120
+ type?: LayoutAnimationType,
121
+ property?: LayoutAnimationProperty,
108
122
  ): LayoutAnimationConfig {
109
123
  return {
110
124
  duration,
@@ -174,13 +188,13 @@ const LayoutAnimation = {
174
188
  easeIn: 'easeIn',
175
189
  easeOut: 'easeOut',
176
190
  keyboard: 'keyboard',
177
- }) as $ReadOnly<{[K in LayoutAnimationType]: K}>,
191
+ }) as LayoutAnimationTypes,
178
192
  Properties: Object.freeze({
179
193
  opacity: 'opacity',
180
194
  scaleX: 'scaleX',
181
195
  scaleY: 'scaleY',
182
196
  scaleXY: 'scaleXY',
183
- }) as $ReadOnly<{[K in LayoutAnimationProperty]: K}>,
197
+ }) as LayoutAnimationProperties,
184
198
  checkConfig(...args: Array<mixed>) {
185
199
  console.error('LayoutAnimation.checkConfig(...) has been disabled.');
186
200
  },
@@ -10,10 +10,10 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import {typeof FillRateHelper as FillRateHelperType} from '@react-native/virtualized-lists';
13
+ import VirtualizedLists from '@react-native/virtualized-lists';
14
14
 
15
- const FillRateHelper: FillRateHelperType =
16
- require('@react-native/virtualized-lists').FillRateHelper;
15
+ type FillRateHelperType = typeof VirtualizedLists.FillRateHelper;
16
+ const FillRateHelper: FillRateHelperType = VirtualizedLists.FillRateHelper;
17
17
 
18
18
  export type {FillRateInfo} from '@react-native/virtualized-lists';
19
19
  export default FillRateHelper;
@@ -11,8 +11,8 @@
11
11
  import typeof ScrollViewNativeComponent from '../Components/ScrollView/ScrollViewNativeComponent';
12
12
  import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
13
13
  import type {
14
- RenderItemProps,
15
- RenderItemType,
14
+ ListRenderItem,
15
+ ListRenderItemInfo,
16
16
  ViewabilityConfigCallbackPair,
17
17
  ViewToken,
18
18
  } from '@react-native/virtualized-lists';
@@ -20,18 +20,18 @@ import type {
20
20
  import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
21
21
  import {type ScrollResponderType} from '../Components/ScrollView/ScrollView';
22
22
  import View from '../Components/View/View';
23
- import {
24
- VirtualizedList,
25
- keyExtractor as defaultKeyExtractor,
26
- } from '@react-native/virtualized-lists';
23
+ import VirtualizedLists from '@react-native/virtualized-lists';
27
24
  import memoizeOne from 'memoize-one';
28
25
  import React from 'react';
29
26
 
30
- const StyleSheet = require('../StyleSheet/StyleSheet');
31
- const deepDiffer = require('../Utilities/differ/deepDiffer');
32
- const Platform = require('../Utilities/Platform');
27
+ const StyleSheet = require('../StyleSheet/StyleSheet').default;
28
+ const deepDiffer = require('../Utilities/differ/deepDiffer').default;
29
+ const Platform = require('../Utilities/Platform').default;
33
30
  const invariant = require('invariant');
34
31
 
32
+ const VirtualizedList = VirtualizedLists.VirtualizedList;
33
+ const defaultKeyExtractor = VirtualizedLists.keyExtractor;
34
+
35
35
  type RequiredProps<ItemT> = {
36
36
  /**
37
37
  * An array (or array-like list) of items to render. Other data types can be
@@ -66,7 +66,7 @@ type OptionalProps<ItemT> = {
66
66
  * `highlight` and `unhighlight` (which set the `highlighted: boolean` prop) are insufficient for
67
67
  * your use-case.
68
68
  */
69
- renderItem?: ?RenderItemType<ItemT>,
69
+ renderItem?: ?ListRenderItem<ItemT>,
70
70
 
71
71
  /**
72
72
  * Optional custom style for multi-item rows generated when numColumns > 1.
@@ -618,7 +618,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
618
618
 
619
619
  _renderer = (
620
620
  ListItemComponent: ?(React.ComponentType<any> | React.MixedElement),
621
- renderItem: ?RenderItemType<ItemT>,
621
+ renderItem: ?ListRenderItem<ItemT>,
622
622
  columnWrapperStyle: ?ViewStyleProp,
623
623
  numColumns: ?number,
624
624
  extraData: ?any,
@@ -626,7 +626,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
626
626
  ) => {
627
627
  const cols = numColumnsOrDefault(numColumns);
628
628
 
629
- const render = (props: RenderItemProps<ItemT>): React.Node => {
629
+ const render = (props: ListRenderItemInfo<ItemT>): React.Node => {
630
630
  if (ListItemComponent) {
631
631
  // $FlowFixMe[not-a-component] Component isn't valid
632
632
  // $FlowFixMe[incompatible-type-arg] Component isn't valid
@@ -640,7 +640,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
640
640
  }
641
641
  };
642
642
 
643
- const renderProp = (info: RenderItemProps<ItemT>) => {
643
+ const renderProp = (info: ListRenderItemInfo<ItemT>) => {
644
644
  if (cols > 1) {
645
645
  const {item, index} = info;
646
646
  invariant(
@@ -18,9 +18,11 @@ import type {
18
18
  } from '@react-native/virtualized-lists';
19
19
 
20
20
  import Platform from '../Utilities/Platform';
21
- import {VirtualizedSectionList} from '@react-native/virtualized-lists';
21
+ import VirtualizedLists from '@react-native/virtualized-lists';
22
22
  import * as React from 'react';
23
23
 
24
+ const VirtualizedSectionList = VirtualizedLists.VirtualizedSectionList;
25
+
24
26
  type Item = any;
25
27
 
26
28
  export type SectionBase<SectionItemT> = _SectionBase<SectionItemT>;
@@ -19,9 +19,11 @@ import type {
19
19
  import type {ElementRef} from 'react';
20
20
 
21
21
  import Platform from '../Utilities/Platform';
22
- import {VirtualizedSectionList} from '@react-native/virtualized-lists';
22
+ import VirtualizedLists from '@react-native/virtualized-lists';
23
23
  import React, {forwardRef, useImperativeHandle, useRef} from 'react';
24
24
 
25
+ const VirtualizedSectionList = VirtualizedLists.VirtualizedSectionList;
26
+
25
27
  type Item = any;
26
28
 
27
29
  export type SectionBase<SectionItemT> = _SectionBase<SectionItemT>;
@@ -16,9 +16,10 @@ export type {
16
16
  ViewabilityConfigCallbackPair,
17
17
  } from '@react-native/virtualized-lists';
18
18
 
19
- import {typeof ViewabilityHelper as ViewabilityHelperType} from '@react-native/virtualized-lists';
19
+ import VirtualizedLists from '@react-native/virtualized-lists';
20
20
 
21
+ type ViewabilityHelperType = typeof VirtualizedLists.ViewabilityHelper;
21
22
  const ViewabilityHelper: ViewabilityHelperType =
22
- require('@react-native/virtualized-lists').ViewabilityHelper;
23
+ VirtualizedLists.ViewabilityHelper;
23
24
 
24
25
  export default ViewabilityHelper;
@@ -10,7 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import {typeof keyExtractor as KeyExtractorType} from '@react-native/virtualized-lists';
13
+ import VirtualizedLists from '@react-native/virtualized-lists';
14
14
 
15
- export const keyExtractor: KeyExtractorType =
16
- require('@react-native/virtualized-lists').keyExtractor;
15
+ type KeyExtractorType = typeof VirtualizedLists.keyExtractor;
16
+ export const keyExtractor: KeyExtractorType = VirtualizedLists.keyExtractor;
@@ -10,14 +10,14 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import {typeof VirtualizedList as VirtualizedListType} from '@react-native/virtualized-lists';
13
+ import VirtualizedLists from '@react-native/virtualized-lists';
14
14
 
15
- const VirtualizedList: VirtualizedListType =
16
- require('@react-native/virtualized-lists').VirtualizedList;
15
+ type VirtualizedListType = typeof VirtualizedLists.VirtualizedList;
16
+ const VirtualizedList: VirtualizedListType = VirtualizedLists.VirtualizedList;
17
17
 
18
18
  export type {
19
- RenderItemProps,
20
- RenderItemType,
19
+ ListRenderItemInfo,
20
+ ListRenderItem,
21
21
  Separators,
22
22
  } from '@react-native/virtualized-lists';
23
23
  export default VirtualizedList;
@@ -10,7 +10,9 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import {typeof VirtualizedListContextResetter as VirtualizedListContextResetterType} from '@react-native/virtualized-lists';
13
+ import VirtualizedLists from '@react-native/virtualized-lists';
14
14
 
15
+ type VirtualizedListContextResetterType =
16
+ typeof VirtualizedLists.VirtualizedListContextResetter;
15
17
  export const VirtualizedListContextResetter: VirtualizedListContextResetterType =
16
- require('@react-native/virtualized-lists').VirtualizedListContextResetter;
18
+ VirtualizedLists.VirtualizedListContextResetter;
@@ -10,10 +10,12 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import {typeof VirtualizedSectionList as VirtualizedSectionListType} from '@react-native/virtualized-lists';
13
+ import VirtualizedLists from '@react-native/virtualized-lists';
14
14
 
15
+ type VirtualizedSectionListType =
16
+ typeof VirtualizedLists.VirtualizedSectionList;
15
17
  const VirtualizedSectionList: VirtualizedSectionListType =
16
- require('@react-native/virtualized-lists').VirtualizedSectionList;
18
+ VirtualizedLists.VirtualizedSectionList;
17
19
 
18
20
  export type {
19
21
  SectionBase,
@@ -25,7 +25,7 @@ interface ILogBox {
25
25
  uninstall(): void;
26
26
  isInstalled(): boolean;
27
27
  ignoreLogs($ReadOnlyArray<IgnorePattern>): void;
28
- ignoreAllLogs(?boolean): void;
28
+ ignoreAllLogs(value?: boolean): void;
29
29
  clearAllLogs(): void;
30
30
  addLog(log: LogData): void;
31
31
  addException(error: ExtendedExceptionData): void;
@@ -116,10 +116,18 @@ if (__DEV__) {
116
116
  return isLogBoxInstalled;
117
117
  },
118
118
 
119
+ /**
120
+ * Silence any logs that match the given strings or regexes.
121
+ */
119
122
  ignoreLogs(patterns: $ReadOnlyArray<IgnorePattern>): void {
120
123
  LogBoxData.addIgnorePatterns(patterns);
121
124
  },
122
125
 
126
+ /**
127
+ * Toggle error and warning notifications
128
+ * Note: this only disables notifications, uncaught errors will still open a full screen LogBox.
129
+ * @param ignore whether to ignore logs or not
130
+ */
123
131
  ignoreAllLogs(value?: ?boolean): void {
124
132
  LogBoxData.setDisabled(value == null ? true : value);
125
133
  },
@@ -70,7 +70,9 @@ export default function Ansi({
70
70
  /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
71
71
  * LTI update could not be added via codemod */
72
72
  const getText = (content, key) => {
73
- if (key === 1) {
73
+ if (key === 0) {
74
+ return LRM + content;
75
+ } else if (key === 1) {
74
76
  // Remove the vertical bar after line numbers
75
77
  return content.replace(/\| $/, ' ');
76
78
  } else if (key === 2 && commonWhitespaceLength < Infinity) {
@@ -86,7 +88,6 @@ export default function Ansi({
86
88
  {parsedLines.map((items, i) => (
87
89
  <View style={styles.line} key={i}>
88
90
  <Text>
89
- {LRM}
90
91
  {items.map((bundle, key) => {
91
92
  const textStyle =
92
93
  bundle.fg && COLORS[bundle.fg]
@@ -98,7 +99,10 @@ export default function Ansi({
98
99
  backgroundColor: bundle.bg && COLORS[bundle.bg],
99
100
  };
100
101
  return (
101
- <Text style={[style, textStyle]} key={key}>
102
+ <Text
103
+ id="logbox_codeframe_contents_text"
104
+ style={[style, textStyle]}
105
+ key={key}>
102
106
  {getText(bundle.content, key)}
103
107
  </Text>
104
108
  );
@@ -10,7 +10,7 @@
10
10
 
11
11
  import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType';
12
12
  import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
13
- import type {PressEvent} from '../../Types/CoreEventTypes';
13
+ import type {GestureResponderEvent} from '../../Types/CoreEventTypes';
14
14
 
15
15
  import TouchableWithoutFeedback from '../../Components/Touchable/TouchableWithoutFeedback';
16
16
  import View from '../../Components/View/View';
@@ -19,13 +19,14 @@ import * as LogBoxStyle from './LogBoxStyle';
19
19
  import * as React from 'react';
20
20
 
21
21
  type Props = $ReadOnly<{
22
+ id?: string,
22
23
  backgroundColor: $ReadOnly<{
23
24
  default: string,
24
25
  pressed: string,
25
26
  }>,
26
27
  children?: React.Node,
27
28
  hitSlop?: ?EdgeInsetsProp,
28
- onPress?: ?(event: PressEvent) => void,
29
+ onPress?: ?(event: GestureResponderEvent) => void,
29
30
  style?: ViewStyleProp,
30
31
  }>;
31
32
 
@@ -42,6 +43,7 @@ function LogBoxButton(props: Props): React.Node {
42
43
 
43
44
  const content = (
44
45
  <View
46
+ id={props.id}
45
47
  style={StyleSheet.compose(
46
48
  {
47
49
  backgroundColor: pressed
@@ -64,7 +64,7 @@ export default function LogBoxInspector(props: Props): React.Node {
64
64
  }
65
65
 
66
66
  return (
67
- <View style={styles.root}>
67
+ <View id="logbox_inspector" style={styles.root}>
68
68
  <LogBoxInspectorHeader
69
69
  onSelectIndex={props.onChangeSelectedIndex}
70
70
  selectedIndex={selectedIndex}