@office-iss/react-native-win32 0.0.0-canary.301 → 0.0.0-canary.303

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 (132) hide show
  1. package/.flowconfig +2 -2
  2. package/CHANGELOG.json +49 -1
  3. package/CHANGELOG.md +24 -5
  4. package/IntegrationTests/IntegrationTestsApp.js +1 -1
  5. package/IntegrationTests/LayoutEventsTest.js +3 -3
  6. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +3 -3
  7. package/Libraries/Alert/RCTAlertManager.android.js +2 -2
  8. package/Libraries/Animated/AnimatedEvent.js +1 -1
  9. package/Libraries/Animated/AnimatedImplementation.js +2 -2
  10. package/Libraries/Animated/AnimatedMock.js +1 -1
  11. package/Libraries/Animated/NativeAnimatedAllowlist.js +1 -0
  12. package/Libraries/Animated/animations/Animation.js +5 -6
  13. package/Libraries/Animated/components/AnimatedScrollView.js +1 -1
  14. package/Libraries/Animated/nodes/AnimatedColor.js +9 -9
  15. package/Libraries/Animated/nodes/AnimatedInterpolation.js +4 -4
  16. package/Libraries/Animated/nodes/AnimatedProps.js +2 -2
  17. package/Libraries/Animated/nodes/AnimatedStyle.js +6 -4
  18. package/Libraries/Animated/nodes/AnimatedTransform.js +1 -1
  19. package/Libraries/AppState/AppState.js +5 -1
  20. package/Libraries/BatchedBridge/NativeModules.js +1 -1
  21. package/Libraries/Blob/BlobManager.js +1 -1
  22. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
  23. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
  24. package/Libraries/Components/Button.js +1 -1
  25. package/Libraries/Components/Button.win32.js +1 -1
  26. package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
  27. package/Libraries/Components/ScrollView/ScrollView.js +3 -2
  28. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
  29. package/Libraries/Components/TextInput/TextInput.flow.js +12 -5
  30. package/Libraries/Components/TextInput/TextInput.flow.win32.js +12 -5
  31. package/Libraries/Components/TextInput/TextInput.js +9 -4
  32. package/Libraries/Components/TextInput/TextInput.win32.js +9 -6
  33. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +2 -3
  34. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -1
  35. package/Libraries/Components/View/View.win32.js +3 -1
  36. package/Libraries/Core/Devtools/loadBundleFromServer.js +1 -1
  37. package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +1 -1
  38. package/Libraries/Core/ExceptionsManager.js +2 -2
  39. package/Libraries/Core/ReactFiberErrorDialog.js +3 -3
  40. package/Libraries/Core/ReactNativeVersion.js +1 -1
  41. package/Libraries/Core/Timers/JSTimers.js +1 -1
  42. package/Libraries/Core/Timers/immediateShim.js +1 -1
  43. package/Libraries/Debugging/DebuggingOverlayRegistry.js +5 -3
  44. package/Libraries/Image/Image.android.js +318 -111
  45. package/Libraries/Image/ImageSourceUtils.js +8 -2
  46. package/Libraries/Image/resolveAssetSource.js +1 -1
  47. package/Libraries/Interaction/InteractionManager.js +1 -1
  48. package/Libraries/Interaction/PanResponder.js +1 -1
  49. package/Libraries/Lists/FlatList.js +5 -6
  50. package/Libraries/LogBox/Data/LogBoxData.js +1 -1
  51. package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
  52. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -1
  53. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +1 -1
  54. package/Libraries/Modal/Modal.js +2 -2
  55. package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
  56. package/Libraries/NativeComponent/ViewConfig.js +1 -1
  57. package/Libraries/Network/RCTNetworking.android.js +1 -1
  58. package/Libraries/Network/RCTNetworking.ios.js +1 -1
  59. package/Libraries/Network/RCTNetworking.win32.js +1 -1
  60. package/Libraries/Network/convertRequestBody.js +1 -1
  61. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +10 -9
  62. package/Libraries/Pressability/HoverState.js +2 -0
  63. package/Libraries/Pressability/HoverState.win32.js +2 -0
  64. package/Libraries/PushNotificationIOS/PushNotificationIOS.js +2 -2
  65. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -0
  66. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +3 -3
  67. package/Libraries/ReactNative/RendererImplementation.js +116 -116
  68. package/Libraries/ReactNative/UIManager.js +3 -3
  69. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -1
  70. package/Libraries/Renderer/shims/ReactFabric.js +1 -3
  71. package/Libraries/Renderer/shims/ReactFeatureFlags.js +1 -3
  72. package/Libraries/Renderer/shims/ReactNative.js +1 -3
  73. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +1 -3
  74. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +1 -3
  75. package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +2 -2
  76. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +2 -2
  77. package/Libraries/StyleSheet/PlatformColorValueTypes.win32.js +4 -0
  78. package/Libraries/StyleSheet/flattenStyle.js +2 -2
  79. package/Libraries/StyleSheet/splitLayoutProps.js +2 -2
  80. package/Libraries/Text/Text.js +509 -235
  81. package/Libraries/Text/Text.win32.js +622 -275
  82. package/Libraries/Text/TextNativeComponent.js +2 -2
  83. package/Libraries/Text/TextNativeComponent.win32.js +2 -2
  84. package/Libraries/Utilities/HMRClient.js +0 -1
  85. package/Libraries/Utilities/Platform.android.js +3 -3
  86. package/Libraries/Utilities/Platform.d.ts +1 -0
  87. package/Libraries/Utilities/Platform.ios.js +1 -1
  88. package/Libraries/Utilities/Platform.win32.js +3 -3
  89. package/Libraries/Utilities/PlatformTypes.js +1 -1
  90. package/Libraries/Utilities/ReactNativeTestTools.js +12 -0
  91. package/Libraries/Utilities/codegenNativeCommands.js +1 -1
  92. package/Libraries/Utilities/codegenNativeComponent.js +1 -1
  93. package/Libraries/Utilities/differ/pointsDiffer.js +1 -1
  94. package/Libraries/vendor/emitter/EventEmitter.js +1 -1
  95. package/index.js +3 -0
  96. package/index.win32.js +4 -0
  97. package/jest/local-setup.js +2 -2
  98. package/jest/mock.js +1 -1
  99. package/jest/mockComponent.js +8 -8
  100. package/jest/mockNativeComponent.js +3 -2
  101. package/jest/mocks/Modal.js +1 -1
  102. package/jest/mocks/ScrollView.js +1 -1
  103. package/jest/mocks/ViewNativeComponent.js +1 -1
  104. package/jest/setup.js +12 -12
  105. package/overrides.json +16 -16
  106. package/package.json +12 -12
  107. package/src/private/animated/NativeAnimatedHelper.js +3 -3
  108. package/src/private/animated/NativeAnimatedHelper.win32.js +3 -3
  109. package/src/private/animated/createAnimatedPropsHook.js +9 -11
  110. package/src/private/animated/createAnimatedPropsMemoHook.js +6 -6
  111. package/src/private/components/virtualview/VirtualView.js +7 -4
  112. package/src/private/components/virtualview/VirtualViewNativeComponent.js +6 -0
  113. package/src/private/devsupport/devmenu/elementinspector/Inspector.js +2 -2
  114. package/src/private/featureflags/ReactNativeFeatureFlags.js +9 -8
  115. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +1 -2
  116. package/src/private/renderer/errorhandling/ErrorHandlers.js +3 -3
  117. package/src/private/types/HostInstance.js +4 -1
  118. package/src/private/webapis/dom/nodes/ReactNativeDocument.js +22 -2
  119. package/src/private/webapis/dom/nodes/ReactNativeElement.js +1 -1
  120. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +5 -3
  121. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +16 -13
  122. package/src/private/webapis/dom/nodes/internals/NodeInternals.js +45 -22
  123. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -1
  124. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +26 -192
  125. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +14 -11
  126. package/src/private/webapis/dom/oldstylecollections/NodeList.js +13 -10
  127. package/src/private/webapis/geometry/DOMRectList.js +1 -1
  128. package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +1 -1
  129. package/src/private/webapis/performance/EventTiming.js +1 -1
  130. package/src/private/webapis/performance/Performance.js +12 -30
  131. package/src/private/webapis/performance/specs/NativePerformance.js +4 -4
  132. package/src/private/webapis/structuredClone/structuredClone.js +9 -9
