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

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 (192) hide show
  1. package/.flowconfig +6 -2
  2. package/CHANGELOG.json +63 -1
  3. package/CHANGELOG.md +24 -4
  4. package/Libraries/Alert/Alert.d.ts +4 -1
  5. package/Libraries/Alert/Alert.js +3 -0
  6. package/Libraries/{Modal/ModalInjection.js → Alert/RCTAlertManager.js.flow} +7 -4
  7. package/Libraries/Animated/Animated.js +8 -37
  8. package/Libraries/Animated/Animated.js.flow +15 -0
  9. package/Libraries/Animated/AnimatedExports.js +47 -0
  10. package/Libraries/Animated/AnimatedExports.js.flow +48 -0
  11. package/Libraries/Animated/Easing.js +13 -15
  12. package/Libraries/Animated/createAnimatedComponent.js +24 -12
  13. package/Libraries/Animated/nodes/AnimatedNode.js +2 -1
  14. package/Libraries/Animated/nodes/AnimatedProps.js +18 -1
  15. package/Libraries/Animated/nodes/AnimatedValue.js +6 -2
  16. package/Libraries/Animated/useAnimatedValue.js +1 -3
  17. package/Libraries/Blob/URL.js +23 -10
  18. package/Libraries/Blob/URLSearchParams.js.flow +23 -0
  19. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
  20. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
  21. package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js.flow +20 -0
  22. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +8 -8
  23. package/Libraries/Components/Button.js +2 -2
  24. package/Libraries/Components/Button.win32.js +2 -2
  25. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +14 -100
  26. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +64 -4
  27. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +138 -0
  28. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -4
  29. package/Libraries/Components/LayoutConformance/LayoutConformance.js +6 -4
  30. package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +1 -1
  31. package/Libraries/Components/Pressable/Pressable.js +18 -63
  32. package/Libraries/Components/Pressable/Pressable.win32.js +19 -65
  33. package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
  34. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +4 -46
  35. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +10 -4
  36. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +54 -0
  37. package/Libraries/Components/RefreshControl/RefreshControl.js +10 -7
  38. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +2 -1
  39. package/Libraries/Components/SafeAreaView/SafeAreaView.js +1 -1
  40. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +1 -1
  41. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +2 -4
  42. package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +2 -4
  43. package/Libraries/Components/ScrollView/ScrollView.js +43 -59
  44. package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
  45. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +2 -4
  46. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -7
  47. package/Libraries/Components/StatusBar/StatusBar.js +33 -22
  48. package/Libraries/Components/Switch/Switch.js +70 -41
  49. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -4
  50. package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +2 -4
  51. package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +2 -4
  52. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
  53. package/Libraries/Components/TextInput/Tests/TextInputTest.d.ts +2 -1
  54. package/Libraries/Components/TextInput/Tests/TextInputTest.js.map +1 -1
  55. package/Libraries/Components/TextInput/TextInput.d.ts +6 -0
  56. package/Libraries/Components/TextInput/TextInput.flow.js +45 -14
  57. package/Libraries/Components/TextInput/TextInput.js +121 -136
  58. package/Libraries/Components/TextInput/TextInput.win32.js +122 -137
  59. package/Libraries/Components/TextInput/TextInputState.js +2 -18
  60. package/Libraries/Components/TextInput/TextInputState.win32.js +2 -18
  61. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +1 -1
  62. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.d.ts +2 -1
  63. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
  64. package/Libraries/Components/Touchable/Touchable.js +7 -7
  65. package/Libraries/Components/Touchable/Touchable.win32.js +7 -7
  66. package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
  67. package/Libraries/Components/Touchable/TouchableHighlight.js +35 -14
  68. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +95 -47
  69. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +248 -43
  70. package/Libraries/Components/Touchable/TouchableOpacity.js +52 -10
  71. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +112 -59
  72. package/Libraries/Components/View/View.js +1 -1
  73. package/Libraries/Components/View/View.win32.js +1 -1
  74. package/Libraries/Components/View/ViewNativeComponent.js +2 -4
  75. package/Libraries/Components/View/ViewPropTypes.js +15 -12
  76. package/Libraries/Components/View/ViewPropTypes.win32.js +74 -71
  77. package/Libraries/Core/ReactNativeVersion.js +2 -2
  78. package/Libraries/Core/setUpReactDevTools.js +2 -0
  79. package/Libraries/Debugging/DebuggingOverlayRegistry.js +10 -7
  80. package/Libraries/Image/Image.android.js +1 -1
  81. package/Libraries/Image/Image.js.flow +27 -0
  82. package/Libraries/Image/ImageBackground.js +1 -1
  83. package/Libraries/Image/ImageProps.js +97 -30
  84. package/Libraries/Image/ImageTypes.flow.js +16 -6
  85. package/Libraries/Image/ImageViewNativeComponent.js +3 -5
  86. package/Libraries/Image/Tests/ImageWin32Test.d.ts +2 -1
  87. package/Libraries/Image/Tests/ImageWin32Test.js.map +1 -1
  88. package/Libraries/Image/TextInlineImageNativeComponent.js +2 -4
  89. package/Libraries/Interaction/InteractionManager.js +9 -1
  90. package/Libraries/Interaction/PanResponder.js +11 -11
  91. package/Libraries/Interaction/TaskQueue.js +3 -2
  92. package/Libraries/Lists/FlatList.js +8 -7
  93. package/Libraries/LogBox/LogBox.js +1 -1
  94. package/Libraries/Modal/Modal.js +30 -4
  95. package/Libraries/NativeComponent/BaseViewConfig.js.flow +14 -0
  96. package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
  97. package/Libraries/Network/RCTNetworking.js.flow +44 -0
  98. package/Libraries/Network/XMLHttpRequest_new.js +3 -0
  99. package/Libraries/Network/XMLHttpRequest_old.js +3 -0
  100. package/Libraries/Pressability/HoverState.js +1 -0
  101. package/Libraries/Pressability/HoverState.win32.js +1 -0
  102. package/Libraries/Pressability/Pressability.js +2 -2
  103. package/Libraries/Pressability/Pressability.win32.js +3 -3
  104. package/Libraries/ReactNative/AppRegistry.flow.js +49 -0
  105. package/Libraries/ReactNative/AppRegistry.js +2 -322
  106. package/Libraries/ReactNative/AppRegistry.js.flow +23 -0
  107. package/Libraries/ReactNative/AppRegistryImpl.js +316 -0
  108. package/Libraries/ReactNative/FabricUIManager.js +5 -3
  109. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +7 -5
  110. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -4
  111. package/Libraries/ReactNative/RendererImplementation.js +3 -5
  112. package/Libraries/ReactNative/requireNativeComponent.js +1 -1
  113. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +12 -0
  114. package/Libraries/Renderer/shims/ReactNativeTypes.js +39 -91
  115. package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +22 -0
  116. package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +6 -0
  117. package/Libraries/StyleSheet/StyleSheet.js +5 -197
  118. package/Libraries/StyleSheet/StyleSheet.js.flow +166 -0
  119. package/Libraries/StyleSheet/{StyleSheet.win32.js → StyleSheetExports.js} +2 -151
  120. package/Libraries/StyleSheet/StyleSheetExports.js.flow +110 -0
  121. package/Libraries/StyleSheet/StyleSheetTypes.js +42 -18
  122. package/Libraries/Text/Text.d.ts +1 -1
  123. package/Libraries/Text/Text.js +3 -1
  124. package/Libraries/Text/Text.win32.js +3 -1
  125. package/Libraries/Text/TextNativeComponent.js +1 -1
  126. package/Libraries/Text/TextNativeComponent.win32.js +1 -1
  127. package/Libraries/Text/TextProps.js +124 -84
  128. package/Libraries/Text/TextProps.win32.js +124 -84
  129. package/Libraries/Types/CodegenTypesNamespace.d.ts +45 -0
  130. package/Libraries/Types/CodegenTypesNamespace.js +14 -0
  131. package/Libraries/Types/CoreEventTypes.js +1 -1
  132. package/Libraries/Types/CoreEventTypes.win32.js +1 -1
  133. package/Libraries/Types/ReactDevToolsTypes.js +4 -8
  134. package/Libraries/Utilities/BackHandler.js.flow +25 -0
  135. package/Libraries/Utilities/DevSettings.js +14 -0
  136. package/Libraries/Utilities/Dimensions.js +5 -0
  137. package/Libraries/Utilities/Dimensions.win32.js +5 -0
  138. package/{flow/Position.js → Libraries/Utilities/Platform.js.flow} +3 -6
  139. package/Libraries/Utilities/PlatformTypes.js +97 -7
  140. package/Libraries/Utilities/codegenNativeCommands.d.ts +18 -0
  141. package/Libraries/Utilities/codegenNativeComponent.d.ts +26 -0
  142. package/Libraries/Utilities/codegenNativeComponent.js +1 -1
  143. package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +2 -4
  144. package/Libraries/vendor/emitter/EventEmitter.js +6 -2
  145. package/flow/global.js +1 -0
  146. package/flow/jest.js +4 -2
  147. package/index.js +47 -43
  148. package/index.win32.js +63 -59
  149. package/overrides.json +27 -35
  150. package/package.json +18 -18
  151. package/src/private/animated/NativeAnimatedHelper.js +18 -7
  152. package/src/private/animated/NativeAnimatedHelper.win32.js +18 -7
  153. package/src/private/animated/createAnimatedPropsHook.js +34 -15
  154. package/src/private/components/HScrollViewNativeComponents.js +1 -1
  155. package/src/private/components/VScrollViewNativeComponents.js +1 -1
  156. package/src/private/featureflags/ReactNativeFeatureFlags.js +24 -36
  157. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +9 -1
  158. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +4 -4
  159. package/src/private/inspector/getInspectorDataForViewAtPoint.js +2 -4
  160. package/src/private/setup/setUpDOM.js +36 -1
  161. package/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js +1 -1
  162. package/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js +1 -1
  163. package/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -1
  164. package/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js +1 -1
  165. package/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js +1 -1
  166. package/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js +1 -1
  167. package/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js +1 -1
  168. package/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js +1 -1
  169. package/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js +1 -1
  170. package/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +1 -1
  171. package/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js +1 -1
  172. package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -1
  173. package/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js +1 -1
  174. package/src/private/types/HostComponent.js +16 -0
  175. package/src/private/types/HostInstance.js +50 -0
  176. package/src/private/webapis/dom/nodes/ReactNativeDocument.js +1 -0
  177. package/src/private/webapis/dom/nodes/ReactNativeElement.js +40 -32
  178. package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +1 -1
  179. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +1 -1
  180. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +6 -19
  181. package/src/private/webapis/dom/nodes/internals/NodeInternals.js +6 -0
  182. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +4 -4
  183. package/src/private/webapis/mutationobserver/MutationObserver.js +9 -9
  184. package/src/private/webapis/performance/PerformanceObserver.js +6 -6
  185. package/src/types/globals.d.ts +628 -0
  186. package/src/types/third_party/event-target-shim.d.ts +392 -0
  187. package/src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx +7 -7
  188. package/src-win/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +3 -3
  189. package/src-win/Libraries/Image/Tests/ImageWin32Test.tsx +1 -1
  190. package/src-win/Libraries/Text/Text.d.ts +1 -1
  191. package/types/index.d.ts +5 -52
  192. 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
  };
