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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/.flowconfig +3 -11
  2. package/CHANGELOG.json +118 -43
  3. package/CHANGELOG.md +45 -27
  4. package/IntegrationTests/IntegrationTestsApp.js +2 -2
  5. package/IntegrationTests/LayoutEventsTest.js +3 -3
  6. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +7 -3
  7. package/Libraries/Alert/RCTAlertManager.android.js +4 -2
  8. package/Libraries/Animated/Animated.d.ts +2 -0
  9. package/Libraries/Animated/AnimatedEvent.js +1 -1
  10. package/Libraries/Animated/AnimatedExports.js.flow +1 -0
  11. package/Libraries/Animated/AnimatedImplementation.js +4 -2
  12. package/Libraries/Animated/AnimatedMock.js +1 -1
  13. package/Libraries/Animated/Easing.js +2 -0
  14. package/Libraries/Animated/NativeAnimatedAllowlist.js +1 -0
  15. package/Libraries/Animated/animations/Animation.js +19 -20
  16. package/Libraries/Animated/animations/TimingAnimation.js +2 -0
  17. package/Libraries/Animated/components/AnimatedScrollView.js +3 -2
  18. package/Libraries/Animated/components/AnimatedSectionList.js +1 -1
  19. package/Libraries/Animated/nodes/AnimatedColor.js +9 -9
  20. package/Libraries/Animated/nodes/AnimatedInterpolation.js +4 -4
  21. package/Libraries/Animated/nodes/AnimatedNode.js +14 -7
  22. package/Libraries/Animated/nodes/AnimatedObject.js +7 -7
  23. package/Libraries/Animated/nodes/AnimatedProps.js +32 -32
  24. package/Libraries/Animated/nodes/AnimatedStyle.js +23 -21
  25. package/Libraries/Animated/nodes/AnimatedTransform.js +6 -6
  26. package/Libraries/Animated/nodes/AnimatedValue.js +18 -26
  27. package/Libraries/AppState/AppState.js +8 -4
  28. package/Libraries/BatchedBridge/BatchedBridge.js +1 -0
  29. package/Libraries/BatchedBridge/MessageQueue.js +5 -0
  30. package/Libraries/BatchedBridge/NativeModules.js +1 -1
  31. package/Libraries/Blob/BlobManager.js +1 -1
  32. package/Libraries/Blob/URLSearchParams.js +2 -0
  33. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +2 -2
  34. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +2 -2
  35. package/Libraries/Components/Button.js +1 -1
  36. package/Libraries/Components/Button.win32.js +1 -1
  37. package/Libraries/Components/Pressable/Pressable.js +10 -1
  38. package/Libraries/Components/Pressable/Pressable.win32.js +9 -0
  39. package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
  40. package/Libraries/Components/ScrollView/ScrollView.js +13 -4
  41. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
  42. package/Libraries/Components/StatusBar/StatusBar.js +2 -2
  43. package/Libraries/Components/Switch/Switch.js +1 -1
  44. package/Libraries/Components/TextInput/TextInput.flow.js +12 -5
  45. package/Libraries/Components/TextInput/TextInput.flow.win32.js +12 -5
  46. package/Libraries/Components/TextInput/TextInput.js +14 -5
  47. package/Libraries/Components/TextInput/TextInput.win32.js +15 -7
  48. package/Libraries/Components/TextInput/TextInputState.js +1 -1
  49. package/Libraries/Components/TextInput/TextInputState.win32.js +1 -1
  50. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +2 -3
  51. package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
  52. package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
  53. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
  54. package/Libraries/Components/Touchable/TouchableOpacity.js +1 -1
  55. package/Libraries/Components/Touchable/TouchableWin32.js +1 -1
  56. package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
  57. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +3 -3
  58. package/Libraries/Components/View/View.js +81 -167
  59. package/Libraries/Components/View/View.win32.js +3 -1
  60. package/Libraries/Core/Devtools/loadBundleFromServer.js +1 -1
  61. package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +1 -1
  62. package/Libraries/Core/ExceptionsManager.js +4 -2
  63. package/Libraries/Core/ReactFiberErrorDialog.js +3 -3
  64. package/Libraries/Core/ReactNativeVersion.js +37 -10
  65. package/Libraries/Core/Timers/JSTimers.js +4 -1
  66. package/Libraries/Core/Timers/NativeTiming.js +1 -0
  67. package/Libraries/Core/Timers/immediateShim.js +2 -1
  68. package/Libraries/Core/Timers/queueMicrotask.js +1 -0
  69. package/Libraries/Core/setUpPerformance.js +3 -4
  70. package/Libraries/Debugging/DebuggingOverlayRegistry.js +5 -3
  71. package/Libraries/Image/Image.android.js +327 -111
  72. package/Libraries/Image/Image.ios.js +6 -1
  73. package/Libraries/Image/Image.win32.js +6 -1
  74. package/Libraries/Image/ImageSourceUtils.js +8 -2
  75. package/Libraries/Image/assetPaths.js +1 -1
  76. package/Libraries/Image/resolveAssetSource.js +1 -1
  77. package/Libraries/Image/resolveAssetSource.win32.js +6 -7
  78. package/Libraries/Interaction/InteractionManager.js +118 -167
  79. package/Libraries/Interaction/PanResponder.js +7 -52
  80. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -0
  81. package/Libraries/Lists/FlatList.js +5 -6
  82. package/Libraries/LogBox/Data/LogBoxData.js +5 -2
  83. package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
  84. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +2 -2
  85. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -1
  86. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +1 -1
  87. package/Libraries/Modal/Modal.js +3 -3
  88. package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
  89. package/Libraries/NativeComponent/ViewConfig.js +2 -2
  90. package/Libraries/Network/RCTNetworking.android.js +1 -1
  91. package/Libraries/Network/RCTNetworking.ios.js +1 -1
  92. package/Libraries/Network/RCTNetworking.win32.js +1 -1
  93. package/Libraries/Network/XMLHttpRequest.js +20 -5
  94. package/Libraries/Network/convertRequestBody.js +1 -1
  95. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +10 -9
  96. package/Libraries/Pressability/HoverState.js +2 -0
  97. package/Libraries/Pressability/HoverState.win32.js +2 -0
  98. package/Libraries/Pressability/Pressability.js +1 -1
  99. package/Libraries/Pressability/Pressability.win32.js +1 -1
  100. package/Libraries/PushNotificationIOS/PushNotificationIOS.js +2 -2
  101. package/Libraries/ReactNative/AppRegistryImpl.js +4 -2
  102. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -0
  103. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +3 -3
  104. package/Libraries/ReactNative/RendererImplementation.js +116 -116
  105. package/Libraries/ReactNative/UIManager.js +3 -3
  106. package/Libraries/ReactNative/renderApplication.js +1 -0
  107. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -1
  108. package/Libraries/Renderer/implementations/ReactFabric-dev.js +38 -35
  109. package/Libraries/Renderer/implementations/ReactFabric-prod.js +51 -22
  110. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +54 -24
  111. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +36 -33
  112. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5 -5
  113. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5 -5
  114. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
  115. package/Libraries/Share/Share.js +4 -0
  116. package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +2 -2
  117. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +2 -2
  118. package/Libraries/StyleSheet/PlatformColorValueTypes.win32.js +4 -0
  119. package/Libraries/StyleSheet/StyleSheet.d.ts +7 -22
  120. package/Libraries/StyleSheet/StyleSheetExports.js +2 -8
  121. package/Libraries/StyleSheet/StyleSheetExports.js.flow +11 -18
  122. package/Libraries/StyleSheet/flattenStyle.js +2 -2
  123. package/Libraries/StyleSheet/processAspectRatio.js +2 -0
  124. package/Libraries/StyleSheet/processFilter.js +5 -5
  125. package/Libraries/StyleSheet/splitLayoutProps.js +2 -2
  126. package/Libraries/Text/Text.js +534 -234
  127. package/Libraries/Text/Text.win32.js +647 -274
  128. package/Libraries/Text/TextNativeComponent.js +2 -2
  129. package/Libraries/Text/TextNativeComponent.win32.js +2 -2
  130. package/Libraries/Utilities/Appearance.d.ts +3 -5
  131. package/Libraries/Utilities/Appearance.js +5 -17
  132. package/Libraries/Utilities/HMRClient.js +2 -1
  133. package/Libraries/Utilities/Platform.android.js +3 -3
  134. package/Libraries/Utilities/Platform.d.ts +1 -0
  135. package/Libraries/Utilities/Platform.ios.js +1 -1
  136. package/Libraries/Utilities/Platform.win32.js +3 -3
  137. package/Libraries/Utilities/PlatformTypes.js +1 -1
  138. package/Libraries/Utilities/ReactNativeTestTools.js +12 -0
  139. package/Libraries/Utilities/SceneTracker.js +1 -1
  140. package/Libraries/Utilities/codegenNativeCommands.js +1 -1
  141. package/Libraries/Utilities/codegenNativeComponent.js +1 -1
  142. package/Libraries/Utilities/createPerformanceLogger.js +32 -0
  143. package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +2 -0
  144. package/Libraries/Utilities/differ/pointsDiffer.js +1 -1
  145. package/Libraries/Utilities/useMergeRefs.js +1 -1
  146. package/Libraries/WebSocket/WebSocketInterceptor.js +2 -0
  147. package/Libraries/promiseRejectionTrackingOptions.js +17 -31
  148. package/Libraries/vendor/emitter/EventEmitter.js +1 -1
  149. package/flow/bom.js.flow +223 -1
  150. package/flow/prettier.js.flow +14 -0
  151. package/index.js +14 -2
  152. package/index.win32.js +16 -2
  153. package/jest/local-setup.js +2 -2
  154. package/jest/mock.js +1 -1
  155. package/jest/mockComponent.js +9 -9
  156. package/jest/mockNativeComponent.js +3 -2
  157. package/jest/mocks/Modal.js +1 -1
  158. package/jest/mocks/ScrollView.js +1 -1
  159. package/jest/mocks/ViewNativeComponent.js +1 -1
  160. package/jest/setup.js +23 -12
  161. package/overrides.json +23 -23
  162. package/package.json +28 -27
  163. package/saveAssetPlugin.js +2 -2
  164. package/src/private/animated/NativeAnimatedHelper.js +16 -5
  165. package/src/private/animated/NativeAnimatedHelper.win32.js +16 -5
  166. package/src/private/animated/createAnimatedPropsHook.js +11 -60
  167. package/src/private/animated/createAnimatedPropsMemoHook.js +8 -54
  168. package/src/private/components/virtualview/VirtualView.js +43 -12
  169. package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +93 -0
  170. package/src/private/components/virtualview/VirtualViewNativeComponent.js +6 -0
  171. package/src/private/devsupport/devmenu/elementinspector/Inspector.js +2 -2
  172. package/src/private/devsupport/devmenu/elementinspector/ReactDevToolsOverlay.js +2 -2
  173. package/src/private/featureflags/ReactNativeFeatureFlags.js +85 -52
  174. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
  175. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +15 -6
  176. package/src/private/renderer/errorhandling/ErrorHandlers.js +3 -3
  177. package/src/private/setup/{setUpPerformanceObserver.js → setUpPerformanceModern.js} +43 -18
  178. package/src/private/specs_DEPRECATED/modules/NativeTiming.js +1 -0
  179. package/src/private/types/HostInstance.js +4 -1
  180. package/src/private/webapis/dom/nodes/ReactNativeDocument.js +22 -2
  181. package/src/private/webapis/dom/nodes/ReactNativeElement.js +1 -1
  182. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +5 -3
  183. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +16 -13
  184. package/src/private/webapis/dom/nodes/internals/NodeInternals.js +45 -22
  185. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -1
  186. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +26 -192
  187. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +15 -12
  188. package/src/private/webapis/dom/oldstylecollections/NodeList.js +14 -11
  189. package/src/private/webapis/geometry/DOMRectList.js +2 -2
  190. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +19 -74
  191. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +0 -4
  192. package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +1 -1
  193. package/src/private/webapis/performance/EventTiming.js +40 -25
  194. package/src/private/webapis/performance/LongTasks.js +35 -2
  195. package/src/private/webapis/performance/Performance.js +347 -166
  196. package/src/private/webapis/performance/PerformanceEntry.js +40 -23
  197. package/src/private/webapis/performance/PerformanceObserver.js +37 -29
  198. package/src/private/webapis/performance/ReactNativeStartupTiming.js +3 -24
  199. package/src/private/webapis/performance/ResourceTiming.js +29 -18
  200. package/src/private/webapis/performance/UserTiming.js +92 -34
  201. package/src/private/webapis/performance/UserTimingExtensibility.js.flow +38 -0
  202. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -4
  203. package/src/private/webapis/performance/internals/Utilities.js +9 -0
  204. package/src/private/webapis/performance/specs/NativePerformance.js +23 -23
  205. package/src/private/webapis/structuredClone/structuredClone.js +10 -10
  206. package/src-win/Libraries/Components/Touchable/TouchableWin32.tsx +1 -1
  207. package/Libraries/Interaction/InteractionManagerStub.js +0 -184
  208. package/Libraries/Interaction/TaskQueue.js +0 -183
  209. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +0 -31