@@ -23,7 +23,7 @@ const RCTNetworking = {
23
23
  listener: (...RCTNetworkingEventDefinitions[K]) => mixed,
24
24
  context?: mixed,
25
25
  ): EventSubscription {
26
- // $FlowFixMe[incompatible-call]
26
+ // $FlowFixMe[incompatible-type]
27
27
  return RCTDeviceEventEmitter.addListener(eventType, listener, context);
28
28
  },
29
29
 
@@ -23,7 +23,7 @@ const RCTNetworking = {
23
23
  listener: (...RCTNetworkingEventDefinitions[K]) => mixed,
24
24
  context?: mixed,
25
25
  ): EventSubscription {
26
- // $FlowFixMe[incompatible-call]
26
+ // $FlowFixMe[incompatible-type]
27
27
  return RCTDeviceEventEmitter.addListener(eventType, listener, context);
28
28
  },
29
29
 
@@ -36,7 +36,7 @@ function convertRequestBody(body: RequestBody): Object {
36
36
  return {formData: body.getParts()};
37
37
  }
38
38
  if (body instanceof ArrayBuffer || ArrayBuffer.isView(body)) {
39
- /* $FlowFixMe[incompatible-call] : no way to assert that 'body' is indeed
39
+ /* $FlowFixMe[incompatible-type] : no way to assert that 'body' is indeed
40
40
  * an ArrayBufferView */
41
41
  return {base64: binaryToBase64(body)};
42
42
  }