@@ -117,6 +117,7 @@ class TaskQueue {
117
117
  } catch (e) {
118
118
  e.message =
119
119
  // $FlowFixMe[incompatible-type]
120
+ // $FlowFixMe[incompatible-use]
120
121
  'TaskQueue: Error with task ' + (task.name || '') + ': ' + e.message;
121
122
  throw e;
122
123
  }
@@ -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
  }
@@ -8,6 +8,7 @@
8
8
  * @flow strict-local
9
9
  */
10
10
 
11
+ import type {HostInstance} from '../../src/private/types/HostInstance';
11
12
  import type {ViewProps} from '../Components/View/ViewPropTypes';
12
13
  import type {RootTag} from '../ReactNative/RootTag';
13
14
  import type {DirectEventHandler} from '../Types/CodegenTypes';
@@ -15,7 +16,6 @@ import type {DirectEventHandler} from '../Types/CodegenTypes';
15
16
  import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
16
17
  import {type ColorValue} from '../StyleSheet/StyleSheet';
17
18
  import {type EventSubscription} from '../vendor/emitter/EventEmitter';
18
- import ModalInjection from './ModalInjection';
19
19
  import NativeModalManager from './NativeModalManager';
20
20
  import RCTModalHostView from './RCTModalHostViewNativeComponent';