@@ -67,7 +67,7 @@ const virtualTextViewConfig = {
67
67
 
68
68
  export const NativeText: HostComponent<NativeTextProps> =
69
69
  (createReactNativeComponentClass('RCTText', () =>
70
- /* $FlowFixMe[incompatible-call] Natural Inference rollout. See
70
+ /* $FlowFixMe[incompatible-type] Natural Inference rollout. See
71
71
  * https://fburl.com/workplace/6291gfvu */
72
72
  createViewConfig(textViewConfig),
73
73
  ): any);
@@ -76,7 +76,7 @@ export const NativeVirtualText: HostComponent<NativeTextProps> =
76
76
  !global.RN$Bridgeless && !UIManager.hasViewManagerConfig('RCTVirtualText')
77
77
  ? NativeText
78
78
  : (createReactNativeComponentClass('RCTVirtualText', () =>
79
- /* $FlowFixMe[incompatible-call] Natural Inference rollout. See
79
+ /* $FlowFixMe[incompatible-type] Natural Inference rollout. See
80
80
  * https://fburl.com/workplace/6291gfvu */
81
81
  createViewConfig(virtualTextViewConfig),
82
82
  ): any);
@@ -101,7 +101,7 @@ const virtualTextViewConfig = {
101
101
 
102
102
  export const NativeText: HostComponent<NativeTextProps> =
103
103
  (createReactNativeComponentClass('RCTText', () =>
104
- /* $FlowFixMe[incompatible-call] Natural Inference rollout. See
104
+ /* $FlowFixMe[incompatible-type] Natural Inference rollout. See
105
105
  * https://fburl.com/workplace/6291gfvu */
106
106
  createViewConfig(textViewConfig),
107
107
  ): any);
@@ -111,7 +111,7 @@ export const NativeVirtualText: HostComponent<NativeTextProps> =
111
111
  UIManager.getViewManagerConfig('RCTVirtualText') == null
112
112
  ? NativeText
113
113
  : (createReactNativeComponentClass('RCTVirtualText', () =>
114
- /* $FlowFixMe[incompatible-call] Natural Inference rollout. See
114
+ /* $FlowFixMe[incompatible-type] Natural Inference rollout. See
115
115
  * https://fburl.com/workplace/6291gfvu */
116
116
  createViewConfig(virtualTextViewConfig),
117
117
  ): any);
@@ -9,7 +9,7 @@
9
9
 
10
10
  import {NativeEventSubscription} from '../EventEmitter/RCTNativeAppEventEmitter';
11
11
 
12
- type ColorSchemeName = 'light' | 'dark' | null | undefined;
12
+ type ColorSchemeName = 'light' | 'dark' | 'unspecified';
13
13
 
14
14
  export namespace Appearance {
15
15
  type AppearancePreferences = {
@@ -26,7 +26,7 @@ export namespace Appearance {
26
26
  *
27
27
  * Example: `const colorScheme = Appearance.getColorScheme();`
28
28
  */
29
- export function getColorScheme(): ColorSchemeName;
29
+ export function getColorScheme(): ColorSchemeName | null | undefined;
30
30
 
31
31
  /**
32
32
  * Set the color scheme preference. This is useful for overriding the default
@@ -34,9 +34,7 @@ export namespace Appearance {
34
34
  * appearance of the system UI, only the appearance of the app.
35
35
  * Only available on iOS 13+ and Android 10+.
36
36
  */
37
- export function setColorScheme(
38
- scheme: ColorSchemeName | null | undefined,
39
- ): void;
37
+ export function setColorScheme(scheme: ColorSchemeName): void;
40
38
 
41
39
  /**
42
40
  * Add an event handler that is fired when appearance preferences change.
@@ -14,7 +14,6 @@ import typeof INativeAppearance from './NativeAppearance';
14
14
 
15
15
  import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
16
16
  import EventEmitter from '../vendor/emitter/EventEmitter';
17
- import invariant from 'invariant';
18
17
 
19
18
  export type {AppearancePreferences};
20
19
 
@@ -60,7 +59,7 @@ function getState(): $NonMaybeType<typeof lazyState> {
60
59
  appearanceChanged: [AppearancePreferences],
61
60
  }>(NativeAppearance).addListener('appearanceChanged', newAppearance => {
62
61
  state.appearance = {
63
- colorScheme: toColorScheme(newAppearance.colorScheme),
62
+ colorScheme: newAppearance.colorScheme,
64
63
  };
65
64
  eventEmitter.emit('change', state.appearance);
66
65
  });
@@ -83,7 +82,7 @@ export function getColorScheme(): ?ColorSchemeName {
83
82
  // Lazily initialize `state.appearance`. This should only
84
83
  // happen once because we never reassign a null value to it.
85
84
  state.appearance = {
86
- colorScheme: toColorScheme(NativeAppearance.getColorScheme()),
85
+ colorScheme: NativeAppearance.getColorScheme(),
87
86
  };
88
87
  }
89
88
  colorScheme = state.appearance.colorScheme;
@@ -94,13 +93,13 @@ export function getColorScheme(): ?ColorSchemeName {
94
93
  /**
95
94
  * Updates the current color scheme to the supplied value.
96
95
  */
97
- export function setColorScheme(colorScheme: ?ColorSchemeName): void {
96
+ export function setColorScheme(colorScheme: ColorSchemeName): void {
98
97
  const state = getState();
99
98
  const {NativeAppearance} = state;
100
99
  if (NativeAppearance != null) {
101
- NativeAppearance.setColorScheme(colorScheme ?? 'unspecified');
100
+ NativeAppearance.setColorScheme(colorScheme);
102
101
  state.appearance = {
103
- colorScheme: toColorScheme(NativeAppearance.getColorScheme()),
102
+ colorScheme,
104
103
  };
105
104
  }
106
105
  }
@@ -114,14 +113,3 @@ export function addChangeListener(
114
113
  const {eventEmitter} = getState();
115
114
  return eventEmitter.addListener('change', listener);
116
115
  }
117
-
118
- /**
119
- * TODO: (hramos) T52919652 Use ?ColorSchemeName once codegen supports union
120
- */
121
- function toColorScheme(colorScheme: ?string): ?ColorSchemeName {
122
- invariant(
123
- colorScheme === 'dark' || colorScheme === 'light' || colorScheme == null,
124
- "Unrecognized color scheme. Did you mean 'dark', 'light' or null?",
125
- );
126
- return colorScheme;
127
- }
@@ -128,7 +128,6 @@ const HMRClient: HMRClientNativeInterface = {
128
128
  JSON.stringify({
129
129
  type: 'log',
130
130
  level,
131
- mode: global.RN$Bridgeless === true ? 'NOBRIDGE' : 'BRIDGE',
132
131
  data: data.map(item =>
133
132
  typeof item === 'string'
134
133
  ? item
@@ -166,6 +165,8 @@ const HMRClient: HMRClientNativeInterface = {
166
165
  // Moving to top gives errors due to NativeModules not being initialized
167
166
  const DevLoadingView = require('./DevLoadingView').default;
168
167
 
168
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
169
+ * roll out. See https://fburl.com/workplace/5whu3i34. */
169
170
  const serverHost = port !== null && port !== '' ? `${host}:${port}` : host;
170
171
 
171
172
  const serverScheme = scheme;
@@ -72,12 +72,12 @@ const Platform: PlatformType = {
72
72
  },
73
73
  select: <T>(spec: PlatformSelectSpec<T>): T =>
74
74
  'android' in spec
75
- ? // $FlowFixMe[incompatible-return]
75
+ ? // $FlowFixMe[incompatible-type]
76
76
  spec.android
77
77
  : 'native' in spec
78
- ? // $FlowFixMe[incompatible-return]
78
+ ? // $FlowFixMe[incompatible-type]
79
79
  spec.native
80
- : // $FlowFixMe[incompatible-return]
80
+ : // $FlowFixMe[incompatible-type]
81
81
  spec.default,
82
82
  };
83
83
 
@@ -94,6 +94,7 @@ interface PlatformWindowsOSStatic extends PlatformStatic {
94
94
 
95
95
  interface PlatformWebStatic extends PlatformStatic {
96
96
  OS: 'web';
97
+ Version: string;
97
98
  }
98
99
 
99
100
  export type Platform =
@@ -78,7 +78,7 @@ const Platform: PlatformType = {
78
78
  return this.constants.isMacCatalyst ?? false;
79
79
  },
80
80
  select: <T>(spec: PlatformSelectSpec<T>): T =>
81
- // $FlowFixMe[incompatible-return]
81
+ // $FlowFixMe[incompatible-type]
82
82
  'ios' in spec ? spec.ios : 'native' in spec ? spec.native : spec.default,
83
83
  };
84
84
 
@@ -66,12 +66,12 @@ const Platform: PlatformType = {
66
66
  },
67
67
  select: <T>(spec: PlatformSelectSpec<T>): T =>
68
68
  'win32' in spec
69
- ? // $FlowFixMe[incompatible-return]
69
+ ? // $FlowFixMe[incompatible-type]
70
70
  spec.win32
71
71
  : 'native' in spec
72
- ? // $FlowFixMe[incompatible-return]
72
+ ? // $FlowFixMe[incompatible-type]
73
73
  spec.native
74
- : // $FlowFixMe[incompatible-return]
74
+ : // $FlowFixMe[incompatible-type]
75
75
  spec.default,
76
76
  };
77
77
 
@@ -196,7 +196,7 @@ type Win32Platform = {
196
196
  type WebPlatform = {
197
197
  OS: 'web',
198
198
  // $FlowFixMe[unsafe-getters-setters]
199
- get Version(): void,
199
+ get Version(): string,
200
200
  // $FlowFixMe[unsafe-getters-setters]
201
201
  get constants(): {
202
202
  reactNativeVersion: {
@@ -38,13 +38,21 @@ function byClickable(): Predicate {
38
38
  node =>
39
39
  // note: <Text /> lazy-mounts press handlers after the first press,
40
40
  // so this is a workaround for targeting text nodes.
41
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
42
+ * roll out. See https://fburl.com/workplace/4oq3zi07. */
41
43
  (node.type === Text &&
42
44
  node.props &&
43
45
  typeof node.props.onPress === 'function') ||
44
46
  // note: Special casing <Switch /> since it doesn't use touchable
47
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
48
+ * roll out. See https://fburl.com/workplace/4oq3zi07. */
45
49
  (node.type === Switch && node.props && node.props.disabled !== true) ||
50
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
51
+ * roll out. See https://fburl.com/workplace/4oq3zi07. */
46
52
  (node.type === View &&
47
53
  node?.props?.onStartShouldSetResponder?.testOnly_pressabilityConfig) ||
54
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
55
+ * roll out. See https://fburl.com/workplace/4oq3zi07. */
48
56
  (node.type === TouchableWithoutFeedback &&
49
57
  node.props &&
50
58
  typeof node.props.onPress === 'function') ||
@@ -174,8 +182,12 @@ function renderWithStrictMode(element: React.Node): ReactTestRendererType {
174
182
 
175
183
  function tap(instance: ReactTestInstance) {
176
184
  const touchable = instance.find(byClickable());
185
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
186
+ * roll out. See https://fburl.com/workplace/4oq3zi07. */
177
187
  if (touchable.type === Text && touchable.props && touchable.props.onPress) {
178
188
  touchable.props.onPress();
189
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
190
+ * roll out. See https://fburl.com/workplace/4oq3zi07. */
179
191
  } else if (touchable.type === Switch && touchable.props) {
180
192
  const value = !touchable.props.value;
181
193
  const {onChange, onValueChange} = touchable.props;
@@ -14,7 +14,7 @@ export type Scene = {name: string, [string]: mixed, ...};
14
14
 
15
15
  let _listeners: Array<(scene: Scene) => void> = [];
16
16
 
17
- let _activeScene = {name: 'default'};
17
+ let _activeScene: Scene = {name: 'default'};
18
18
 
19
19
  const SceneTracker = {
20
20
  setActiveScene(scene: Scene) {
@@ -22,7 +22,7 @@ function codegenNativeCommands<T: interface {}>(
22
22
  options.supportedCommands.forEach(command => {
23
23
  // $FlowFixMe[missing-local-annot]
24
24
  commandObj[command] = (ref, ...args) => {
25
- // $FlowFixMe[incompatible-call]
25
+ // $FlowFixMe[incompatible-type]
26
26
  dispatchCommand(ref, command, args);
27
27
  };
28
28
  });
@@ -65,7 +65,7 @@ function codegenNativeComponent<Props: {...}>(
65
65
  }
66
66
 
67
67
  return (requireNativeComponent<Props>(
68
- // $FlowFixMe[incompatible-call]
68
+ // $FlowFixMe[incompatible-type]
69
69
  componentNameInUse,
70
70
  ): HostComponent<Props>);
71
71
  }
@@ -35,6 +35,8 @@ class PerformanceLogger implements IPerformanceLogger {
35
35
  endExtras?: Extras,
36
36
  ) {
37
37
  if (this._closed) {
38
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
39
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
38
40
  if (PRINT_TO_CONSOLE && __DEV__) {
39
41
  console.log(
40
42
  'PerformanceLogger: addTimespan - has closed ignoring: ',
@@ -44,6 +46,8 @@ class PerformanceLogger implements IPerformanceLogger {
44
46
  return;
45
47
  }
46
48
  if (this._timespans[key]) {
49
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
50
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
47
51
  if (PRINT_TO_CONSOLE && __DEV__) {
48
52
  console.log(
49
53
  'PerformanceLogger: Attempting to add a timespan that already exists ',
@@ -79,6 +83,8 @@ class PerformanceLogger implements IPerformanceLogger {
79
83
  this._timespans = {};
80
84
  this._extras = {};
81
85
  this._points = {};
86
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
87
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
82
88
  if (PRINT_TO_CONSOLE) {
83
89
  console.log('PerformanceLogger.js', 'clear');
84
90
  }
@@ -92,6 +98,8 @@ class PerformanceLogger implements IPerformanceLogger {
92
98
  }
93
99
  this._extras = {};
94
100
  this._points = {};
101
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
102
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
95
103
  if (PRINT_TO_CONSOLE) {
96
104
  console.log('PerformanceLogger.js', 'clearCompleted');
97
105
  }
@@ -130,6 +138,8 @@ class PerformanceLogger implements IPerformanceLogger {
130
138
  }
131
139
 
132
140
  logEverything() {
141
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
142
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
133
143
  if (PRINT_TO_CONSOLE) {
134
144
  // log timespans
135
145
  for (const key in this._timespans) {
@@ -156,6 +166,8 @@ class PerformanceLogger implements IPerformanceLogger {
156
166
  extras?: Extras,
157
167
  ) {
158
168
  if (this._closed) {
169
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
170
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
159
171
  if (PRINT_TO_CONSOLE && __DEV__) {
160
172
  console.log(
161
173
  'PerformanceLogger: markPoint - has closed ignoring: ',
@@ -165,6 +177,8 @@ class PerformanceLogger implements IPerformanceLogger {
165
177
  return;
166
178
  }
167
179
  if (this._points[key] != null) {
180
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
181
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
168
182
  if (PRINT_TO_CONSOLE && __DEV__) {
169
183
  console.log(
170
184
  'PerformanceLogger: Attempting to mark a point that has been already logged ',
@@ -187,6 +201,8 @@ class PerformanceLogger implements IPerformanceLogger {
187
201
 
188
202
  setExtra(key: string, value: ExtraValue) {
189
203
  if (this._closed) {
204
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
205
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
190
206
  if (PRINT_TO_CONSOLE && __DEV__) {
191
207
  console.log('PerformanceLogger: setExtra - has closed ignoring: ', key);
192
208
  }
@@ -194,6 +210,8 @@ class PerformanceLogger implements IPerformanceLogger {
194
210
  }
195
211
 
196
212
  if (this._extras.hasOwnProperty(key)) {
213
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
214
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
197
215
  if (PRINT_TO_CONSOLE && __DEV__) {
198
216
  console.log(
199
217
  'PerformanceLogger: Attempting to set an extra that already exists ',
@@ -211,6 +229,8 @@ class PerformanceLogger implements IPerformanceLogger {
211
229
  extras?: Extras,
212
230
  ) {
213
231
  if (this._closed) {
232
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
233
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
214
234
  if (PRINT_TO_CONSOLE && __DEV__) {
215
235
  console.log(
216
236
  'PerformanceLogger: startTimespan - has closed ignoring: ',
@@ -221,6 +241,8 @@ class PerformanceLogger implements IPerformanceLogger {
221
241
  }
222
242
 
223
243
  if (this._timespans[key]) {
244
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
245
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
224
246
  if (PRINT_TO_CONSOLE && __DEV__) {
225
247
  console.log(
226
248
  'PerformanceLogger: Attempting to start a timespan that already exists ',
@@ -234,6 +256,8 @@ class PerformanceLogger implements IPerformanceLogger {
234
256
  startTime: timestamp,
235
257
  startExtras: extras,
236
258
  };
259
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
260
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
237
261
  if (PRINT_TO_CONSOLE) {
238
262
  console.log('PerformanceLogger.js', 'start: ' + key);
239
263
  }
@@ -245,6 +269,8 @@ class PerformanceLogger implements IPerformanceLogger {
245
269
  extras?: Extras,
246
270
  ) {
247
271
  if (this._closed) {
272
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
273
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
248
274
  if (PRINT_TO_CONSOLE && __DEV__) {
249
275
  console.log(
250
276
  'PerformanceLogger: stopTimespan - has closed ignoring: ',
@@ -256,6 +282,8 @@ class PerformanceLogger implements IPerformanceLogger {
256
282
 
257
283
  const timespan = this._timespans[key];
258
284
  if (!timespan || timespan.startTime == null) {
285
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
286
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
259
287
  if (PRINT_TO_CONSOLE && __DEV__) {
260
288
  console.log(
261
289
  'PerformanceLogger: Attempting to end a timespan that has not started ',
@@ -265,6 +293,8 @@ class PerformanceLogger implements IPerformanceLogger {
265
293
  return;
266
294
  }
267
295
  if (timespan.endTime != null) {
296
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
297
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
268
298
  if (PRINT_TO_CONSOLE && __DEV__) {
269
299
  console.log(
270
300
  'PerformanceLogger: Attempting to end a timespan that has already ended ',
@@ -277,6 +307,8 @@ class PerformanceLogger implements IPerformanceLogger {
277
307
  timespan.endExtras = extras;
278
308
  timespan.endTime = timestamp;
279
309
  timespan.totalTime = timespan.endTime - (timespan.startTime || 0);
310
+ /* $FlowFixMe[constant-condition] Error discovered during Constant
311
+ * Condition roll out. See https://fburl.com/workplace/1v97vimq. */
280
312
  if (PRINT_TO_CONSOLE) {
281
313
  console.log('PerformanceLogger.js', 'end: ' + key);
282
314
  }
@@ -33,6 +33,8 @@ function deepFreezeAndThrowOnMutationInDev<T: {...} | Array<mixed>>(
33
33
  if (__DEV__) {
34
34
  if (
35
35
  typeof object !== 'object' ||
36
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
37
+ * roll out. See https://fburl.com/workplace/5whu3i34. */
36
38
  object === null ||
37
39
  Object.isFrozen(object) ||
38
40
  Object.isSealed(object)
@@ -16,7 +16,7 @@ type Point = {
16
16
  ...
17
17
  };
18
18
 
19
- const dummyPoint = {x: undefined, y: undefined};
19
+ const dummyPoint: Point = {x: undefined, y: undefined};
20
20
 
21
21
  function pointsDiffer(one: ?Point, two: ?Point): boolean {
22
22
  one = one || dummyPoint;
@@ -31,7 +31,7 @@ export default function useMergeRefs<Instance>(
31
31
  return undefined;
32
32
  } else {
33
33
  if (typeof ref === 'function') {
34
- // $FlowIssue[incompatible-type] - Flow does not understand ref cleanup.
34
+ // $FlowFixMe[incompatible-type] - Flow does not understand ref cleanup.
35
35
  const cleanup: void | (() => void) = ref(current);
36
36
  return typeof cleanup === 'function'
37
37
  ? cleanup
@@ -232,6 +232,8 @@ const WebSocketInterceptor = {
232
232
 
233
233
  _arrayBufferToString(data: string): ArrayBuffer | string {
234
234
  const value = base64.toByteArray(data).buffer;
235
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
236
+ * roll out. See https://fburl.com/workplace/5whu3i34. */
235
237
  if (value === undefined || value === null) {
236
238
  return '(no value)';
237
239
  }
@@ -10,21 +10,21 @@
10
10
 
11
11
  import typeof {enable} from 'promise/setimmediate/rejection-tracking';
12
12
 
13
- import LogBox from './LogBox/LogBox';
13
+ import ExceptionsManager from './Core/ExceptionsManager';
14
14
 
15
15
  let rejectionTrackingOptions: $NonMaybeType<Parameters<enable>[0]> = {
16
16
  allRejections: true,
17
- onUnhandled: (id, rejection = {}) => {
17
+ onUnhandled: (id, rejection) => {
18
18
  let message: string;
19
- let stack: ?string;
20
19
 
21
- // $FlowFixMe[method-unbinding] added when improving typing for this parameters
22
- const stringValue = Object.prototype.toString.call(rejection);
23
- if (stringValue === '[object Error]') {
20
+ if (rejection === undefined) {
21
+ message = '';
22
+ } else if (
23
+ // $FlowFixMe[method-unbinding] added when improving typing for this parameters
24
+ Object.prototype.toString.call(rejection) === '[object Error]'
25
+ ) {
24
26
  // $FlowFixMe[method-unbinding] added when improving typing for this parameters
25
27
  message = Error.prototype.toString.call(rejection);
26
- const error: Error = (rejection: $FlowFixMe);
27
- stack = error.stack;
28
28
  } else {
29
29
  try {
30
30
  message = require('pretty-format').format(rejection);
@@ -34,37 +34,23 @@ let rejectionTrackingOptions: $NonMaybeType<Parameters<enable>[0]> = {
34
34
  ? rejection
35
35
  : JSON.stringify((rejection: $FlowFixMe));
36
36
  }
37
- // It could although this object is not a standard error, it still has stack information to unwind
38
- // $FlowFixMe ignore types just check if stack is there
39
- if (rejection?.stack && typeof rejection.stack === 'string') {
40
- stack = rejection.stack;
41
- }
42
37
  }
43
38
 
44
- const warning = `Possible unhandled promise rejection (id: ${id}):\n${
45
- message ?? ''
46
- }`;
47
- if (__DEV__) {
48
- LogBox.addLog({
49
- level: 'warn',
50
- message: {
51
- content: warning,
52
- substitutions: [],
39
+ ExceptionsManager.handleException(
40
+ new Error(
41
+ `Uncaught (in promise, id: ${id})${message ? `: "${message}"` : ''}`,
42
+ {
43
+ cause: rejection,
53
44
  },
54
- componentStack: [],
55
- componentStackType: null,
56
- stack,
57
- category: 'possible_unhandled_promise_rejection',
58
- });
59
- } else {
60
- console.warn(warning);
61
- }
45
+ ),
46
+ false /* isFatal */,
47
+ );
62
48
  },
63
49
  onHandled: id => {
64
50
  const warning =
65
51
  `Promise rejection handled (id: ${id})\n` +
66
52
  'This means you can ignore any previous messages of the form ' +
67
- `"Possible unhandled promise rejection (id: ${id}):"`;
53
+ `"Uncaught (in promise, id: ${id})"`;
68
54
  console.warn(warning);
69
55
  },
70
56
  };
@@ -126,7 +126,7 @@ export default class EventEmitter<
126
126
  // Copy `registrations` to take a snapshot when we invoke `emit`, in case
127
127
  // registrations are added or removed when listeners are invoked.
128
128
  for (const registration of Array.from(registrations)) {
129
- // $FlowFixMe[incompatible-call]
129
+ // $FlowFixMe[incompatible-type]
130
130
  registration.listener.apply(registration.context, args);
131
131
  }
132
132
  }