@office-iss/react-native-win32 0.0.0-canary.285 → 0.0.0-canary.286

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/.flowconfig +1 -1
  2. package/CHANGELOG.json +16 -1
  3. package/CHANGELOG.md +16 -8
  4. package/IntegrationTests/LayoutEventsTest.js +16 -11
  5. package/Libraries/Alert/Alert.js +51 -5
  6. package/Libraries/Alert/Alert.win32.js +50 -5
  7. package/Libraries/Animated/animations/Animation.js +1 -4
  8. package/Libraries/Animated/nodes/AnimatedObject.js +1 -0
  9. package/Libraries/AppState/AppState.js +24 -7
  10. package/Libraries/BatchedBridge/MessageQueue.js +3 -2
  11. package/Libraries/BatchedBridge/NativeModules.js +2 -1
  12. package/Libraries/Blob/Blob.js +1 -1
  13. package/Libraries/Blob/FileReader_old.js +9 -9
  14. package/Libraries/Blob/URL.js +1 -1
  15. package/Libraries/Blob/URLSearchParams.js +9 -9
  16. package/Libraries/Components/Button.js +3 -3
  17. package/Libraries/Components/Button.win32.js +3 -6
  18. package/Libraries/Components/LayoutConformance/LayoutConformance.js +1 -1
  19. package/Libraries/Components/Pressable/Pressable.js +9 -9
  20. package/Libraries/Components/Pressable/Pressable.win32.js +9 -9
  21. package/Libraries/Components/Pressable/useAndroidRippleForView.js +7 -7
  22. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +7 -1
  23. package/Libraries/Components/RefreshControl/RefreshControl.js +1 -1
  24. package/Libraries/Components/ScrollView/ScrollView.js +74 -59
  25. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +5 -5
  26. package/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +5 -2
  27. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +3 -3
  28. package/Libraries/Components/Switch/Switch.js +2 -2
  29. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +3 -1
  30. package/Libraries/Components/TextInput/TextInput.flow.js +15 -13
  31. package/Libraries/Components/TextInput/TextInput.js +16 -14
  32. package/Libraries/Components/TextInput/TextInput.win32.js +16 -14
  33. package/Libraries/Components/TextInput/TextInputState.js +1 -1
  34. package/Libraries/Components/TextInput/TextInputState.win32.js +1 -1
  35. package/Libraries/Components/Touchable/Touchable.js +16 -16
  36. package/Libraries/Components/Touchable/Touchable.win32.js +16 -16
  37. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -2
  38. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +7 -7
  39. package/Libraries/Components/View/ReactNativeStyleAttributes.js +16 -2
  40. package/Libraries/Components/View/ViewAccessibility.js +243 -3
  41. package/Libraries/Components/View/ViewAccessibility.win32.js +243 -3
  42. package/Libraries/Components/View/ViewPropTypes.d.ts +14 -14
  43. package/Libraries/Components/View/ViewPropTypes.js +35 -226
  44. package/Libraries/Components/View/ViewPropTypes.win32.js +37 -229
  45. package/Libraries/Core/Devtools/symbolicateStackTrace.js +1 -1
  46. package/Libraries/Core/InitializeCore.js +2 -1
  47. package/Libraries/Core/ReactNativeVersion.js +1 -1
  48. package/Libraries/Core/Timers/JSTimers.js +6 -4
  49. package/Libraries/Core/setUpBatchedBridge.js +9 -5
  50. package/Libraries/Core/setUpDeveloperTools.js +3 -29
  51. package/Libraries/Core/setUpReactDevTools.js +1 -1
  52. package/Libraries/Core/setUpReactRefresh.js +1 -1
  53. package/Libraries/Core/setUpXHR.js +5 -2
  54. package/Libraries/EventEmitter/NativeEventEmitter.js +8 -2
  55. package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +5 -4
  56. package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +3 -2
  57. package/Libraries/Events/CustomEvent.js +1 -1
  58. package/Libraries/Events/EventPolyfill.js +2 -2
  59. package/Libraries/Image/AssetSourceResolver.js +1 -1
  60. package/Libraries/Image/ImageProps.js +8 -5
  61. package/Libraries/Image/ImageViewNativeComponent.js +1 -1
  62. package/Libraries/Image/resolveAssetSource.win32.js +1 -1
  63. package/Libraries/Interaction/InteractionManager.js +1 -1
  64. package/Libraries/Interaction/InteractionManagerStub.js +9 -1
  65. package/Libraries/Interaction/JSEventLoopWatchdog.js +1 -1
  66. package/Libraries/Interaction/PanResponder.js +32 -29
  67. package/Libraries/Interaction/TaskQueue.js +1 -1
  68. package/Libraries/LayoutAnimation/LayoutAnimation.js +18 -4
  69. package/Libraries/Lists/FillRateHelper.js +3 -3
  70. package/Libraries/Lists/FlatList.js +13 -13
  71. package/Libraries/Lists/SectionList.js +3 -1
  72. package/Libraries/Lists/SectionListModern.js +3 -1
  73. package/Libraries/Lists/ViewabilityHelper.js +3 -2
  74. package/Libraries/Lists/VirtualizeUtils.js +3 -3
  75. package/Libraries/Lists/VirtualizedList.js +5 -5
  76. package/Libraries/Lists/VirtualizedListContext.js +4 -2
  77. package/Libraries/Lists/VirtualizedSectionList.js +4 -2
  78. package/Libraries/LogBox/LogBox.js +9 -1
  79. package/Libraries/LogBox/UI/AnsiHighlight.js +7 -3
  80. package/Libraries/LogBox/UI/LogBoxButton.js +4 -2
  81. package/Libraries/LogBox/UI/LogBoxInspector.js +1 -1
  82. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +11 -3
  83. package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +2 -0
  84. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +8 -2
  85. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +8 -2
  86. package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +2 -0
  87. package/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js +4 -2
  88. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +3 -1
  89. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +3 -1
  90. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +2 -2
  91. package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +5 -3
  92. package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.win32.js +5 -3
  93. package/Libraries/LogBox/UI/LogBoxNotification.js +6 -2
  94. package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +3 -1
  95. package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +2 -0
  96. package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +4 -1
  97. package/Libraries/Modal/Modal.js +74 -81
  98. package/Libraries/NativeComponent/BaseViewConfig.android.js +16 -6
  99. package/Libraries/NativeComponent/BaseViewConfig.ios.js +19 -9
  100. package/Libraries/NativeComponent/BaseViewConfig.win32.js +19 -9
  101. package/Libraries/NativeComponent/StaticViewConfigValidator.js +5 -1
  102. package/Libraries/Network/FormData.js +1 -1
  103. package/Libraries/Network/XMLHttpRequest.js +5 -6
  104. package/Libraries/Network/XMLHttpRequest_new.js +3 -2
  105. package/Libraries/Network/XMLHttpRequest_old.js +3 -2
  106. package/Libraries/Network/convertRequestBody.js +4 -3
  107. package/Libraries/Network/fetch.js +4 -3
  108. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +63 -61
  109. package/Libraries/Pressability/Pressability.js +23 -23
  110. package/Libraries/Pressability/Pressability.win32.js +23 -23
  111. package/Libraries/PushNotificationIOS/PushNotificationIOS.js +119 -16
  112. package/Libraries/ReactNative/AppContainer-dev.js +2 -1
  113. package/Libraries/ReactNative/AppRegistry.js +3 -3
  114. package/Libraries/ReactNative/PaperUIManager.js +3 -2
  115. package/Libraries/ReactNative/PaperUIManager.win32.js +3 -2
  116. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +2 -1
  117. package/Libraries/ReactNative/RootTag.js +1 -1
  118. package/Libraries/ReactNative/getNativeComponentAttributes.js +4 -4
  119. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +6 -4
  120. package/Libraries/Renderer/shims/ReactNativeTypes.js +4 -5
  121. package/Libraries/Settings/Settings.js +2 -2
  122. package/Libraries/Settings/Settings.win32.js +2 -2
  123. package/Libraries/Share/Share.js +10 -3
  124. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +1 -1
  125. package/Libraries/StyleSheet/StyleSheet.js +1 -1
  126. package/Libraries/StyleSheet/StyleSheet.win32.js +2 -2
  127. package/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js +1 -1
  128. package/Libraries/StyleSheet/flattenStyle.js +1 -1
  129. package/Libraries/StyleSheet/normalizeColor.js +1 -1
  130. package/Libraries/StyleSheet/processAspectRatio.js +1 -1
  131. package/Libraries/StyleSheet/processColor.js +2 -2
  132. package/Libraries/StyleSheet/processFilter.js +4 -0
  133. package/Libraries/StyleSheet/processFontVariant.js +1 -1
  134. package/Libraries/StyleSheet/processTransform.js +1 -1
  135. package/Libraries/StyleSheet/setNormalizedColorAlpha.js +1 -1
  136. package/Libraries/Text/Text.js +15 -15
  137. package/Libraries/Text/Text.win32.js +15 -15
  138. package/Libraries/Text/TextAncestor.js +1 -1
  139. package/Libraries/Text/TextNativeComponent.js +2 -2
  140. package/Libraries/Text/TextNativeComponent.win32.js +2 -2
  141. package/Libraries/Text/TextProps.js +11 -11
  142. package/Libraries/Text/TextProps.win32.js +11 -11
  143. package/Libraries/Types/CodegenTypes.js +3 -3
  144. package/Libraries/Types/CoreEventTypes.js +103 -72
  145. package/Libraries/Types/CoreEventTypes.win32.js +115 -79
  146. package/Libraries/UTFSequence.js +2 -1
  147. package/Libraries/Utilities/BackHandler.android.js +1 -1
  148. package/Libraries/Utilities/BackHandler.ios.js +5 -5
  149. package/Libraries/Utilities/BackHandler.win32.js +1 -1
  150. package/Libraries/Utilities/DevLoadingView.js +1 -1
  151. package/Libraries/Utilities/DevSettings.js +1 -1
  152. package/Libraries/Utilities/DeviceInfo.js +1 -1
  153. package/Libraries/Utilities/DeviceInfo.win32.js +1 -1
  154. package/Libraries/Utilities/FeatureDetection.js +2 -4
  155. package/Libraries/Utilities/FocusManager.win32.js +3 -3
  156. package/Libraries/Utilities/GlobalPerformanceLogger.js +1 -1
  157. package/Libraries/Utilities/HMRClient.js +5 -33
  158. package/Libraries/Utilities/HMRClientProdShim.js +1 -2
  159. package/Libraries/Utilities/Platform.android.js +2 -2
  160. package/Libraries/Utilities/Platform.ios.js +2 -2
  161. package/Libraries/Utilities/Platform.win32.js +2 -2
  162. package/Libraries/Utilities/{Platform.flow.win32.js → PlatformTypes.js} +1 -0
  163. package/Libraries/Utilities/PolyfillFunctions.js +3 -5
  164. package/Libraries/Utilities/RCTLog.js +1 -1
  165. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  166. package/Libraries/Utilities/SceneTracker.js +1 -1
  167. package/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js +2 -2
  168. package/Libraries/Utilities/binaryToBase64.js +1 -1
  169. package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +1 -1
  170. package/Libraries/Utilities/defineLazyObjectProperty.js +1 -1
  171. package/Libraries/Utilities/differ/deepDiffer.js +3 -3
  172. package/Libraries/Utilities/differ/insetsDiffer.js +3 -3
  173. package/Libraries/Utilities/differ/matricesDiffer.js +3 -6
  174. package/Libraries/Utilities/differ/pointsDiffer.js +3 -3
  175. package/Libraries/Utilities/differ/sizesDiffer.js +3 -3
  176. package/Libraries/Utilities/dismissKeyboard.js +1 -1
  177. package/Libraries/Utilities/infoLog.js +1 -1
  178. package/Libraries/Utilities/logError.js +1 -1
  179. package/Libraries/Utilities/mapWithSeparator.js +1 -1
  180. package/Libraries/Utilities/warnOnce.js +1 -1
  181. package/Libraries/Vibration/Vibration.js +3 -3
  182. package/Libraries/vendor/emitter/EventEmitter.js +21 -9
  183. package/index.js +113 -199
  184. package/index.win32.js +21 -13
  185. package/jest/setup.js +9 -2
  186. package/overrides.json +35 -34
  187. package/package.json +15 -15
  188. package/src/private/devmenu/DevMenu.js +1 -1
  189. package/src/private/featureflags/ReactNativeFeatureFlags.js +22 -23
  190. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +4 -7
  191. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -4
  192. package/src/private/inspector/BoxInspector.js +1 -1
  193. package/src/private/inspector/ElementBox.js +3 -2
  194. package/src/private/inspector/ElementProperties.js +5 -3
  195. package/src/private/inspector/Inspector.js +2 -2
  196. package/src/private/inspector/InspectorOverlay.js +4 -4
  197. package/src/private/inspector/InspectorPanel.js +1 -1
  198. package/src/private/inspector/NetworkOverlay.js +4 -4
  199. package/src/private/inspector/PerformanceOverlay.js +3 -2
  200. package/src/private/inspector/ReactDevToolsOverlay.js +3 -3
  201. package/src/private/inspector/StyleInspector.js +1 -1
  202. package/src/private/inspector/XHRInterceptor.js +5 -2
  203. package/src/private/renderer/errorhandling/ErrorHandlers.js +2 -1
  204. package/src/private/specs_DEPRECATED/modules/NativeExceptionsManager.js +1 -1
  205. package/src/private/specs_DEPRECATED/modules/NativePermissionsAndroid.js +5 -4
  206. package/src/private/specs_DEPRECATED/modules/NativeUIManager.js +92 -19
  207. package/src/private/webapis/dom/events/CustomEvent.js +5 -7
  208. package/src/private/webapis/dom/events/Event.js +5 -5
  209. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -0
  210. package/src/private/webapis/html/events/MessageEvent.js +12 -19
  211. package/src/private/webapis/websockets/events/CloseEvent.js +9 -11
  212. package/src/private/webapis/xhr/events/ProgressEvent.js +9 -11
  213. package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +14 -14
  214. package/Libraries/Alert/Alert.flow.js +0 -62
  215. package/Libraries/Alert/RCTAlertManager.flow.js +0 -20
  216. package/Libraries/Utilities/Platform.flow.js +0 -91
  217. package/flow/react.js +0 -15