@@ -8,6 +8,8 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import type {DialogOptions} from '../../src/private/specs_DEPRECATED/modules/NativeDialogManagerAndroid';
12
+
11
13
  import NativeDialogManagerAndroid from '../NativeModules/specs/NativeDialogManagerAndroid';
12
14
  import NativePermissionsAndroid from './NativePermissionsAndroid';
13
15
  import invariant from 'invariant';
@@ -249,24 +251,24 @@ class PermissionsAndroidImpl {
249
251
 
250
252
  if (shouldShowRationale && !!NativeDialogManagerAndroid) {
251
253
  return new Promise((resolve, reject) => {
252
- const options = {
254
+ /* $FlowFixMe[incompatible-exact] (>=0.111.0 site=react_native_fb)
255
+ * This comment suppresses an error found when Flow v0.111 was
256
+ * deployed. To see the error, delete this comment and run Flow.
257
+ */
258
+ const options: DialogOptions = {
253
259
  ...rationale,
254
260
  };
255
261
  NativeDialogManagerAndroid.showAlert(
256
- /* $FlowFixMe[incompatible-exact] (>=0.111.0 site=react_native_fb)
257
- * This comment suppresses an error found when Flow v0.111 was
258
- * deployed. To see the error, delete this comment and run Flow.
259
- */
260
262
  options,
261
263
  () => reject(new Error('Error showing rationale')),
262
264
  () =>
263
- // $FlowFixMe[incompatible-call]
265
+ // $FlowFixMe[incompatible-type]
264
266
  resolve(NativePermissionsAndroid.requestPermission(permission)),
265
267
  );
266
268
  });
267
269
  }
268
270
  }
269
- // $FlowFixMe[incompatible-return]
271
+ // $FlowFixMe[incompatible-type]
270
272
  return NativePermissionsAndroid.requestPermission(permission);
271
273
  }
272
274
 
@@ -291,8 +293,7 @@ class PermissionsAndroidImpl {
291
293
  NativePermissionsAndroid,
292
294
  'PermissionsAndroid is not installed correctly.',
293
295
  );
294
- // $FlowFixMe[incompatible-return]
295
- // $FlowFixMe[incompatible-call]
296
+ // $FlowFixMe[incompatible-type]
296
297
  return NativePermissionsAndroid.requestMultiplePermissions(permissions);
297
298
  }
298
299
  }
@@ -14,6 +14,8 @@ let isEnabled = false;
14
14
 
15
15
  /* $FlowFixMe[incompatible-type] Error found due to incomplete typing of
16
16
  * Platform.flow.js */