21
21
  import VirtualizedLists from '@react-native/virtualized-lists';
@@ -36,6 +36,8 @@ type ModalEventDefinitions = {
36
36
  modalDismissed: [{modalID: number}],
37
37
  };
38
38
 
39
+ export type PublicModalInstance = HostInstance;
40
+
39
41
  const ModalEventEmitter =
40
42
  Platform.OS === 'ios' && NativeModalManager != null
41
43
  ? new NativeEventEmitter<ModalEventDefinitions>(
@@ -101,6 +103,11 @@ export type ModalBaseProps = {
101
103
  * Defaults to `white` if not provided and transparent is `false`. Ignored if `transparent` is `true`.
102
104
  */
103
105
  backdropColor?: ColorValue,
106
+
107
+ /**
108
+ * A ref to the native Modal component.
109
+ */
110
+ modalRef?: React.RefSetter<PublicModalInstance>,
104
111
  };
105
112
 
106
113
  export type ModalPropsIOS = {
@@ -308,6 +315,7 @@ class Modal extends React.Component<ModalProps, State> {
308
315
  onRequestClose={this.props.onRequestClose}
309
316
  onShow={this.props.onShow}
310
317
  onDismiss={onDismiss}
318
+ ref={this.props.modalRef}
311
319
  visible={this.props.visible}
312
320
  statusBarTranslucent={this.props.statusBarTranslucent}
313
321
  navigationBarTranslucent={this.props.navigationBarTranslucent}
@@ -354,7 +362,25 @@ const styles = StyleSheet.create({
354
362
  },
355
363
  });
356
364
 
357
- const ExportedModal: React.ComponentType<React.ElementConfig<typeof Modal>> =
358
- ModalInjection.unstable_Modal ?? Modal;
365
+ type ModalRefProps = $ReadOnly<{
366
+ ref?: React.RefSetter<PublicModalInstance>,
367
+ }>;
368
+
369
+ // NOTE: This wrapper component is necessary because `Modal` is a class
370
+ // component and we need to map `ref` to a differently named prop. This can be
371
+ // removed when `Modal` is a functional component.
372
+ function Wrapper({
373
+ ref,
374
+ ...props
375
+ }: {
376
+ ...ModalRefProps,
377
+ ...ModalProps,
378
+ }): React.Node {
379
+ return <Modal {...props} modalRef={ref} />;
380
+ }
381
+
382
+ Wrapper.displayName = 'Modal';
383
+ // $FlowExpectedError[prop-missing]
384
+ Wrapper.Context = VirtualizedListContextResetter;
359
385
 
360
- export default ExportedModal;
386
+ export default Wrapper;
@@ -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';
@@ -0,0 +1,49 @@
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
8
+ * @format
9
+ */
10
+
11
+ import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
12
+ import type {RootTag} from '../Types/RootTagTypes';
13
+ import type {IPerformanceLogger} from '../Utilities/createPerformanceLogger';
14
+ import type {DisplayModeType} from './DisplayMode';
15
+
16
+ type Task = (taskData: any) => Promise<void>;
17
+ export type TaskProvider = () => Task;
18
+
19
+ export type ComponentProvider = () => React.ComponentType<any>;
20
+ export type ComponentProviderInstrumentationHook = (
21
+ component_: ComponentProvider,
22
+ scopedPerformanceLogger: IPerformanceLogger,
23
+ ) => React.ComponentType<any>;
24
+ export type AppConfig = {
25
+ appKey: string,
26
+ component?: ComponentProvider,
27
+ run?: Runnable,
28
+ section?: boolean,
29
+ ...
30
+ };
31
+ export type AppParameters = {
32
+ initialProps: $ReadOnly<{[string]: mixed, ...}>,
33
+ rootTag: RootTag,
34
+ fabric?: boolean,
35
+ };
36
+ export type Runnable = (
37
+ appParameters: AppParameters,
38
+ displayMode: DisplayModeType,
39
+ ) => void;
40
+ export type Runnables = {[appKey: string]: Runnable};
41
+ export type Registry = {
42
+ sections: $ReadOnlyArray<string>,
43
+ runnables: Runnables,
44
+ ...
45
+ };
46
+ export type WrapperComponentProvider = (
47
+ appParameters: Object,
48
+ ) => React.ComponentType<any>;
49
+ export type RootViewStyleProvider = (appParameters: Object) => ViewStyleProp;