@@ -11,7 +11,7 @@
11
11
  'use strict';
12
12
 
13
13
  import type XMLHttpRequest from '../../../Libraries/Network/XMLHttpRequest';
14
- import type {RenderItemProps} from '@react-native/virtualized-lists';
14
+ import type {ListRenderItemInfo} from '@react-native/virtualized-lists';
15
15
 
16
16
  import ScrollView from '../../../Libraries/Components/ScrollView/ScrollView';
17
17
  import React from 'react';
@@ -20,11 +20,11 @@ const TouchableHighlight =
20
20
  require('../../../Libraries/Components/Touchable/TouchableHighlight').default;
21
21
  const View = require('../../../Libraries/Components/View/View').default;
22
22
  const FlatList = require('../../../Libraries/Lists/FlatList').default;
23
- const StyleSheet = require('../../../Libraries/StyleSheet/StyleSheet');
23
+ const StyleSheet = require('../../../Libraries/StyleSheet/StyleSheet').default;
24
24
  const Text = require('../../../Libraries/Text/Text').default;
25
25
  const WebSocketInterceptor =
26
26
  require('../../../Libraries/WebSocket/WebSocketInterceptor').default;
27
- const XHRInterceptor = require('./XHRInterceptor');
27
+ const XHRInterceptor = require('./XHRInterceptor').default;
28
28
 
