@office-iss/react-native-win32 0.0.0-canary.287 → 0.0.0-canary.288

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 (148) hide show
  1. package/.flowconfig +4 -1
  2. package/CHANGELOG.json +42 -1
  3. package/CHANGELOG.md +15 -4
  4. package/Libraries/Alert/RCTAlertManager.js.flow +18 -0
  5. package/Libraries/Animated/Animated.js +8 -37
  6. package/Libraries/Animated/Animated.js.flow +15 -0
  7. package/Libraries/Animated/AnimatedExports.js +47 -0
  8. package/Libraries/Animated/AnimatedExports.js.flow +48 -0
  9. package/Libraries/Animated/useAnimatedValue.js +1 -3
  10. package/Libraries/Blob/URLSearchParams.js.flow +23 -0
  11. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
  12. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
  13. package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js.flow +20 -0
  14. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +8 -8
  15. package/Libraries/Components/Button.js +2 -2
  16. package/Libraries/Components/Button.win32.js +2 -2
  17. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +14 -100
  18. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +64 -4
  19. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +138 -0
  20. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -4
  21. package/Libraries/Components/LayoutConformance/LayoutConformance.js +6 -4
  22. package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +1 -1
  23. package/Libraries/Components/Pressable/Pressable.js +18 -63
  24. package/Libraries/Components/Pressable/Pressable.win32.js +19 -65
  25. package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
  26. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +4 -46
  27. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +10 -4
  28. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +54 -0
  29. package/Libraries/Components/RefreshControl/RefreshControl.js +10 -7
  30. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +2 -1
  31. package/Libraries/Components/SafeAreaView/SafeAreaView.js +1 -1
  32. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +1 -1
  33. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +2 -4
  34. package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +2 -4
  35. package/Libraries/Components/ScrollView/ScrollView.js +43 -59
  36. package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
  37. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +2 -4
  38. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -7
  39. package/Libraries/Components/StatusBar/StatusBar.js +33 -22
  40. package/Libraries/Components/Switch/Switch.js +70 -41
  41. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -4
  42. package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +2 -4
  43. package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +2 -4
  44. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
  45. package/Libraries/Components/TextInput/TextInput.flow.js +10 -12
  46. package/Libraries/Components/TextInput/TextInput.js +22 -28
  47. package/Libraries/Components/TextInput/TextInput.win32.js +22 -28
  48. package/Libraries/Components/TextInput/TextInputState.js +2 -18
  49. package/Libraries/Components/TextInput/TextInputState.win32.js +2 -18
  50. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +1 -1
  51. package/Libraries/Components/Touchable/Touchable.js +7 -7
  52. package/Libraries/Components/Touchable/Touchable.win32.js +7 -7
  53. package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
  54. package/Libraries/Components/Touchable/TouchableHighlight.js +35 -14
  55. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +95 -47
  56. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +248 -43
  57. package/Libraries/Components/Touchable/TouchableOpacity.js +52 -10
  58. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +112 -59
  59. package/Libraries/Components/View/View.js +1 -1
  60. package/Libraries/Components/View/View.win32.js +1 -1
  61. package/Libraries/Components/View/ViewNativeComponent.js +2 -4
  62. package/Libraries/Components/View/ViewPropTypes.js +15 -12
  63. package/Libraries/Components/View/ViewPropTypes.win32.js +74 -71
  64. package/Libraries/Core/ReactNativeVersion.js +1 -1
  65. package/Libraries/Core/setUpReactDevTools.js +2 -0
  66. package/Libraries/Debugging/DebuggingOverlayRegistry.js +10 -7
  67. package/Libraries/Image/Image.android.js +1 -1
  68. package/Libraries/Image/Image.js.flow +27 -0
  69. package/Libraries/Image/ImageBackground.js +1 -1
  70. package/Libraries/Image/ImageProps.js +97 -30
  71. package/Libraries/Image/ImageTypes.flow.js +16 -6
  72. package/Libraries/Image/ImageViewNativeComponent.js +3 -5
  73. package/Libraries/Image/TextInlineImageNativeComponent.js +2 -4
  74. package/Libraries/Interaction/InteractionManager.js +9 -1
  75. package/Libraries/Interaction/PanResponder.js +11 -11
  76. package/Libraries/Interaction/TaskQueue.js +2 -2
  77. package/Libraries/Lists/FlatList.js +8 -7
  78. package/Libraries/LogBox/LogBox.js +1 -1
  79. package/Libraries/NativeComponent/BaseViewConfig.js.flow +14 -0
  80. package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
  81. package/Libraries/Network/RCTNetworking.js.flow +44 -0
  82. package/Libraries/Network/XMLHttpRequest_new.js +3 -0
  83. package/Libraries/Network/XMLHttpRequest_old.js +3 -0
  84. package/Libraries/Pressability/HoverState.js +1 -0
  85. package/Libraries/Pressability/HoverState.win32.js +1 -0
  86. package/Libraries/Pressability/Pressability.js +2 -2
  87. package/Libraries/Pressability/Pressability.win32.js +3 -3
  88. package/Libraries/ReactNative/FabricUIManager.js +5 -3
  89. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +7 -5
  90. package/Libraries/ReactNative/RendererImplementation.js +3 -5
  91. package/Libraries/ReactNative/requireNativeComponent.js +1 -1
  92. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +12 -0
  93. package/Libraries/Renderer/shims/ReactNativeTypes.js +39 -91
  94. package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +22 -0
  95. package/Libraries/Text/Text.d.ts +1 -1
  96. package/Libraries/Text/Text.js +3 -1
  97. package/Libraries/Text/Text.win32.js +3 -1
  98. package/Libraries/Text/TextNativeComponent.js +1 -1
  99. package/Libraries/Text/TextNativeComponent.win32.js +1 -1
  100. package/Libraries/Text/TextProps.js +124 -84
  101. package/Libraries/Text/TextProps.win32.js +124 -84
  102. package/Libraries/Types/CoreEventTypes.js +1 -1
  103. package/Libraries/Types/CoreEventTypes.win32.js +1 -1
  104. package/Libraries/Types/ReactDevToolsTypes.js +4 -8
  105. package/Libraries/Utilities/BackHandler.js.flow +25 -0
  106. package/Libraries/Utilities/DevSettings.js +14 -0
  107. package/Libraries/Utilities/Dimensions.js +5 -0
  108. package/Libraries/Utilities/Dimensions.win32.js +5 -0
  109. package/{flow/Position.js → Libraries/Utilities/Platform.js.flow} +3 -6
  110. package/Libraries/Utilities/PlatformTypes.js +97 -7
  111. package/Libraries/Utilities/codegenNativeComponent.js +1 -1
  112. package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +2 -4
  113. package/index.win32.js +3 -4
  114. package/overrides.json +24 -24
  115. package/package.json +15 -15
  116. package/src/private/components/HScrollViewNativeComponents.js +1 -1
  117. package/src/private/components/VScrollViewNativeComponents.js +1 -1
  118. package/src/private/featureflags/ReactNativeFeatureFlags.js +11 -6
  119. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +3 -2
  120. package/src/private/inspector/getInspectorDataForViewAtPoint.js +2 -4
  121. package/src/private/setup/setUpDOM.js +36 -1
  122. package/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js +1 -1
  123. package/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js +1 -1
  124. package/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -1
  125. package/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js +1 -1
  126. package/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js +1 -1
  127. package/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js +1 -1
  128. package/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js +1 -1
  129. package/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js +1 -1
  130. package/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js +1 -1
  131. package/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +1 -1
  132. package/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js +1 -1
  133. package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -1
  134. package/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js +1 -1
  135. package/src/private/types/HostComponent.js +16 -0
  136. package/src/private/types/HostInstance.js +50 -0
  137. package/src/private/webapis/dom/nodes/ReactNativeDocument.js +1 -0
  138. package/src/private/webapis/dom/nodes/ReactNativeElement.js +40 -32
  139. package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +1 -1
  140. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +1 -1
  141. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +1 -1
  142. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +4 -4
  143. package/src/private/webapis/mutationobserver/MutationObserver.js +9 -9
  144. package/src/private/webapis/performance/PerformanceObserver.js +6 -6
  145. package/src/types/globals.d.ts +628 -0
  146. package/src-win/Libraries/Text/Text.d.ts +1 -1
  147. package/types/index.d.ts +2 -53
  148. package/types/modules/globals.d.ts +0 -599