17
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition roll
18
+ * out. See https://fburl.com/workplace/4oq3zi07. */
17
19
  if (Platform.OS === 'web') {
18
20
  const canUseDOM = Boolean(
19
21
  typeof window !== 'undefined' &&
@@ -14,6 +14,8 @@ let isEnabled = false;
14
14
 
15
15
  /* $FlowFixMe[incompatible-type] Error found due to incomplete typing of
16
16
  * Platform.flow.js */
17
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition roll
18
+ * out. See https://fburl.com/workplace/4oq3zi07. */
17
19
  if (Platform.OS === 'web') {
18
20
  const canUseDOM = Boolean(
19
21
  typeof window !== 'undefined' &&
@@ -210,7 +210,7 @@ class PushNotificationIOS {
210
210
  NativePushNotificationManagerIOS,
211
211
  'PushNotificationManager is not available.',
212
212
  );
213
- // $FlowFixMe[prop-missing]
213
+ // $FlowFixMe[incompatible-type]
214
214
  NativePushNotificationManagerIOS.presentLocalNotification(details);
215
215
  }
216
216
 
@@ -235,7 +235,7 @@ class PushNotificationIOS {
235
235
  NativePushNotificationManagerIOS,
236
236
  'PushNotificationManager is not available.',
237
237
  );
238
- // $FlowFixMe[prop-missing]
238
+ // $FlowFixMe[incompatible-type]
239
239
  NativePushNotificationManagerIOS.scheduleLocalNotification(details);
240
240
  }
241
241
 
@@ -58,10 +58,12 @@ export default class ReactFabricHostComponent implements NativeMethods {
58
58
  }
59
59
 
60
60
  blur() {
61
+ // $FlowFixMe - Error supressed during the migration of HostInstance to ReactNativeElement
61
62
  TextInputState.blurTextInput(this);
62
63
  }
63
64
 
64
65
  focus() {
66
+ // $FlowFixMe - Error supressed during the migration of HostInstance to ReactNativeElement
65
67
  TextInputState.focusTextInput(this);
66
68
  }
67
69
 
@@ -132,7 +132,7 @@ export function getNodeFromPublicInstance(
132
132
  RendererProxy = require('../../ReactNative/RendererProxy');
133
133
  }
134
134
  return RendererProxy.getNodeFromInternalInstanceHandle(
135
- // $FlowExpectedError[incompatible-call] __internalInstanceHandle is always an InternalInstanceHandle from React when we get here.
135
+ // $FlowExpectedError[incompatible-type] __internalInstanceHandle is always an InternalInstanceHandle from React when we get here.
136
136
  publicInstance.__internalInstanceHandle,
137
137
  );
138
138
  }
@@ -143,10 +143,10 @@ export function getInternalInstanceHandleFromPublicInstance(
143
143
  // TODO(T174762768): Remove this once OSS versions of renderers will be synced.
144
144
  // $FlowExpectedError[prop-missing] Keeping this for backwards-compatibility with the renderers versions in open source.
145
145
  if (publicInstance._internalInstanceHandle != null) {
146
- // $FlowExpectedError[incompatible-return] Keeping this for backwards-compatibility with the renderers versions in open source.
146
+ // $FlowExpectedError[incompatible-type] Keeping this for backwards-compatibility with the renderers versions in open source.
147
147
  return publicInstance._internalInstanceHandle;
148
148
  }
149
149
 
150
- // $FlowExpectedError[incompatible-return] __internalInstanceHandle is always an InternalInstanceHandle from React when we get here.
150
+ // $FlowExpectedError[incompatible-type] __internalInstanceHandle is always an InternalInstanceHandle from React when we get here.
151
151
  return publicInstance.__internalInstanceHandle;
152
152
  }
@@ -9,19 +9,71 @@
9
9
  */
10
10
 
11
11
  import type {HostInstance} from '../../src/private/types/HostInstance';
12
- import type {
13
- InternalInstanceHandle,
14
- Node,
15
- } from '../Renderer/shims/ReactNativeTypes';
12
+ import typeof ReactFabricType from '../Renderer/shims/ReactFabric';
13
+ import typeof ReactNativeType from '../Renderer/shims/ReactNative';
14
+ import type {RootTag} from './RootTag';
16
15
 
17
16
  import {
18
17
  onCaughtError,
19
18
  onRecoverableError,
20
19
  onUncaughtError,
21
20
  } from '../../src/private/renderer/errorhandling/ErrorHandlers';
22
- import {type RootTag} from './RootTag';
23
21
  import * as React from 'react';
24
22
 
23
+ let cachedFabricRenderer;
24
+ let cachedPaperRenderer;
25
+
26
+ function getFabricRenderer(): ReactFabricType {
27
+ if (cachedFabricRenderer == null) {
28
+ cachedFabricRenderer = require('../Renderer/shims/ReactFabric').default;
29
+ }
30
+ return cachedFabricRenderer;
31
+ }
32
+
33
+ function getPaperRenderer(): ReactNativeType {
34
+ if (cachedPaperRenderer == null) {
35
+ cachedPaperRenderer = require('../Renderer/shims/ReactNative').default;
36
+ }
37
+ return cachedPaperRenderer;
38
+ }
39
+
40
+ const getMethod: (<MethodName: $Keys<ReactFabricType>>(
41
+ () => ReactFabricType,
42
+ MethodName,
43
+ ) => ReactFabricType[MethodName]) &
44
+ (<MethodName: $Keys<ReactNativeType>>(
45
+ () => ReactNativeType,
46
+ MethodName,
47
+ ) => ReactNativeType[MethodName]) = (getRenderer, methodName) => {
48
+ let cachedImpl;
49
+
50
+ // $FlowExpectedError
51
+ return function (arg1, arg2, arg3, arg4, arg5, arg6) {
52
+ if (cachedImpl == null) {
53
+ // $FlowExpectedError
54
+ cachedImpl = getRenderer()[methodName];
55
+ }
56
+
57
+ // $FlowExpectedError
58
+ return cachedImpl(arg1, arg2, arg3, arg4, arg5);
59
+ };
60
+ };
61
+
62
+ function getFabricMethod<MethodName: $Keys<ReactFabricType>>(
63
+ methodName: MethodName,
64
+ ): ReactFabricType[MethodName] {
65
+ return getMethod(getFabricRenderer, methodName);
66
+ }
67
+
68
+ function getPaperMethod<MethodName: $Keys<ReactNativeType>>(
69
+ methodName: MethodName,
70
+ ): ReactNativeType[MethodName] {
71
+ return getMethod(getPaperRenderer, methodName);
72
+ }
73
+
74
+ let cachedFabricRender;
75
+ let cachedPaperRender;
76
+
25
77
  export function renderElement({
26
78
  element,
27
79
  rootTag,
@@ -34,50 +86,30 @@ export function renderElement({
34
86
  useConcurrentRoot: boolean,
35
87
  }): void {
36
88
  if (useFabric) {
37
- require('../Renderer/shims/ReactFabric').default.render(
38
- element,
39
- rootTag,
40
- null,
41
- useConcurrentRoot,
42
- {
43
- onCaughtError,
44
- onUncaughtError,
45
- onRecoverableError,
46
- },
47
- );
89
+ if (cachedFabricRender == null) {
90
+ cachedFabricRender = getFabricRenderer().render;
91
+ }
92
+
93
+ cachedFabricRender(element, rootTag, null, useConcurrentRoot, {
94
+ onCaughtError,
95
+ onUncaughtError,
96
+ onRecoverableError,
97
+ });
48
98
  } else {
49
- require('../Renderer/shims/ReactNative').default.render(
50
- element,
51
- rootTag,
52
- undefined,
53
- {
54
- onCaughtError,
55
- onUncaughtError,
56
- onRecoverableError,
57
- },
58
- );
59
- }
60
- }
99
+ if (cachedPaperRender == null) {
100
+ cachedPaperRender = getPaperRenderer().render;
101
+ }
61
102
 
62
- export function findHostInstance_DEPRECATED<TElementType: React.ElementType>(
63
- // $FlowFixMe[incompatible-call]
64
- componentOrHandle: ?(React.ElementRef<TElementType> | number),
65
- ): ?HostInstance {
66
- return require('../Renderer/shims/ReactNative').default.findHostInstance_DEPRECATED(
67
- // $FlowFixMe[incompatible-call]
68
- componentOrHandle,
69
- );
103
+ cachedPaperRender(element, rootTag, undefined, {
104
+ onCaughtError,
105
+ onUncaughtError,
106
+ onRecoverableError,
107
+ });
108
+ }
70
109
  }
71
110
 
72
- export function findNodeHandle<TElementType: React.ElementType>(
73
- // $FlowFixMe[incompatible-call]
74
- componentOrHandle: ?(React.ElementRef<TElementType> | number),
75
- ): ?number {
76
- return require('../Renderer/shims/ReactNative').default.findNodeHandle(
77
- // $FlowFixMe[incompatible-call]
78
- componentOrHandle,
79
- );
80
- }
111
+ let cachedFabricDispatchCommand;
112
+ let cachedPaperDispatchCommand;
81
113
 
82
114
  export function dispatchCommand(
83
115
  handle: HostInstance,
@@ -87,90 +119,58 @@ export function dispatchCommand(
87
119
  if (global.RN$Bridgeless === true) {
88
120
  // Note: this function has the same implementation in the legacy and new renderer.
89
121
  // However, evaluating the old renderer comes with some side effects.
90
- return require('../Renderer/shims/ReactFabric').default.dispatchCommand(
91
- handle,
92
- command,
93
- args,
94
- );
122
+ if (cachedFabricDispatchCommand == null) {
123
+ cachedFabricDispatchCommand = getFabricRenderer().dispatchCommand;
124
+ }
125
+
126
+ return cachedFabricDispatchCommand(handle, command, args);
95
127
  } else {
96
- return require('../Renderer/shims/ReactNative').default.dispatchCommand(
97
- handle,
98
- command,
99
- args,
100
- );
128
+ if (cachedPaperDispatchCommand == null) {
129
+ cachedPaperDispatchCommand = getPaperRenderer().dispatchCommand;
130
+ }
131
+
132
+ return cachedPaperDispatchCommand(handle, command, args);
101
133
  }
102
134
  }
103
135
 
104
- export function sendAccessibilityEvent(
105
- handle: HostInstance,
106
- eventType: string,
107
- ): void {
108
- return require('../Renderer/shims/ReactNative').default.sendAccessibilityEvent(
109
- handle,
110
- eventType,
111
- );
112
- }
136
+ export const findHostInstance_DEPRECATED: <TElementType: React.ElementType>(
137
+ // $FlowExpectedError[incompatible-type]
138
+ componentOrHandle: ?(React.ElementRef<TElementType> | number),
139
+ ) => ?HostInstance = getPaperMethod('findHostInstance_DEPRECATED');
140
+
141
+ export const findNodeHandle: <TElementType: React.ElementType>(
142
+ // $FlowExpectedError[incompatible-type]
143
+ componentOrHandle: ?(React.ElementRef<TElementType> | number),
144
+ ) => ?number = getPaperMethod('findNodeHandle');
145
+
146
+ export const sendAccessibilityEvent: ReactNativeType['sendAccessibilityEvent'] =
147
+ getPaperMethod('sendAccessibilityEvent');
113
148
 
114
149
  /**
115
150
  * This method is used by AppRegistry to unmount a root when using the old
116
151
  * React Native renderer (Paper).
117
152
  */
118
- export function unmountComponentAtNodeAndRemoveContainer(rootTag: RootTag) {
119
- // $FlowExpectedError[incompatible-type] rootTag is an opaque type so we can't really cast it as is.
120
- const rootTagAsNumber: number = rootTag;
121
- require('../Renderer/shims/ReactNative').default.unmountComponentAtNodeAndRemoveContainer(
122
- rootTagAsNumber,
123
- );
124
- }
153
+ export const unmountComponentAtNodeAndRemoveContainer: (
154
+ rootTag: RootTag,
155
+ ) => void =
156
+ // $FlowExpectedError[incompatible-type]
157
+ getPaperMethod('unmountComponentAtNodeAndRemoveContainer');
125
158
 
126
- export function unstable_batchedUpdates<T>(
127
- fn: T => void,
128
- bookkeeping: T,
129
- ): void {
130
- // This doesn't actually do anything when batching updates for a Fabric root.
131
- return require('../Renderer/shims/ReactNative').default.unstable_batchedUpdates(
132
- fn,
133
- bookkeeping,
134
- );
135
- }
159
+ export const unstable_batchedUpdates: ReactNativeType['unstable_batchedUpdates'] =
160
+ getPaperMethod('unstable_batchedUpdates');
136
161
 
137
- export function isProfilingRenderer(): boolean {
138
- return Boolean(__DEV__);
139
- }
162
+ export const isChildPublicInstance: ReactNativeType['isChildPublicInstance'] =
163
+ getPaperMethod('isChildPublicInstance');
140
164
 
141
- export function isChildPublicInstance(
142
- parentInstance: HostInstance,
143
- childInstance: HostInstance,
144
- ): boolean {
145
- return require('../Renderer/shims/ReactNative').default.isChildPublicInstance(
146
- parentInstance,
147
- childInstance,
148
- );
149
- }
165
+ export const getNodeFromInternalInstanceHandle: ReactFabricType['getNodeFromInternalInstanceHandle'] =
166
+ getFabricMethod('getNodeFromInternalInstanceHandle');
150
167
 
151
- export function getNodeFromInternalInstanceHandle(
152
- internalInstanceHandle: InternalInstanceHandle,
153
- ): ?Node {
154
- // This is only available in Fabric
155
- return require('../Renderer/shims/ReactFabric').default.getNodeFromInternalInstanceHandle(
156
- internalInstanceHandle,
157
- );
158
- }
168
+ export const getPublicInstanceFromInternalInstanceHandle: ReactFabricType['getPublicInstanceFromInternalInstanceHandle'] =
169
+ getFabricMethod('getPublicInstanceFromInternalInstanceHandle');
159
170
 
160
- export function getPublicInstanceFromInternalInstanceHandle(
161
- internalInstanceHandle: InternalInstanceHandle,
162
- ): mixed /*PublicInstance | PublicTextInstance | null*/ {
163
- // This is only available in Fabric
164
- return require('../Renderer/shims/ReactFabric').default.getPublicInstanceFromInternalInstanceHandle(
165
- internalInstanceHandle,
166
- );
167
- }
171
+ export const getPublicInstanceFromRootTag: ReactFabricType['getPublicInstanceFromRootTag'] =
172
+ getFabricMethod('getPublicInstanceFromRootTag');
168
173
 
169
- export function getPublicInstanceFromRootTag(
170
- rootTag: number,
171
- ): mixed /*PublicRootInstance | null*/ {
172
- // This is only available in Fabric
173
- return require('../Renderer/shims/ReactFabric').default.getPublicInstanceFromRootTag(
174
- rootTag,
175
- );
174
+ export function isProfilingRenderer(): boolean {
175
+ return Boolean(__DEV__);
176
176
  }
@@ -45,7 +45,7 @@ const UIManager: UIManagerJSInterface = {
45
45
  FabricUIManager.measure(shadowNode, callback);
46
46
  } else {
47
47
  console.warn(`measure cannot find view with tag #${reactTag}`);
48
- // $FlowFixMe[incompatible-call]
48
+ // $FlowFixMe[incompatible-type]
49
49
  callback();
50
50
  }
51
51
  } else {
@@ -71,7 +71,7 @@ const UIManager: UIManagerJSInterface = {
71
71
  FabricUIManager.measureInWindow(shadowNode, callback);
72
72
  } else {
73
73
  console.warn(`measure cannot find view with tag #${reactTag}`);
74
- // $FlowFixMe[incompatible-call]
74
+ // $FlowFixMe[incompatible-type]
75
75
  callback();
76
76
  }
77
77
  } else {
@@ -182,7 +182,7 @@ const UIManager: UIManagerJSInterface = {
182
182
  UIManagerImpl.dispatchViewManagerCommand(
183
183
  reactTag,
184
184
  // We have some legacy components that are actually already using strings. ¯\_(ツ)_/¯
185
- // $FlowFixMe[incompatible-call]
185
+ // $FlowFixMe[incompatible-type]
186
186
  commandName,
187
187
  commandArgs,
188
188
  );
@@ -86,7 +86,7 @@ module.exports = {
86
86
  // TODO: Remove when React has migrated to `createAttributePayload` and `diffAttributePayloads`
87
87
  get flattenStyle(): flattenStyle<DangerouslyImpreciseStyleProp> {
88
88
  // $FlowFixMe[underconstrained-implicit-instantiation]
89
- // $FlowFixMe[incompatible-return]
89
+ // $FlowFixMe[incompatible-type]
90
90
  return require('../StyleSheet/flattenStyle').default;
91
91
  },
92
92
  get ReactFiberErrorDialog(): ReactFiberErrorDialog {
@@ -7,9 +7,7 @@
7
7
  * @noformat
8
8
  * @nolint
9
9
  * @flow
10
- * @generated SignedSource<<16b364e89f43b8a47832b0dfb98af11e>>
11
- *
12
- * This file was sync'd from the facebook/react repository.
10
+ * @generated SignedSource<<cf323fc5ca893bab5669c7d321660412>>
13
11
  */
14
12
 
15
13
  'use strict';
@@ -7,9 +7,7 @@
7
7
  * @noformat
8
8
  * @nolint
9
9
  * @flow strict-local
10
- * @generated SignedSource<<1dd9e9c3f20e37ae14e485fc6ee3d9e9>>
11
- *
12
- * This file was sync'd from the facebook/react repository.
10
+ * @generated SignedSource<<908f5fb85384725318e261f40e49d9a6>>
13
11
  */
14
12
 
15
13
  'use strict';
@@ -7,9 +7,7 @@
7
7
  * @noformat
8
8
  * @nolint
9
9
  * @flow
10
- * @generated SignedSource<<e2c46705ed927302dbe9332dafba459d>>
11
- *
12
- * This file was sync'd from the facebook/react repository.
10
+ * @generated SignedSource<<8f46fdc9267fcc4fdc9e76842fe24066>>
13
11
  */
14
12
  'use strict';
15
13
 
@@ -7,9 +7,7 @@
7
7
  * @noformat
8
8
  * @nolint
9
9
  * @flow strict-local
10
- * @generated SignedSource<<e8dce0e82b831c91465d04b49fb48ab2>>
11
- *
12
- * This file was sync'd from the facebook/react repository.
10
+ * @generated SignedSource<<83073425aa3f71ced2c8c51f25a25938>>
13
11
  */
14
12
 
15
13
  'use strict';
@@ -7,9 +7,7 @@
7
7
  * @noformat
8
8
  * @nolint
9
9
  * @flow strict-local
10
- * @generated SignedSource<<556d1487de0b9e4a09cbc67dd130a884>>
11
- *
12
- * This file was sync'd from the facebook/react repository.
10
+ * @generated SignedSource<<52163887de05f1cff05388145cf85b3b>>
13
11
  */
14
12
 
15
13
  'use strict';
@@ -17,7 +17,7 @@ type LocalNativeColorValue = {
17
17
  };
18
18
 
19
19
  export const PlatformColor = (...names: Array<string>): ColorValue => {
20
- /* $FlowExpectedError[incompatible-return]
20
+ /* $FlowExpectedError[incompatible-type]
21
21
  * LocalNativeColorValue is the actual type of the opaque NativeColorValue on Android platform */
22
22
  return ({resource_paths: names}: LocalNativeColorValue);
23
23
  };
@@ -25,7 +25,7 @@ export const PlatformColor = (...names: Array<string>): ColorValue => {
25
25
  export const normalizeColorObject = (
26
26
  color: NativeColorValue,
27
27
  ): ?ProcessedColorValue => {
28
- /* $FlowExpectedError[incompatible-cast]
28
+ /* $FlowExpectedError[incompatible-type]
29
29
  * LocalNativeColorValue is the actual type of the opaque NativeColorValue on Android platform */
30
30
  if ('resource_paths' in (color: LocalNativeColorValue)) {
31
31
  return color;
@@ -23,7 +23,7 @@ type LocalNativeColorValue = {
23
23
  };
24
24
 
25
25
  export const PlatformColor = (...names: Array<string>): ColorValue => {
26
- // $FlowExpectedError[incompatible-return] LocalNativeColorValue is the iOS LocalNativeColorValue type
26
+ // $FlowExpectedError[incompatible-type] LocalNativeColorValue is the iOS LocalNativeColorValue type
27
27
  return ({semantic: names}: LocalNativeColorValue);
28
28
  };
29
29
 
@@ -44,7 +44,7 @@ export const DynamicColorIOSPrivate = (
44
44
  highContrastLight: tuple.highContrastLight,
45
45
  highContrastDark: tuple.highContrastDark,
46
46
  },
47
- /* $FlowExpectedError[incompatible-return]
47
+ /* $FlowExpectedError[incompatible-type]
48
48
  * LocalNativeColorValue is the actual type of the opaque NativeColorValue on iOS platform */
49
49
  }: LocalNativeColorValue);
50
50
  };
@@ -32,6 +32,7 @@ type LocalNativeColorValue =
32
32
 
33
33
  export const PlatformColor = (...names: Array<string>): ColorValue => {
34
34
  // $FlowExpectedError[incompatible-return] LocalNativeColorValue is the Windows LocalNativeColorValue type
35
+ // $FlowExpectedError[incompatible-type]
35
36
  return ({resource_paths: names}: LocalNativeColorValue);
36
37
  };
37
38
 
@@ -39,6 +40,7 @@ export const ColorGradientWin32Private = (
39
40
  gradientColor: GradientColorValueWin32,
40
41
  ): ColorValue => {
41
42
  // $FlowExpectedError[incompatible-return]
43
+ // $FlowExpectedError[incompatible-type]
42
44
  return gradientColor;
43
45
  };
44
46
 
@@ -49,8 +51,10 @@ export const normalizeColorObject = (
49
51
  * LocalNativeColorValue is the actual type of the opaque NativeColorValue on Windows platform */
50
52
  if (
51
53
  // $FlowExpectedError[incompatible-cast]
54
+ // $FlowExpectedError[incompatible-type]
52
55
  'resource_paths' in (color: LocalNativeColorValue) ||
53
56
  // $FlowExpectedError[incompatible-cast]
57
+ // $FlowExpectedError[incompatible-type]
54
58
  'gradientDirection' in (color: LocalNativeColorValue)
55
59
  ) {
56
60
  return color;
@@ -31,7 +31,7 @@ function flattenStyle<
31
31
  }
32
32
 
33
33
  if (!Array.isArray(style)) {
34
- // $FlowFixMe[incompatible-return]
34
+ // $FlowFixMe[incompatible-type]
35
35
  return style;
36
36
  }
37
37
 
@@ -49,7 +49,7 @@ function flattenStyle<
49
49
  }
50
50
  }
51
51
  }
52
- // $FlowFixMe[incompatible-return]
52
+ // $FlowFixMe[incompatible-type]
53
53
  return result;
54
54
  }
55
55
 
@@ -18,9 +18,9 @@ export default function splitLayoutProps(props: ?____ViewStyle_Internal): {
18
18
  let inner: ?____ViewStyle_Internal = null;
19
19
 
20
20
  if (props != null) {
21
- // $FlowIgnore[incompatible-exact] Will contain a subset of keys from `props`.
21
+ // $FlowFixMe[incompatible-exact] Will contain a subset of keys from `props`.
22
22
  outer = {};
23
- // $FlowIgnore[incompatible-exact] Will contain a subset of keys from `props`.
23
+ // $FlowFixMe[incompatible-exact] Will contain a subset of keys from `props`.
24
24
  inner = {};
25
25
 
26
26
  for (const prop of Object.keys(props)) {