29
29
  const LISTVIEW_CELL_HEIGHT = 15;
30
30
 
@@ -355,7 +355,7 @@ class NetworkOverlay extends React.Component<Props, State> {
355
355
  _renderItem = ({
356
356
  item,
357
357
  index,
358
- }: RenderItemProps<NetworkRequestInfo>): React.MixedElement => {
358
+ }: ListRenderItemInfo<NetworkRequestInfo>): React.MixedElement => {
359
359
  const tableRowViewStyle = [
360
360
  styles.tableRow,
361
361
  index % 2 === 1 ? styles.tableRowOdd : styles.tableRowEven,
@@ -13,9 +13,10 @@
13
13
  import React from 'react';
14
14
 
15
15
  const View = require('../../../Libraries/Components/View/View').default;
16
- const StyleSheet = require('../../../Libraries/StyleSheet/StyleSheet');
16
+ const StyleSheet = require('../../../Libraries/StyleSheet/StyleSheet').default;
17
17
  const Text = require('../../../Libraries/Text/Text').default;
18
- const PerformanceLogger = require('../../../Libraries/Utilities/GlobalPerformanceLogger');
18
+ const PerformanceLogger =
19
+ require('../../../Libraries/Utilities/GlobalPerformanceLogger').default;
19
20
 
20
21
  class PerformanceOverlay extends React.Component<{...}> {
21
22
  render(): React.Node {
@@ -10,7 +10,7 @@
10
10
 
11
11
  import type {InspectedViewRef} from '../../../Libraries/ReactNative/AppContainer-dev';
12
12
  import type {PointerEvent} from '../../../Libraries/Types/CoreEventTypes';
13
- import type {PressEvent} from '../../../Libraries/Types/CoreEventTypes';
13
+ import type {GestureResponderEvent} from '../../../Libraries/Types/CoreEventTypes';
14
14
  import type {ReactDevToolsAgent} from '../../../Libraries/Types/ReactDevToolsTypes';
15
15
  import type {InspectedElement} from './Inspector';
16
16
 
@@ -107,7 +107,7 @@ export default function ReactDevToolsOverlay({
107
107
  );
108
108
 
109
109
  const onResponderMove = useCallback(
110
- (e: PressEvent) => {
110
+ (e: GestureResponderEvent) => {
111
111
  findViewForLocation(
112
112
  e.nativeEvent.touches[0].locationX,
113
113
  e.nativeEvent.touches[0].locationY,
@@ -117,7 +117,7 @@ export default function ReactDevToolsOverlay({
117
117
  );
118
118
 
119
119
  const shouldSetResponder = useCallback(
120
- (e: PressEvent): boolean => {
120
+ (e: GestureResponderEvent): boolean => {
121
121
  onResponderMove(e);
122
122
  return true;
123
123
  },
@@ -16,7 +16,7 @@ import type {____FlattenStyleProp_Internal} from '../../../Libraries/StyleSheet/
16
16
  import React from 'react';
17
17
 
18
18
  const View = require('../../../Libraries/Components/View/View').default;
19
- const StyleSheet = require('../../../Libraries/StyleSheet/StyleSheet');
19
+ const StyleSheet = require('../../../Libraries/StyleSheet/StyleSheet').default;
20
20
  const Text = require('../../../Libraries/Text/Text').default;
21
21
 
22
22
  type Props = $ReadOnly<{
@@ -10,7 +10,10 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const XMLHttpRequest = require('../../../Libraries/Network/XMLHttpRequest');
13
+ import typeof XMLHttpRequestT from '../../../Libraries/Network/XMLHttpRequest';
14
+
15
+ const XMLHttpRequest: XMLHttpRequestT =
16
+ require('../../../Libraries/Network/XMLHttpRequest').default;
14
17
  // $FlowFixMe[method-unbinding]
15
18
  const originalXHROpen = XMLHttpRequest.prototype.open;
16
19
  // $FlowFixMe[method-unbinding]
@@ -211,4 +214,4 @@ const XHRInterceptor = {
211
214
  },
212
215
  };
213
216
 
214
- module.exports = XHRInterceptor;
217
+ export default XHRInterceptor;
@@ -9,6 +9,7 @@
9
9
  */
10
10
 
11
11
  import type {ExtendedError} from '../../../../Libraries/Core/ExtendedError';
12
+ import type {Component as ReactComponent} from 'react';
12
13
 
13
14
  import ExceptionsManager, {
14
15
  SyntheticError,
@@ -17,7 +18,7 @@ import ExceptionsManager, {
17
18
  type ErrorInfo = {
18
19
  +componentStack?: ?string,
19
20
  // $FlowFixMe[unclear-type] unknown props and state.
20
- +errorBoundary?: ?React$Component<any, any>,
21
+ +errorBoundary?: ?ReactComponent<any, any>,
21
22
  };
22
23
 
23
24
  function getExtendedError(
@@ -12,7 +12,7 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
12
12
 
13
13
  import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
14
14
 
15
- const Platform = require('../../../../Libraries/Utilities/Platform');
15
+ const Platform = require('../../../../Libraries/Utilities/Platform').default;
16
16
 
17
17
  export type StackFrame = {
18
18
  column: ?number,
@@ -15,6 +15,7 @@ import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboMod
15
15
  // TODO: Use proper enum types.
16
16
  export type PermissionStatus = string;
17
17
  export type PermissionType = string;
18
+
18
19
  /*
19
20
  export type PermissionStatus = 'granted' | 'denied' | 'never_ask_again';
20
21
  export type PermissionType =
@@ -45,9 +46,9 @@ export type PermissionType =
45
46
  | 'android.permission.RECEIVE_WAP_PUSH'
46
47
  | 'android.permission.RECEIVE_MMS'
47
48
  | 'android.permission.READ_EXTERNAL_STORAGE'
48
- | 'android.permission.READ_MEDIA_IMAGES',
49
- | 'android.permission.READ_MEDIA_VIDEO',
50
- | 'android.permission.READ_MEDIA_AUDIO',
49
+ | 'android.permission.READ_MEDIA_IMAGES'
50
+ | 'android.permission.READ_MEDIA_VIDEO'
51
+ | 'android.permission.READ_MEDIA_AUDIO'
51
52
  | 'android.permission.READ_MEDIA_VISUAL_USER_SELECTED'
52
53
  | 'android.permission.WRITE_EXTERNAL_STORAGE'
53
54
  | 'android.permission.BLUETOOTH_CONNECT'
@@ -61,7 +62,7 @@ export type PermissionType =
61
62
  | 'android.permission.UWB_RANGING'
62
63
  | 'android.permission.POST_NOTIFICATIONS'
63
64
  | 'android.permission.NEARBY_WIFI_DEVICES';
64
- */
65
+ */
65
66
 
66
67
  export interface Spec extends TurboModule {
67
68
  +checkPermission: (permission: PermissionType) => Promise<boolean>;
@@ -13,6 +13,29 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
13
13
 
14
14
  import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
15
15
 
16
+ export type MeasureOnSuccessCallback = (
17
+ x: number,
18
+ y: number,
19
+ width: number,
20
+ height: number,
21
+ pageX: number,
22
+ pageY: number,
23
+ ) => void;
24
+
25
+ export type MeasureInWindowOnSuccessCallback = (
26
+ x: number,
27
+ y: number,
28
+ width: number,
29
+ height: number,
30
+ ) => void;
31
+
32
+ export type MeasureLayoutOnSuccessCallback = (
33
+ left: number,
34
+ top: number,
35
+ width: number,
36
+ height: number,
37
+ ) => void;
38
+
16
39
  export interface Spec extends TurboModule {
17
40
  +getConstants: () => Object;
18
41
  +createView: (
@@ -33,41 +56,79 @@ export interface Spec extends TurboModule {
33
56
  height: number,
34
57
  ) => void,
35
58
  ) => void;
59
+ /**
60
+ * Used to call a native view method from JavaScript
61
+ *
62
+ * reactTag - Id of react view.
63
+ * commandID - Id of the native method that should be called.
64
+ * commandArgs - Args of the native method that we can pass from JS to native.
65
+ */
36
66
  +dispatchViewManagerCommand: (
37
67
  reactTag: number,
38
68
  commandID: number, // number || string
39
- commandArgs: ?Array<any>,
40
- ) => void;
41
- +measure: (
42
- reactTag: number,
43
- callback: (
44
- left: number,
45
- top: number,
46
- width: number,
47
- height: number,
48
- pageX: number,
49
- pageY: number,
50
- ) => void,
69
+ commandArgs?: Array<any>,
51
70
  ) => void;
71
+ /**
72
+ * Determines the location on screen, width, and height of the given view and
73
+ * returns the values via an async callback. If successful, the callback will
74
+ * be called with the following arguments:
75
+ *
76
+ * - x
77
+ * - y
78
+ * - width
79
+ * - height
80
+ * - pageX
81
+ * - pageY
82
+ *
83
+ * Note that these measurements are not available until after the rendering
84
+ * has been completed in native. If you need the measurements as soon as
85
+ * possible, consider using the [`onLayout`
86
+ * prop](docs/view.html#onlayout) instead.
87
+ *
88
+ * @deprecated Use `ref.measure` instead.
89
+ */
90
+ +measure: (reactTag: number, callback: MeasureOnSuccessCallback) => void;
91
+ /**
92
+ * Determines the location of the given view in the window and returns the
93
+ * values via an async callback. If the React root view is embedded in
94
+ * another native view, this will give you the absolute coordinates. If
95
+ * successful, the callback will be called with the following
96
+ * arguments:
97
+ *
98
+ * - x
99
+ * - y
100
+ * - width
101
+ * - height
102
+ *
103
+ * Note that these measurements are not available until after the rendering
104
+ * has been completed in native.
105
+ *
106
+ * @deprecated Use `ref.measureInWindow` instead.
107
+ */
52
108
  +measureInWindow: (
53
109
  reactTag: number,
54
- callback: (x: number, y: number, width: number, height: number) => void,
110
+ callback: MeasureInWindowOnSuccessCallback,
55
111
  ) => void;
56
112
  +viewIsDescendantOf: (
57
113
  reactTag: number,
58
114
  ancestorReactTag: number,
59
115
  callback: (result: Array<boolean>) => void,
60
116
  ) => void;
117
+ /**
118
+ * Like [`measure()`](#measure), but measures the view relative an ancestor,
119
+ * specified as `relativeToNativeNode`. This means that the returned x, y
120
+ * are relative to the origin x, y of the ancestor view.
121
+ *
122
+ * As always, to obtain a native node handle for a component, you can use
123
+ * `React.findNodeHandle(component)`.
124
+ *
125
+ * @deprecated Use `ref.measureLayout` instead.
126
+ */
61
127
  +measureLayout: (
62
128
  reactTag: number,
63
129
  ancestorReactTag: number,
64
130
  errorCallback: (error: Object) => void,
65
- callback: (
66
- left: number,
67
- top: number,
68
- width: number,
69
- height: number,
70
- ) => void,
131
+ callback: MeasureLayoutOnSuccessCallback,
71
132
  ) => void;
72
133
  +measureLayoutRelativeToParent: (
73
134
  reactTag: number,
@@ -99,6 +160,18 @@ export interface Spec extends TurboModule {
99
160
  // Android only
100
161
  +getConstantsForViewManager?: (viewManagerName: string) => ?Object;
101
162
  +getDefaultEventTypes?: () => Array<string>;
163
+ /**
164
+ * Automatically animates views to their new positions when the
165
+ * next layout happens.
166
+ *
167
+ * A common way to use this API is to call it before calling `setState`.
168
+ *
169
+ * Note that in order to get this to work on **Android** you need to set the following flags via `UIManager`:
170
+ *
171
+ * ```js
172
+ * UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);
173
+ * ```
174
+ */
102
175
  +setLayoutAnimationEnabledExperimental?: (enabled: boolean) => void;
103
176
  +sendAccessibilityEvent?: (reactTag: number, eventType: number) => void;
104
177
 
@@ -19,19 +19,17 @@ import type {EventInit} from './Event';
19
19
 
20
20
  import Event from './Event';
21
21
 
22
- export type CustomEventInit = $ReadOnly<{
23
- ...EventInit,
24
- detail?: mixed,
25
- }>;
22
+ export interface CustomEventInit extends EventInit {
23
+ +detail?: mixed;
24
+ }
26
25
 
27
26
  export default class CustomEvent extends Event {
28
27
  _detail: mixed;
29
28
 
30
29
  constructor(type: string, options?: ?CustomEventInit) {
31
- const {detail, ...eventOptions} = options ?? {};
32
- super(type, eventOptions);
30
+ super(type, options);
33
31
 
34
- this._detail = detail;
32
+ this._detail = options?.detail;
35
33
  }
36
34
 
37
35
  get detail(): mixed {
@@ -36,11 +36,11 @@ import {
36
36
  setStopPropagationFlag,
37
37
  } from './internals/EventInternals';
38
38
 
39
- export type EventInit = $ReadOnly<{
40
- bubbles?: boolean,
41
- cancelable?: boolean,
42
- composed?: boolean,
43
- }>;
39
+ export interface EventInit {
40
+ +bubbles?: boolean;
41
+ +cancelable?: boolean;
42
+ +composed?: boolean;
43
+ }
44
44
 
45
45
  export default class Event {
46
46
  static +NONE: 0;
@@ -39,5 +39,6 @@ export function isReactNativeDocumentInstanceHandle(
39
39
  instanceHandle: mixed,
40
40
  // $FlowExpectedError[incompatible-type-guard]
41
41
  ): instanceHandle is ReactNativeDocumentInstanceHandle {
42
+ // $FlowFixMe[incompatible-type-guard]
42
43
  return typeof instanceHandle === 'number' && instanceHandle % 10 === 1;
43
44
  }
@@ -19,16 +19,15 @@ import type {EventInit} from '../../dom/events/Event';
19
19
 
20
20
  import Event from '../../dom/events/Event';
21
21
 
22
- export type MessageEventInit = $ReadOnly<{
23
- ...EventInit,
24
- data?: mixed,
25
- origin?: string,
26
- lastEventId?: string,
22
+ export interface MessageEventInit extends EventInit {
23
+ +data?: mixed;
24
+ +origin?: string;
25
+ +lastEventId?: string;
27
26
  // Unsupported
28
- // source?: MessageEventSource,
27
+ // +source?: MessageEventSource,
29
28
  // Unsupported
30
- // ports?: Array<MessagePort>,
31
- }>;
29
+ // +ports?: Array<MessagePort>,
30
+ }
32
31
 
33
32
  export default class MessageEvent extends Event {
34
33
  _data: mixed;
@@ -36,17 +35,11 @@ export default class MessageEvent extends Event {
36
35
  _lastEventId: string;
37
36
 
38
37
  constructor(type: string, options?: ?MessageEventInit) {
39
- const {
40
- data,
41
- origin = '',
42
- lastEventId = '',
43
- ...eventOptions
44
- } = options ?? {};
45
- super(type, eventOptions);
46
-
47
- this._data = data;
48
- this._origin = String(origin);
49
- this._lastEventId = String(lastEventId);
38
+ super(type, options);
39
+
40
+ this._data = options?.data;
41
+ this._origin = String(options?.origin ?? '');
42
+ this._lastEventId = String(options?.lastEventId ?? '');
50
43
  }
51
44
 
52
45
  get data(): mixed {
@@ -19,12 +19,11 @@ import type {EventInit} from '../../dom/events/Event';
19
19
 
20
20
  import Event from '../../dom/events/Event';
21
21
 
22
- export type CloseEventInit = $ReadOnly<{
23
- ...EventInit,
24
- wasClean?: boolean,
25
- code?: number,
26
- reason?: string,
27
- }>;
22
+ export interface CloseEventInit extends EventInit {
23
+ +wasClean?: boolean;
24
+ +code?: number;
25
+ +reason?: string;
26
+ }
28
27
 
29
28
  export default class CloseEvent extends Event {
30
29
  _wasClean: boolean;
@@ -32,12 +31,11 @@ export default class CloseEvent extends Event {
32
31
  _reason: string;
33
32
 
34
33
  constructor(type: string, options?: ?CloseEventInit) {
35
- const {wasClean, code, reason, ...eventOptions} = options ?? {};
36
- super(type, eventOptions);
34
+ super(type, options);
37
35
 
38
- this._wasClean = Boolean(wasClean);
39
- this._code = Number(code) || 0;
40
- this._reason = reason != null ? String(reason) : '';
36
+ this._wasClean = Boolean(options?.wasClean);
37
+ this._code = Number(options?.code) || 0;
38
+ this._reason = options?.reason != null ? String(options.reason) : '';
41
39
  }
42
40
 
43
41
  get wasClean(): boolean {
@@ -19,12 +19,11 @@ import type {EventInit} from '../../dom/events/Event';
19
19
 
20
20
  import Event from '../../dom/events/Event';
21
21
 
22
- export type ProgressEventInit = $ReadOnly<{
23
- ...EventInit,
24
- lengthComputable: boolean,
25
- loaded: number,
26
- total: number,
27
- }>;
22
+ export interface ProgressEventInit extends EventInit {
23
+ +lengthComputable: boolean;
24
+ +loaded: number;
25
+ +total: number;
26
+ }
28
27
 
29
28
  export default class ProgressEvent extends Event {
30
29
  _lengthComputable: boolean;
@@ -32,12 +31,11 @@ export default class ProgressEvent extends Event {
32
31
  _total: number;
33
32
 
34
33
  constructor(type: string, options?: ?ProgressEventInit) {
35
- const {lengthComputable, loaded, total, ...eventOptions} = options ?? {};
36
- super(type, eventOptions);
34
+ super(type, options);
37
35
 
38
- this._lengthComputable = Boolean(lengthComputable);
39
- this._loaded = Number(loaded) || 0;
40
- this._total = Number(total) || 0;
36
+ this._lengthComputable = Boolean(options?.lengthComputable);
37
+ this._loaded = Number(options?.loaded) || 0;
38
+ this._total = Number(options?.total) || 0;
41
39
  }
42
40
 
43
41
  get lengthComputable(): boolean {
@@ -81,20 +81,6 @@ export interface ViewPropsIOS extends TVViewPropsIOS {
81
81
  }
82
82
 
83
83
  export interface ViewPropsAndroid {
84
- /**
85
- * Views that are only used to layout their children or otherwise don't draw anything
86
- * may be automatically removed from the native hierarchy as an optimization.
87
- * Set this property to false to disable this optimization and ensure that this View exists in the native view hierarchy.
88
- */
89
- collapsable?: boolean | undefined;
90
-
91
- /**
92
- * Setting to false prevents direct children of the view from being removed
93
- * from the native view hierarchy, similar to the effect of setting
94
- * `collapsable={false}` on each child.
95
- */
96
- collapsableChildren?: boolean | undefined;
97
-
98
84
  /**
99
85
  * Whether this view should render itself (and all of its children) into a single hardware texture on the GPU.
100
86
  *
@@ -343,6 +329,20 @@ export interface ViewProps
343
329
  * Used to reference react managed views from native code.
344
330
  */
345
331
  nativeID?: string | undefined;
332
+
333
+ /**
334
+ * Views that are only used to layout their children or otherwise don't draw anything
335
+ * may be automatically removed from the native hierarchy as an optimization.
336
+ * Set this property to false to disable this optimization and ensure that this View exists in the native view hierarchy.
337
+ */
338
+ collapsable?: boolean | undefined;
339
+
340
+ /**
341
+ * Setting to false prevents direct children of the view from being removed
342
+ * from the native view hierarchy, similar to the effect of setting
343
+ * `collapsable={false}` on each child.
344
+ */
345
+ collapsableChildren?: boolean | undefined;
346
346
  }
347
347
 
348
348
  // For backwards compat.... // Win32
@@ -1,62 +0,0 @@
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
9
- */
10
-
11
- export type AlertType =
12
- | 'default'
13
- | 'plain-text'
14
- | 'secure-text'
15
- | 'login-password';
16
-
17
- export type AlertButtonStyle = 'default' | 'cancel' | 'destructive';
18
-
19
- export type AlertButton = {
20
- text?: string,
21
- onPress?: ?((value?: string) => any) | ?Function,
22
- isPreferred?: boolean,
23
- style?: AlertButtonStyle,
24
- ...
25
- };
26
-
27
- export type Buttons = Array<AlertButton>;
28
-
29
- export type AlertOptions = {
30
- /** @platform android */
31
- cancelable?: ?boolean,
32
- userInterfaceStyle?: 'unspecified' | 'light' | 'dark',
33
- /** @platform android */
34
- onDismiss?: ?() => void,
35
- ...
36
- };
37
-
38
- /**
39
- * Launches an alert dialog with the specified title and message.
40
- *
41
- * See https://reactnative.dev/docs/alert
42
- */
43
- declare class Alert {
44
- static alert(
45
- title: ?string,
46
- message?: ?string,
47
- buttons?: Buttons,
48
- options?: AlertOptions,
49
- ): void;
50
-
51
- static prompt(
52
- title: ?string,
53
- message?: ?string,
54
- callbackOrButtons?: ?(((text: string) => void) | Buttons),
55
- type?: ?AlertType,
56
- defaultValue?: string,
57
- keyboardType?: string,
58
- options?: AlertOptions,
59
- ): void;
60
- }
61
-
62
- export default Alert;
@@ -1,20 +0,0 @@
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 {Args} from './NativeAlertManager';
12
-
13
- declare const RCTAlertManager: {
14
- alertWithArgs(
15
- args: Args,
16
- callback: (id: number, value: string) => void,
17
- ): void,
18
- };
19
-
20
- export default RCTAlertManager;