@@ -124,7 +124,7 @@ const currentCentroidY = TouchHistoryMath.currentCentroidY;
124
124
  * [PanResponder example in RNTester](https://github.com/facebook/react-native/blob/HEAD/packages/rn-tester/js/examples/PanResponder/PanResponderExample.js)
125
125
  */
126
126
 
127
- export type GestureState = {
127
+ export type PanResponderGestureState = {
128
128
  /**
129
129
  * ID of the gestureState - persisted as long as there at least one touch on screen
130
130
  */
@@ -185,15 +185,15 @@ export type GestureState = {
185
185
 
186
186
  type ActiveCallback = (
187
187
  event: GestureResponderEvent,
188
- gestureState: GestureState,
188
+ gestureState: PanResponderGestureState,
189
189
  ) => boolean;
190
190
 
191
191
  type PassiveCallback = (
192
192
  event: GestureResponderEvent,
193
- gestureState: GestureState,
193
+ gestureState: PanResponderGestureState,
194
194
  ) => mixed;
195
195
 
196
- export type PanHandlers = {
196
+ export type GestureResponderHandlers = {
197
197
  onMoveShouldSetResponder: (event: GestureResponderEvent) => boolean,
198
198
  onMoveShouldSetResponderCapture: (event: GestureResponderEvent) => boolean,
199
199
  onResponderEnd: (event: GestureResponderEvent) => void,
@@ -208,7 +208,7 @@ export type PanHandlers = {
208
208
  onStartShouldSetResponderCapture: (event: GestureResponderEvent) => boolean,
209
209
  };
210
210
 
211
- type PanResponderConfig = $ReadOnly<{
211
+ export type PanResponderCallbacks = $ReadOnly<{
212
212
  onMoveShouldSetPanResponder?: ?ActiveCallback,
213
213
  onMoveShouldSetPanResponderCapture?: ?ActiveCallback,
214
214
  onStartShouldSetPanResponder?: ?ActiveCallback,
@@ -293,7 +293,7 @@ const PanResponder = {
293
293
  * - vx/vy: Velocity.
294
294
  */
295
295
 
296
- _initializeGestureState(gestureState: GestureState) {
296
+ _initializeGestureState(gestureState: PanResponderGestureState) {
297
297
  gestureState.moveX = 0;
298
298
  gestureState.moveY = 0;
299
299
  gestureState.x0 = 0;
@@ -332,7 +332,7 @@ const PanResponder = {
332
332
  * avoids more dispatches than necessary.
333
333
  */
334
334
  _updateGestureStateOnMove(
335
- gestureState: GestureState,
335
+ gestureState: PanResponderGestureState,
336
336
  touchHistory: $PropertyType<GestureResponderEvent, 'touchHistory'>,
337
337
  ) {
338
338
  gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
@@ -401,14 +401,14 @@ const PanResponder = {
401
401
  * accordingly. (numberActiveTouches) may not be totally accurate unless you
402
402
  * are the responder.
403
403
  */
404
- create(config: PanResponderConfig): {
404
+ create(config: PanResponderCallbacks): {
405
405
  getInteractionHandle: () => ?number,
406
- panHandlers: PanHandlers,
406
+ panHandlers: GestureResponderHandlers,
407
407
  } {
408
408
  const interactionState = {
409
409
  handle: (null: ?number),
410
410
  };
411
- const gestureState: GestureState = {
411
+ const gestureState: PanResponderGestureState = {
412
412
  // Useful for debugging
413
413
  stateID: Math.random(),
414
414
  moveX: 0,
@@ -566,7 +566,7 @@ function clearInteractionHandle(
566
566
  interactionState: {handle: ?number, ...},
567
567
  callback: ?(ActiveCallback | PassiveCallback),
568
568
  event: GestureResponderEvent,
569
- gestureState: GestureState,
569
+ gestureState: PanResponderGestureState,
570
570
  ) {
571
571
  if (interactionState.handle) {
572
572
  InteractionManager.clearInteractionHandle(interactionState.handle);
@@ -13,11 +13,11 @@
13
13
  const infoLog = require('../Utilities/infoLog').default;
14
14
  const invariant = require('invariant');
15
15
 
16
- type SimpleTask = {
16
+ export type SimpleTask = {
17
17
  name: string,
18
18
  run: () => void,
19
19
  };
20
- type PromiseTask = {
20
+ export type PromiseTask = {
21
21
  name: string,
22
22
  gen: () => Promise<void>,
23
23
  };
@@ -176,17 +176,18 @@ function isArrayLike(data: mixed): boolean {
176
176
  return typeof Object(data).length === 'number';
177
177
  }
178
178
 
179
- type FlatListProps<ItemT> = {
179
+ type FlatListBaseProps<ItemT> = {
180
180
  ...RequiredProps<ItemT>,
181
181
  ...OptionalProps<ItemT>,
182
182
  };
183
183
 
184
184
  type VirtualizedListProps = React.ElementConfig<typeof VirtualizedList>;
185
185
 
186
- export type Props<ItemT> = {
186
+ export type FlatListProps<ItemT> = {
187
187
  ...$Diff<
188
188
  VirtualizedListProps,
189
189
  {
190
+ data: $PropertyType<VirtualizedListProps, 'data'>,
190
191
  getItem: $PropertyType<VirtualizedListProps, 'getItem'>,
191
192
  getItemCount: $PropertyType<VirtualizedListProps, 'getItemCount'>,
192
193
  getItemLayout: $PropertyType<VirtualizedListProps, 'getItemLayout'>,
@@ -195,7 +196,7 @@ export type Props<ItemT> = {
195
196
  ...
196
197
  },
197
198
  >,
198
- ...FlatListProps<ItemT>,
199
+ ...FlatListBaseProps<ItemT>,
199
200
  ...
200
201
  };
201
202
 
@@ -307,7 +308,7 @@ export type Props<ItemT> = {
307
308
  *
308
309
  * Also inherits [ScrollView Props](docs/scrollview.html#props), unless it is nested in another FlatList of same orientation.
309
310
  */
310
- class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
311
+ class FlatList<ItemT = any> extends React.PureComponent<FlatListProps<ItemT>> {
311
312
  /**
312
313
  * Scrolls to the end of the content. May be janky without `getItemLayout` prop.
313
314
  */
@@ -422,7 +423,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
422
423
  }
423
424
  }
424
425
 
425
- constructor(props: Props<ItemT>) {
426
+ constructor(props: FlatListProps<ItemT>) {
426
427
  super(props);
427
428
  this._checkProps(this.props);
428
429
  if (this.props.viewabilityConfigCallbackPairs) {
@@ -456,7 +457,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
456
457
  }
457
458
 
458
459
  // $FlowFixMe[missing-local-annot]
459
- componentDidUpdate(prevProps: Props<ItemT>) {
460
+ componentDidUpdate(prevProps: FlatListProps<ItemT>) {
460
461
  invariant(
461
462
  prevProps.numColumns === this.props.numColumns,
462
463
  'Changing numColumns on the fly is not supported. Change the key prop on FlatList when ' +
@@ -488,7 +489,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
488
489
  };
489
490
 
490
491
  // $FlowFixMe[missing-local-annot]
491
- _checkProps(props: Props<ItemT>) {
492
+ _checkProps(props: FlatListProps<ItemT>) {
492
493
  const {
493
494
  // $FlowFixMe[prop-missing] this prop doesn't exist, is only used for an invariant
494
495
  getItem,
@@ -206,7 +206,7 @@ if (__DEV__) {
206
206
  if (!hasComponentStack(args) && React.captureOwnerStack != null) {
207
207
  stack = React.captureOwnerStack();
208
208
  if (!hasComponentStack(args)) {
209
- if (stack !== '') {
209
+ if (stack != null && stack !== '') {
210
210
  args[0] = args[0] += '%s';
211
211
  args.push(stack);
212
212
  }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ * @flow strict-local
9
+ */
10
+
11
+ import type {PartialViewConfigWithoutName} from './PlatformBaseViewConfig';
12
+
13
+ declare const PlatformBaseViewConfig: PartialViewConfigWithoutName;
14
+ export default PlatformBaseViewConfig;
@@ -8,8 +8,8 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import type {HostComponent} from '../../src/private/types/HostComponent';
11
12
  import type {
12
- HostComponent,
13
13
  PartialViewConfig,
14
14
  ViewConfig,
15
15
  } from '../Renderer/shims/ReactNativeTypes';
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ import type {EventSubscription} from '../vendor/emitter/EventEmitter';
14
+ import type {RequestBody} from './convertRequestBody';
15
+ import type {RCTNetworkingEventDefinitions} from './RCTNetworkingEventDefinitions.flow';
16
+ import type {NativeResponseType} from './XMLHttpRequest';
17
+
18
+ declare const RCTNetworking: interface {
19
+ addListener<K: $Keys<RCTNetworkingEventDefinitions>>(
20
+ eventType: K,
21
+ // $FlowFixMe[invalid-computed-prop]
22
+ listener: (...$ElementType<RCTNetworkingEventDefinitions, K>) => mixed,
23
+ context?: mixed,
24
+ ): EventSubscription,
25
+
26
+ sendRequest(
27
+ method: string,
28
+ trackingName: ?string,
29
+ url: string,
30
+ headers: {...},
31
+ data: RequestBody,
32
+ responseType: NativeResponseType,
33
+ incrementalUpdates: boolean,
34
+ timeout: number,
35
+ callback: (requestId: number) => void,
36
+ withCredentials: boolean,
37
+ ): void,
38
+
39
+ abortRequest(requestId: number): void,
40
+
41
+ clearCookies(callback: (result: boolean) => void): void,
42
+ };
43
+
44
+ export default RCTNetworking;
@@ -14,6 +14,7 @@ import type {
14
14
  EventCallback,
15
15
  EventListener,
16
16
  } from '../../src/private/webapis/dom/events/EventTarget';
17
+ import type Performance from '../../src/private/webapis/performance/Performance';
17
18
  import type {IPerformanceLogger} from '../Utilities/createPerformanceLogger';
18
19
 
19
20
  import Event from '../../src/private/webapis/dom/events/Event';
@@ -33,6 +34,8 @@ const RCTNetworking = require('./RCTNetworking').default;
33
34
  const base64 = require('base64-js');
34
35
  const invariant = require('invariant');
35
36
 
37
+ declare var performance: Performance;
38
+
36
39
  const DEBUG_NETWORK_SEND_DELAY: false = false; // Set to a number of milliseconds when debugging
37
40
  const LABEL_FOR_MISSING_URL_FOR_PROFILING = 'Unknown URL';
38
41
 
@@ -10,6 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
+ import type Performance from '../../src/private/webapis/performance/Performance';
13
14
  import type {IPerformanceLogger} from '../Utilities/createPerformanceLogger';
14
15
 
15
16
  import {type EventSubscription} from '../vendor/emitter/EventEmitter';
@@ -22,6 +23,8 @@ const RCTNetworking = require('./RCTNetworking').default;
22
23
  const base64 = require('base64-js');
23
24
  const invariant = require('invariant');
24
25
 
26
+ declare var performance: Performance;
27
+
25
28
  const DEBUG_NETWORK_SEND_DELAY: false = false; // Set to a number of milliseconds when debugging
26
29
  const LABEL_FOR_MISSING_URL_FOR_PROFILING = 'Unknown URL';
27
30
 
@@ -18,6 +18,7 @@ if (Platform.OS === 'web') {
18
18
  const canUseDOM = Boolean(
19
19
  typeof window !== 'undefined' &&
20
20
  window.document &&
21
+ // $FlowFixMe[method-unbinding]
21
22
  window.document.createElement,
22
23
  );
23
24
 
@@ -18,6 +18,7 @@ if (Platform.OS === 'web') {
18
18
  const canUseDOM = Boolean(
19
19
  typeof window !== 'undefined' &&
20
20
  window.document &&
21
+ // $FlowFixMe[method-unbinding]
21
22
  window.document.createElement,
22
23
  );
23
24
 
@@ -8,12 +8,12 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type {HostInstance} from '../Renderer/shims/ReactNativeTypes';
11
+ import type {HostInstance} from '../../src/private/types/HostInstance';
12
12
  import type {
13
13
  BlurEvent,
14
14
  FocusEvent,
15
- MouseEvent,
16
15
  GestureResponderEvent,
16
+ MouseEvent,
17
17
  } from '../Types/CoreEventTypes';
18
18
 
19
19
  import SoundManager from '../Components/Sound/SoundManager';
@@ -8,13 +8,13 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type {HostInstance} from '../Renderer/shims/ReactNativeTypes';
11
+ import type {HostInstance} from '../../src/private/types/HostInstance';
12
12
  import type {
13
13
  BlurEvent,
14
14
  FocusEvent,
15
- KeyEvent,
16
- MouseEvent,
15
+ KeyEvent, // [Windows]
17
16
  GestureResponderEvent,
17
+ MouseEvent,
18
18
  } from '../Types/CoreEventTypes';
19
19
 
20
20
  import SoundManager from '../Components/Sound/SoundManager';
@@ -10,13 +10,15 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import type {NativeElementReference} from '../../src/private/webapis/dom/nodes/specs/NativeDOM';
14
13
  import type {
15
- InternalInstanceHandle,
16
- LayoutAnimationConfig,
17
14
  MeasureInWindowOnSuccessCallback,
18
15
  MeasureLayoutOnSuccessCallback,
19
16
  MeasureOnSuccessCallback,
17
+ } from '../../src/private/types/HostInstance';
18
+ import type {NativeElementReference} from '../../src/private/webapis/dom/nodes/specs/NativeDOM';
19
+ import type {
20
+ InternalInstanceHandle,
21
+ LayoutAnimationConfig,
20
22
  Node,
21
23
  } from '../Renderer/shims/ReactNativeTypes';
22
24
  import type {RootTag} from '../Types/RootTagTypes';
@@ -10,11 +10,13 @@
10
10
 
11
11
  import type {
12
12
  HostInstance,
13
- INativeMethods,
14
- InternalInstanceHandle,
13
+ LegacyHostInstanceMethods,
15
14
  MeasureInWindowOnSuccessCallback,
16
15
  MeasureLayoutOnSuccessCallback,
17
16
  MeasureOnSuccessCallback,
17
+ } from '../../../src/private/types/HostInstance';
18
+ import type {
19
+ InternalInstanceHandle,
18
20
  ViewConfig,
19
21
  } from '../../Renderer/shims/ReactNativeTypes';
20
22
 
@@ -38,7 +40,9 @@ const noop = () => {};
38
40
  /**
39
41
  * This is used for refs on host components.
40
42
  */
41
- export default class ReactFabricHostComponent implements INativeMethods {
43
+ export default class ReactFabricHostComponent
44
+ implements LegacyHostInstanceMethods
45
+ {
42
46
  // These need to be accessible from `ReactFabricPublicInstanceUtils`.
43
47
  __nativeTag: number;
44
48
  __internalInstanceHandle: InternalInstanceHandle;
@@ -56,12 +60,10 @@ export default class ReactFabricHostComponent implements INativeMethods {
56
60
  }
57
61
 
58
62
  blur() {
59
- // $FlowFixMe[incompatible-exact] Migrate all usages of `NativeMethods` to an interface to fix this.
60
63
  TextInputState.blurTextInput(this);
61
64
  }
62
65
 
63
66
  focus() {
64
- // $FlowFixMe[incompatible-exact] Migrate all usages of `NativeMethods` to an interface to fix this.
65
67
  TextInputState.focusTextInput(this);
66
68
  }
67
69
 
@@ -8,13 +8,11 @@
8
8
  * @flow strict-local
9
9
  */
10
10
 
11
+ import type {HostInstance} from '../../src/private/types/HostInstance';
11
12
  import type {
12
- HostComponent,
13
- HostInstance,
14
13
  InternalInstanceHandle,
15
14
  Node,
16
15
  } from '../Renderer/shims/ReactNativeTypes';
17
- import type ReactFabricHostComponent from './ReactFabricPublicInstance/ReactFabricHostComponent';
18
16
  import type {ElementRef, ElementType} from 'react';
19
17
 
20
18
  import {
@@ -136,8 +134,8 @@ export function isProfilingRenderer(): boolean {
136
134
  }
137
135
 
138
136
  export function isChildPublicInstance(
139
- parentInstance: ReactFabricHostComponent | HostComponent<empty>,
140
- childInstance: ReactFabricHostComponent | HostComponent<empty>,
137
+ parentInstance: HostInstance,
138
+ childInstance: HostInstance,
141
139
  ): boolean {
142
140
  return require('../Renderer/shims/ReactNative').default.isChildPublicInstance(
143
141
  parentInstance,
@@ -10,7 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
13
+ import type {HostComponent} from '../../src/private/types/HostComponent';
14
14
 
15
15
  const createReactNativeComponentClass =
16
16
  require('../Renderer/shims/createReactNativeComponentClass').default;
@@ -36,7 +36,19 @@ import typeof deepFreezeAndThrowOnMutationInDev from '../Utilities/deepFreezeAnd
36
36
  import typeof deepDiffer from '../Utilities/differ/deepDiffer';
37
37
  import typeof Platform from '../Utilities/Platform';
38
38
 
39
+ // Expose these types to the React renderer
40
+ export type {
41
+ HostInstance as PublicInstance,
42
+
43
+ // These types are only necessary for Paper
44
+ LegacyHostInstanceMethods as LegacyPublicInstance,
45
+ MeasureOnSuccessCallback,
46
+ MeasureInWindowOnSuccessCallback,
47
+ MeasureLayoutOnSuccessCallback,
48
+ } from '../../src/private/types/HostInstance';
49
+
39
50
  export type {PublicRootInstance} from '../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
51
+ export type PublicTextInstance = ReturnType<createPublicTextInstance>;
40
52
 
41
53
  // flowlint unsafe-getters-setters:off
42
54
  module.exports = {
@@ -7,35 +7,25 @@
7
7
  * @noformat
8
8
  * @nolint
9
9
  * @flow strict
10
- * @generated SignedSource<<c1ce40ef01008fe3cd38df1d9ff46f56>>
10
+ * @generated SignedSource<<5c76b092e0c981f96ca894e381ee593b>>
11
11
  */
12
12
 
13
- import type {ElementRef, ElementType, MixedElement} from 'react';
14
- // $FlowFixMe[nonstrict-import] TODO(@rubennorte)
15
- import {type PublicRootInstance} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
16
-
17
- export type MeasureOnSuccessCallback = (
18
- x: number,
19
- y: number,
20
- width: number,
21
- height: number,
22
- pageX: number,
23
- pageY: number,
24
- ) => void;
25
-
26
- export type MeasureInWindowOnSuccessCallback = (
27
- x: number,
28
- y: number,
29
- width: number,
30
- height: number,
31
- ) => void;
32
-
33
- export type MeasureLayoutOnSuccessCallback = (
34
- left: number,
35
- top: number,
36
- width: number,
37
- height: number,
38
- ) => void;
13
+ import type {
14
+ Component as ReactComponent,
15
+ ElementRef,
16
+ ElementType,
17
+ MixedElement,
18
+ } from 'react';
19
+ import type {
20
+ // $FlowFixMe[nonstrict-import] TODO(@rubennorte)
21
+ MeasureOnSuccessCallback,
22
+ // $FlowFixMe[nonstrict-import] TODO(@rubennorte)
23
+ PublicInstance,
24
+ // $FlowFixMe[nonstrict-import] TODO(@rubennorte)
25
+ PublicRootInstance,
26
+ // $FlowFixMe[nonstrict-import] TODO(@rubennorte)
27
+ PublicTextInstance,
28
+ } from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
39
29
 
40
30
  export type AttributeType<T, V> =
41
31
  | true
@@ -101,45 +91,6 @@ export type PartialViewConfig = $ReadOnly<{
101
91
  validAttributes?: PartialAttributeConfiguration,
102
92
  }>;
103
93
 
104
- /**
105
- * Current usages should migrate to this definition
106
- */
107
- export interface INativeMethods {
108
- blur(): void;
109
- focus(): void;
110
- measure(callback: MeasureOnSuccessCallback): void;
111
- measureInWindow(callback: MeasureInWindowOnSuccessCallback): void;
112
- measureLayout(
113
- relativeToNativeNode: number | HostInstance,
114
- onSuccess: MeasureLayoutOnSuccessCallback,
115
- onFail?: () => void,
116
- ): void;
117
- setNativeProps(nativeProps: {...}): void;
118
- }
119
-
120
- export type NativeMethods = $ReadOnly<{
121
- blur(): void,
122
- focus(): void,
123
- measure(callback: MeasureOnSuccessCallback): void,
124
- measureInWindow(callback: MeasureInWindowOnSuccessCallback): void,
125
- measureLayout(
126
- relativeToNativeNode: number | HostInstance,
127
- onSuccess: MeasureLayoutOnSuccessCallback,
128
- onFail?: () => void,
129
- ): void,
130
- setNativeProps(nativeProps: {...}): void,
131
- }>;
132
-
133
- // This validates that INativeMethods and NativeMethods stay in sync using Flow!
134
- declare const ensureNativeMethodsAreSynced: NativeMethods;
135
- (ensureNativeMethodsAreSynced: INativeMethods);
136
-
137
- export type HostInstance = NativeMethods;
138
- export type HostComponent<Config: {...}> = component(
139
- ref: React$RefSetter<HostInstance>,
140
- ...Config
141
- );
142
-
143
94
  type InspectorDataProps = $ReadOnly<{
144
95
  [propName: string]: string,
145
96
  ...
@@ -165,18 +116,19 @@ export type InspectorData = $ReadOnly<{
165
116
  componentStack: string,
166
117
  }>;
167
118
 
168
- export type TouchedViewDataAtPoint = $ReadOnly<{
169
- pointerY: number,
170
- touchedViewTag?: number,
171
- frame: $ReadOnly<{
172
- top: number,
173
- left: number,
174
- width: number,
175
- height: number,
176
- }>,
177
- closestPublicInstance?: PublicInstance,
178
- ...InspectorData,
179
- }>;
119
+ export type TouchedViewDataAtPoint = $ReadOnly<
120
+ {
121
+ pointerY: number,
122
+ touchedViewTag?: number,
123
+ frame: $ReadOnly<{
124
+ top: number,
125
+ left: number,
126
+ width: number,
127
+ height: number,
128
+ }>,
129
+ closestPublicInstance?: PublicInstance,
130
+ } & InspectorData,
131
+ >;
180
132
 
181
133
  export type RenderRootOptions = {
182
134
  onUncaughtError?: (
@@ -188,7 +140,8 @@ export type RenderRootOptions = {
188
140
  errorInfo: {
189
141
  +componentStack?: ?string,
190
142
  // $FlowFixMe[unclear-type] unknown props and state.
191
- +errorBoundary?: ?React$Component<any, any>,
143
+ // $FlowFixMe[value-as-type] Component in react repo is any-typed, but it will be well typed externally.
144
+ +errorBoundary?: ?ReactComponent<any, any>,
192
145
  },
193
146
  ) => void,
194
147
  onRecoverableError?: (
@@ -204,20 +157,17 @@ export type RenderRootOptions = {
204
157
  export type ReactNativeType = {
205
158
  findHostInstance_DEPRECATED<TElementType: ElementType>(
206
159
  componentOrHandle: ?(ElementRef<TElementType> | number),
207
- ): ?HostInstance,
160
+ ): ?PublicInstance,
208
161
  findNodeHandle<TElementType: ElementType>(
209
162
  componentOrHandle: ?(ElementRef<TElementType> | number),
210
163
  ): ?number,
211
- isChildPublicInstance(
212
- parent: PublicInstance | HostComponent<empty>,
213
- child: PublicInstance | HostComponent<empty>,
214
- ): boolean,
164
+ isChildPublicInstance(parent: PublicInstance, child: PublicInstance): boolean,
215
165
  dispatchCommand(
216
- handle: HostInstance,
166
+ handle: PublicInstance,
217
167
  command: string,
218
168
  args: Array<mixed>,
219
169
  ): void,
220
- sendAccessibilityEvent(handle: HostInstance, eventType: string): void,
170
+ sendAccessibilityEvent(handle: PublicInstance, eventType: string): void,
221
171
  render(
222
172
  element: MixedElement,
223
173
  containerTag: number,
@@ -232,23 +182,21 @@ export type ReactNativeType = {
232
182
 
233
183
  export opaque type Node = mixed;
234
184
  export opaque type InternalInstanceHandle = mixed;
235
- type PublicInstance = mixed;
236
- type PublicTextInstance = mixed;
237
185
 
238
186
  export type ReactFabricType = {
239
187
  findHostInstance_DEPRECATED<TElementType: ElementType>(
240
188
  componentOrHandle: ?(ElementRef<TElementType> | number),
241
- ): ?HostInstance,
189
+ ): ?PublicInstance,
242
190
  findNodeHandle<TElementType: ElementType>(
243
191
  componentOrHandle: ?(ElementRef<TElementType> | number),
244
192
  ): ?number,
245
193
  dispatchCommand(
246
- handle: HostInstance,
194
+ handle: PublicInstance,
247
195
  command: string,
248
196
  args: Array<mixed>,
249
197
  ): void,
250
198
  isChildPublicInstance(parent: PublicInstance, child: PublicInstance): boolean,
251
- sendAccessibilityEvent(handle: HostInstance, eventType: string): void,
199
+ sendAccessibilityEvent(handle: PublicInstance, eventType: string): void,
252
200
  render(
253
201
  element: MixedElement,
254
202
  containerTag: number,
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ * @flow strict-local
9
+ */
10
+
11
+ import type {ProcessedColorValue} from './processColor';
12
+ import type {ColorValue, NativeColorValue} from './StyleSheet';
13
+
14
+ declare export function PlatformColor(...names: Array<string>): ColorValue;
15
+
16
+ declare export function normalizeColorObject(
17
+ color: NativeColorValue,
18
+ ): ?ProcessedColorValue;
19
+
20
+ declare export function processColorObject(
21
+ color: NativeColorValue,
22
+ ): ?NativeColorValue;
@@ -263,7 +263,7 @@ export interface TextProps
263
263
 
264
264
  /**
265
265
  * This function is called on long press.
266
- * e.g., `onLongPress={this.increaseSize}>``
266
+ * e.g., `onLongPress={this.increaseSize}>`
267
267
  */
268
268
  onLongPress?: ((event: GestureResponderEvent) => void) | undefined;
269
269