@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
package/.flowconfig CHANGED
@@ -164,4 +164,4 @@ untyped-import
164
164
  untyped-type-import
165
165
 
166
166
  [version]
167
- ^0.259.1
167
+ ^0.261.2
package/CHANGELOG.json CHANGED
@@ -2,7 +2,22 @@
2
2
  "name": "@office-iss/react-native-win32",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 13 May 2025 05:25:37 GMT",
5
+ "date": "Thu, 22 May 2025 05:24:02 GMT",
6
+ "version": "0.0.0-canary.286",
7
+ "tag": "@office-iss/react-native-win32_v0.0.0-canary.286",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "54227869+anupriya13@users.noreply.github.com",
12
+ "package": "@office-iss/react-native-win32",
13
+ "commit": "d31d0a6d69d9db9a81e7b4423d09baa381b98367",
14
+ "comment": "Integrate RN 0.79.0-nightly-20250220-41b597c73"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Tue, 13 May 2025 21:05:06 GMT",
6
21
  "version": "0.0.0-canary.285",
7
22
  "tag": "@office-iss/react-native-win32_v0.0.0-canary.285",
8
23
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,21 +1,29 @@
1
1
  # Change Log - @office-iss/react-native-win32
2
2
 
3
- <!-- This log was last generated on Tue, 13 May 2025 05:25:37 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Thu, 22 May 2025 05:24:02 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.0.0-canary.285
7
+ ## 0.0.0-canary.286
8
8
 
9
- Tue, 13 May 2025 05:25:37 GMT
9
+ Thu, 22 May 2025 05:24:02 GMT
10
10
 
11
11
  ### Changes
12
12
 
13
- - Integrate RN Nightly Build 0.79.0-nightly-20250206-fb8a6a5bb (54227869+anupriya13@users.noreply.github.com)
14
- - Bump @rnw-scripts/eslint-config to v1.2.35
15
- - Bump @rnw-scripts/jest-out-of-tree-snapshot-resolver to v1.1.39
16
- - Bump @rnw-scripts/just-task to v2.3.52
17
- - Bump react-native-platform-override to v1.9.54
13
+ - Integrate RN 0.79.0-nightly-20250220-41b597c73 (54227869+anupriya13@users.noreply.github.com)
18
14
 
15
+ ## 0.0.0-canary.285
16
+
17
+ Tue, 13 May 2025 21:05:06 GMT
18
+
19
+ ### Changes
20
+
21
+ - Integrate RN Nightly Build 0.79.0-nightly-20250206-fb8a6a5bb (54227869+anupriya13@users.noreply.github.com)
22
+ - Bump @rnw-scripts/eslint-config to v1.2.35
23
+ - Bump @rnw-scripts/jest-out-of-tree-snapshot-resolver to v1.1.39
24
+ - Bump @rnw-scripts/just-task to v2.3.52
25
+ - Bump react-native-platform-override to v1.9.54
26
+
19
27
  ## 0.0.0-canary.284
20
28
 
21
29
  Thu, 08 May 2025 05:23:32 GMT
@@ -12,17 +12,18 @@
12
12
 
13
13
  import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet';
14
14
  import type {
15
- Layout,
16
- LayoutEvent,
15
+ LayoutChangeEvent,
16
+ LayoutRectangle,
17
17
  } from 'react-native/Libraries/Types/CoreEventTypes';
18
18
 
19
19
  const React = require('react');
20
20
  const ReactNative = require('react-native');
21
- const deepDiffer = require('react-native/Libraries/Utilities/differ/deepDiffer');
21
+ const deepDiffer =
22
+ require('react-native/Libraries/Utilities/differ/deepDiffer').default;
22
23
 
23
24
  const {Image, LayoutAnimation, StyleSheet, Text, View} = ReactNative;
24
25
  const {TestModule} = ReactNative.NativeModules;
25
- function debug(...args: Array<void | Layout | string>) {
26
+ function debug(...args: Array<void | LayoutRectangle | string>) {
26
27
  // console.log.apply(null, arguments);
27
28
  }
28
29
 
@@ -31,9 +32,9 @@ type Props = $ReadOnly<{}>;
31
32
  type State = {
32
33
  didAnimation: boolean,
33
34
  extraText?: string,
34
- imageLayout?: Layout,
35
- textLayout?: Layout,
36
- viewLayout?: Layout,
35
+ imageLayout?: LayoutRectangle,
36
+ textLayout?: LayoutRectangle,
37
+ viewLayout?: LayoutRectangle,
37
38
  viewStyle?: ViewStyleProp,
38
39
  containerStyle?: ViewStyleProp,
39
40
  ...
@@ -105,7 +106,11 @@ class LayoutEventsTest extends React.Component<Props, State> {
105
106
  });
106
107
  };
107
108
 
108
- compare(node: string, measured: Layout, onLayout?: ?Layout): void {
109
+ compare(
110
+ node: string,
111
+ measured: LayoutRectangle,
112
+ onLayout?: ?LayoutRectangle,
113
+ ): void {
109
114
  if (deepDiffer(measured, onLayout)) {
110
115
  const data = {measured, onLayout};
111
116
  throw new Error(
@@ -116,19 +121,19 @@ class LayoutEventsTest extends React.Component<Props, State> {
116
121
  }
117
122
  }
118
123
 
119
- onViewLayout: (e: LayoutEvent) => void = (e: LayoutEvent) => {
124
+ onViewLayout: (e: LayoutChangeEvent) => void = (e: LayoutChangeEvent) => {
120
125
  // $FlowFixMe[incompatible-call]
121
126
  debug('received view layout event\n', e.nativeEvent);
122
127
  this.setState({viewLayout: e.nativeEvent.layout}, this.checkLayout);
123
128
  };
124
129
 
125
- onTextLayout: (e: LayoutEvent) => void = (e: LayoutEvent) => {
130
+ onTextLayout: (e: LayoutChangeEvent) => void = (e: LayoutChangeEvent) => {
126
131
  // $FlowFixMe[incompatible-call]
127
132
  debug('received text layout event\n', e.nativeEvent);
128
133
  this.setState({textLayout: e.nativeEvent.layout}, this.checkLayout);
129
134
  };
130
135
 
131
- onImageLayout: (e: LayoutEvent) => void = (e: LayoutEvent) => {
136
+ onImageLayout: (e: LayoutChangeEvent) => void = (e: LayoutChangeEvent) => {
132
137
  // $FlowFixMe[incompatible-call]
133
138
  debug('received image layout event\n', e.nativeEvent);
134
139
  this.setState({imageLayout: e.nativeEvent.layout}, this.checkLayout);
@@ -9,18 +9,61 @@
9
9
  */
10
10
 
11
11
  import type {DialogOptions} from '../NativeModules/specs/NativeDialogManagerAndroid';
12
- import type {AlertOptions, AlertType, Buttons} from './Alert.flow';
13
12
 
14
13
  import Platform from '../Utilities/Platform';
15
14
  import RCTAlertManager from './RCTAlertManager';
16
15
 
17
- export type * from './Alert.flow';
16
+ /**
17
+ * @platform ios
18
+ */
19
+ export type AlertType =
20
+ | 'default'
21
+ | 'plain-text'
22
+ | 'secure-text'
23
+ | 'login-password';
24
+
25
+ /**
26
+ * @platform ios
27
+ */
28
+ export type AlertButtonStyle = 'default' | 'cancel' | 'destructive';
29
+
30
+ export type AlertButton = {
31
+ text?: string,
32
+ onPress?: ?((value?: string) => any) | ?Function,
33
+ isPreferred?: boolean,
34
+ style?: AlertButtonStyle,
35
+ ...
36
+ };
37
+
38
+ export type AlertButtons = Array<AlertButton>;
18
39
 
40
+ export type AlertOptions = {
41
+ /** @platform android */
42
+ cancelable?: ?boolean,
43
+ userInterfaceStyle?: 'unspecified' | 'light' | 'dark',
44
+ /** @platform android */
45
+ onDismiss?: ?() => void,
46
+ ...
47
+ };
48
+
49
+ /**
50
+ * Launches an alert dialog with the specified title and message.
51
+ *
52
+ * Optionally provide a list of buttons. Tapping any button will fire the
53
+ * respective onPress callback and dismiss the alert. By default, the only
54
+ * button will be an 'OK' button.
55
+ *
56
+ * This is an API that works both on iOS and Android and can show static
57
+ * alerts. On iOS, you can show an alert that prompts the user to enter
58
+ * some information.
59
+ *
60
+ * See https://reactnative.dev/docs/alert
61
+ */
19
62
  class Alert {
20
63
  static alert(
21
64
  title: ?string,
22
65
  message?: ?string,
23
- buttons?: Buttons,
66
+ buttons?: AlertButtons,
24
67
  options?: AlertOptions,
25
68
  ): void {
26
69
  if (Platform.OS === 'ios') {
@@ -53,7 +96,7 @@ class Alert {
53
96
  // At most three buttons (neutral, negative, positive). Ignore rest.
54
97
  // The text 'OK' should be probably localized. iOS Alert does that in native.
55
98
  const defaultPositiveText = 'OK';
56
- const validButtons: Buttons = buttons
99
+ const validButtons: AlertButtons = buttons
57
100
  ? buttons.slice(0, 3)
58
101
  : [{text: defaultPositiveText}];
59
102
  const buttonPositive = validButtons.pop();
@@ -93,10 +136,13 @@ class Alert {
93
136
  }
94
137
  }
95
138
 
139
+ /**
140
+ * @platform ios
141
+ */
96
142
  static prompt(
97
143
  title: ?string,
98
144
  message?: ?string,
99
- callbackOrButtons?: ?(((text: string) => void) | Buttons),
145
+ callbackOrButtons?: ?(((text: string) => void) | AlertButtons),
100
146
  type?: ?AlertType = 'plain-text',
101
147
  defaultValue?: string,
102
148
  keyboardType?: string,
@@ -8,21 +8,63 @@
8
8
  * @flow
9
9
  */
10
10
 
11
- import type {AlertOptions, AlertType, Buttons} from './Alert.flow';
12
-
13
11
  // [Windows
14
12
  import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
15
13
  // $FlowFixMe[underconstrained-implicit-instantiation]
16
14
  const PLYAlertManager = TurboModuleRegistry.getEnforcing('Alert');
17
15
  // Windows]
18
16
 
19
- export type * from './Alert.flow';
17
+ /**
18
+ * @platform ios
19
+ */
20
+ export type AlertType =
21
+ | 'default'
22
+ | 'plain-text'
23
+ | 'secure-text'
24
+ | 'login-password';
25
+
26
+ /**
27
+ * @platform ios
28
+ */
29
+ export type AlertButtonStyle = 'default' | 'cancel' | 'destructive';
30
+
31
+ export type AlertButton = {
32
+ text?: string,
33
+ onPress?: ?((value?: string) => any) | ?Function,
34
+ isPreferred?: boolean,
35
+ style?: AlertButtonStyle,
36
+ ...
37
+ };
20
38
 
39
+ export type AlertButtons = Array<AlertButton>;
40
+
41
+ export type AlertOptions = {
42
+ /** @platform android */
43
+ cancelable?: ?boolean,
44
+ userInterfaceStyle?: 'unspecified' | 'light' | 'dark',
45
+ /** @platform android */
46
+ onDismiss?: ?() => void,
47
+ ...
48
+ };
49
+
50
+ /**
51
+ * Launches an alert dialog with the specified title and message.
52
+ *
53
+ * Optionally provide a list of buttons. Tapping any button will fire the
54
+ * respective onPress callback and dismiss the alert. By default, the only
55
+ * button will be an 'OK' button.
56
+ *
57
+ * This is an API that works both on iOS and Android and can show static
58
+ * alerts. On iOS, you can show an alert that prompts the user to enter
59
+ * some information.
60
+ *
61
+ * See https://reactnative.dev/docs/alert
62
+ */
21
63
  class Alert {
22
64
  static alert(
23
65
  title: ?string,
24
66
  message?: ?string,
25
- buttons?: Buttons,
67
+ buttons?: AlertButtons,
26
68
  options?: AlertOptions,
27
69
  ): void {
28
70
  // [Windows
@@ -54,10 +96,13 @@ class Alert {
54
96
  // Windows]
55
97
  }
56
98
 
99
+ /**
100
+ * @platform ios
101
+ */
57
102
  static prompt(
58
103
  title: ?string,
59
104
  message?: ?string,
60
- callbackOrButtons?: ?(((text: string) => void) | Buttons),
105
+ callbackOrButtons?: ?(((text: string) => void) | AlertButtons),
61
106
  type?: ?AlertType = 'plain-text',
62
107
  defaultValue?: string,
63
108
  keyboardType?: string,
@@ -145,10 +145,7 @@ export default class Animation {
145
145
  if (value != null) {
146
146
  animatedValue.__onAnimatedValueUpdateReceived(value);
147
147
 
148
- if (
149
- ReactNativeFeatureFlags.shouldSkipStateUpdatesForLoopingAnimations() &&
150
- this.__isLooping === true
151
- ) {
148
+ if (this.__isLooping === true) {
152
149
  return;
153
150
  }
154
151
 
@@ -26,6 +26,7 @@ export function isPlainObject(
26
26
  and ReactElement checks preserve the type refinement of `value`. */
27
27
  ): value is $ReadOnly<{[string]: mixed}> {
28
28
  return (
29
+ // $FlowFixMe[incompatible-type-guard]
29
30
  value !== null &&
30
31
  typeof value === 'object' &&
31
32
  Object.getPrototypeOf(value).isPrototypeOf(Object) &&
@@ -14,17 +14,33 @@ import Platform from '../Utilities/Platform';
14
14
  import {type EventSubscription} from '../vendor/emitter/EventEmitter';
15
15
  import NativeAppState from './NativeAppState';
16
16
 
17
- export type AppStateValues = 'inactive' | 'background' | 'active';
17
+ /**
18
+ * active - The app is running in the foreground
19
+ * background - The app is running in the background. The user is either:
20
+ * - in another app
21
+ * - on the home screen
22
+ * - @platform android - on another Activity (even if it was launched by your app)
23
+ * @platform ios - inactive - This is a state that occurs when transitioning between foreground & background, and during periods of inactivity such as entering the multitasking view, opening the Notification Center or in the event of an incoming call.
24
+ */
25
+ export type AppStateStatus = 'inactive' | 'background' | 'active';
18
26
 
27
+ /**
28
+ * change - This even is received when the app state has changed.
29
+ * memoryWarning - This event is used in the need of throwing memory warning or releasing it.
30
+ * @platform android - focus - Received when the app gains focus (the user is interacting with the app).
31
+ * @platform android - blur - Received when the user is not actively interacting with the app.
32
+ */
19
33
  type AppStateEventDefinitions = {
20
- change: [AppStateValues],
34
+ change: [AppStateStatus],
21
35
  memoryWarning: [],
22
36
  blur: [],
23
37
  focus: [],
24
38
  };
25
39
 
40
+ export type AppStateEvent = $Keys<AppStateEventDefinitions>;
41
+
26
42
  type NativeAppStateEventDefinitions = {
27
- appStateDidChange: [{app_state: AppStateValues}],
43
+ appStateDidChange: [{app_state: AppStateStatus}],
28
44
  appStateFocusChange: [boolean],
29
45
  memoryWarning: [],
30
46
  };
@@ -35,7 +51,7 @@ type NativeAppStateEventDefinitions = {
35
51
  *
36
52
  * See https://reactnative.dev/docs/appstate
37
53
  */
38
- class AppState {
54
+ class AppStateImpl {
39
55
  currentState: ?string = null;
40
56
  isAvailable: boolean;
41
57
 
@@ -89,7 +105,7 @@ class AppState {
89
105
  *
90
106
  * See https://reactnative.dev/docs/appstate#addeventlistener
91
107
  */
92
- addEventListener<K: $Keys<AppStateEventDefinitions>>(
108
+ addEventListener<K: AppStateEvent>(
93
109
  type: K,
94
110
  handler: (...$ElementType<AppStateEventDefinitions, K>) => void,
95
111
  ): EventSubscription {
@@ -100,7 +116,7 @@ class AppState {
100
116
  switch (type) {
101
117
  case 'change':
102
118
  // $FlowIssue[invalid-tuple-arity] Flow cannot refine handler based on the event type
103
- const changeHandler: AppStateValues => void = handler;
119
+ const changeHandler: AppStateStatus => void = handler;
104
120
  return emitter.addListener('appStateDidChange', appStateData => {
105
121
  changeHandler(appStateData.app_state);
106
122
  });
@@ -125,4 +141,5 @@ class AppState {
125
141
  }
126
142
  }
127
143
 
128
- export default (new AppState(): AppState);
144
+ const AppState: AppStateImpl = new AppStateImpl();
145
+ export default AppState;
@@ -11,9 +11,10 @@
11
11
  'use strict';
12
12
 
13
13
  const Systrace = require('../Performance/Systrace');
14
- const deepFreezeAndThrowOnMutationInDev = require('../Utilities/deepFreezeAndThrowOnMutationInDev');
14
+ const deepFreezeAndThrowOnMutationInDev =
15
+ require('../Utilities/deepFreezeAndThrowOnMutationInDev').default;
15
16
  const stringifySafe = require('../Utilities/stringifySafe').default;
16
- const warnOnce = require('../Utilities/warnOnce');
17
+ const warnOnce = require('../Utilities/warnOnce').default;
17
18
  const ErrorUtils = require('../vendor/core/ErrorUtils').default;
18
19
  const invariant = require('invariant');
19
20
 
@@ -187,7 +187,8 @@ if (global.nativeModuleProxy) {
187
187
  '__fbBatchedBridgeConfig is not set, cannot invoke native modules',
188
188
  );
189
189
 
190
- const defineLazyObjectProperty = require('../Utilities/defineLazyObjectProperty');
190
+ const defineLazyObjectProperty =
191
+ require('../Utilities/defineLazyObjectProperty').default;
191
192
  (bridgeConfig.remoteModuleConfig || []).forEach(
192
193
  (config: ModuleConfig, moduleID: number) => {
193
194
  // Initially this config will only contain the module name when running in JSC. The actual
@@ -81,7 +81,7 @@ class Blob {
81
81
  return this._data;
82
82
  }
83
83
 
84
- slice(start?: number, end?: number, contentType: string = ''): Blob {
84
+ slice(start?: number, end?: number, contentType?: string = ''): Blob {
85
85
  const BlobManager = require('./BlobManager').default;
86
86
  let {offset, size} = this.data;
87
87
 
@@ -30,18 +30,18 @@ const READER_EVENTS = [
30
30
  'progress',
31
31
  ];
32
32
 
33
- const EMPTY = 0;
34
- const LOADING = 1;
35
- const DONE = 2;
33
+ const EMPTY = 0 as const;
34
+ const LOADING = 1 as const;
35
+ const DONE = 2 as const;
36
36
 
37
37
  class FileReader extends (EventTarget(...READER_EVENTS): typeof EventTarget) {
38
- static EMPTY: number = EMPTY;
39
- static LOADING: number = LOADING;
40
- static DONE: number = DONE;
38
+ static EMPTY: 0 = EMPTY;
39
+ static LOADING: 1 = LOADING;
40
+ static DONE: 2 = DONE;
41
41
 
42
- EMPTY: number = EMPTY;
43
- LOADING: number = LOADING;
44
- DONE: number = DONE;
42
+ EMPTY: 0 = EMPTY;
43
+ LOADING: 1 = LOADING;
44
+ DONE: 2 = DONE;
45
45
 
46
46
  _readyState: ReadyState;
47
47
  _error: ?Error;
@@ -77,7 +77,7 @@ export class URL {
77
77
  }
78
78
 
79
79
  // $FlowFixMe[missing-local-annot]
80
- constructor(url: string, base: string | URL) {
80
+ constructor(url: string, base?: string | URL) {
81
81
  let baseUrl = null;
82
82
  if (!base || validateBaseUrl(url)) {
83
83
  this._url = url;
@@ -11,9 +11,9 @@
11
11
  // Small subset from whatwg-url: https://github.com/jsdom/whatwg-url/tree/master/src
12
12
  // The reference code bloat comes from Unicode issues with URLs, so those won't work here.
13
13
  export class URLSearchParams {
14
- _searchParams: Array<Array<string>> = [];
14
+ _searchParams: Array<[string, string]> = [];
15
15
 
16
- constructor(params: any) {
16
+ constructor(params?: Record<string, string>) {
17
17
  if (typeof params === 'object') {
18
18
  Object.keys(params).forEach(key => this.append(key, params[key]));
19
19
  }
@@ -23,32 +23,32 @@ export class URLSearchParams {
23
23
  this._searchParams.push([key, value]);
24
24
  }
25
25
 
26
- delete(name: string): void {
26
+ delete(name: string): empty {
27
27
  throw new Error('URLSearchParams.delete is not implemented');
28
28
  }
29
29
 
30
- get(name: string): void {
30
+ get(name: string): empty {
31
31
  throw new Error('URLSearchParams.get is not implemented');
32
32
  }
33
33
 
34
- getAll(name: string): void {
34
+ getAll(name: string): empty {
35
35
  throw new Error('URLSearchParams.getAll is not implemented');
36
36
  }
37
37
 
38
- has(name: string): void {
38
+ has(name: string): empty {
39
39
  throw new Error('URLSearchParams.has is not implemented');
40
40
  }
41
41
 
42
- set(name: string, value: string): void {
42
+ set(name: string, value: string): empty {
43
43
  throw new Error('URLSearchParams.set is not implemented');
44
44
  }
45
45
 
46
- sort(): void {
46
+ sort(): empty {
47
47
  throw new Error('URLSearchParams.sort is not implemented');
48
48
  }
49
49
 
50
50
  // $FlowFixMe[unsupported-syntax]
51
- [Symbol.iterator](): Iterator<Array<string>> {
51
+ [Symbol.iterator](): Iterator<[string, string]> {
52
52
  return this._searchParams[Symbol.iterator]();
53
53
  }
54
54
 
@@ -11,7 +11,7 @@
11
11
  'use strict';
12
12
 
13
13
  import type {TextStyleProp, ViewStyleProp} from '../StyleSheet/StyleSheet';
14
- import type {PressEvent} from '../Types/CoreEventTypes';
14
+ import type {GestureResponderEvent} from '../Types/CoreEventTypes';
15
15
  import type {
16
16
  AccessibilityActionEvent,
17
17
  AccessibilityActionInfo,
@@ -36,9 +36,9 @@ type ButtonProps = $ReadOnly<{
36
36
 
37
37
  /**
38
38
  Handler to be called when the user taps the button. The first function
39
- argument is an event in form of [PressEvent](pressevent).
39
+ argument is an event in form of [GestureResponderEvent](pressevent).
40
40
  */
41
- onPress: (event?: PressEvent) => mixed,
41
+ onPress: (event?: GestureResponderEvent) => mixed,
42
42
 
43
43
  /**
44
44
  If `true`, doesn't play system sound on touch.
@@ -11,7 +11,7 @@
11
11
  'use strict';
12
12
 
13
13
  import type {TextStyleProp, ViewStyleProp} from '../StyleSheet/StyleSheet';
14
- import type {PressEvent} from '../Types/CoreEventTypes';
14
+ import type {GestureResponderEvent} from '../Types/CoreEventTypes';
15
15
  import type {
16
16
  AccessibilityActionEvent,
17
17
  AccessibilityActionInfo,
@@ -37,9 +37,9 @@ type ButtonProps = $ReadOnly<{
37
37
 
38
38
  /**
39
39
  Handler to be called when the user taps the button. The first function
40
- argument is an event in form of [PressEvent](pressevent).
40
+ argument is an event in form of [GestureResponderEvent](pressevent).
41
41
  */
42
- onPress: (event?: PressEvent) => mixed,
42
+ onPress: (event?: GestureResponderEvent) => mixed,
43
43
 
44
44
  /**
45
45
  If `true`, doesn't play system sound on touch.
@@ -362,9 +362,6 @@ const Button: component(
362
362
  const formattedTitle =
363
363
  Platform.OS === 'android' ? title.toUpperCase() : title;
364
364
 
365
- const Touchable =
366
- Platform.OS === 'android' ? TouchableNativeFeedback : TouchableOpacity;
367
-
368
365
  // If `no` is specified for `importantForAccessibility`, it will be changed to `no-hide-descendants` because the text inside should not be focused.
369
366
  const _importantForAccessibility =
370
367
  importantForAccessibility === 'no'
@@ -37,7 +37,7 @@ function LayoutConformance(props: Props): React.Node {
37
37
 
38
38
  function UnimplementedLayoutConformance(props: Props): React.Node {
39
39
  if (__DEV__) {
40
- const warnOnce = require('../../Utilities/warnOnce');
40
+ const warnOnce = require('../../Utilities/warnOnce').default;
41
41
 
42
42
  warnOnce(
43
43
  'layoutconformance-unsupported',
@@ -9,9 +9,9 @@
9
9
  */
10
10
 
11
11
  import type {
12
- LayoutEvent,
12
+ LayoutChangeEvent,
13
13
  MouseEvent,
14
- PressEvent,
14
+ GestureResponderEvent,
15
15
  } from '../../Types/CoreEventTypes';
16
16
  import type {
17
17
  AccessibilityActionEvent,
@@ -126,7 +126,7 @@ type Props = $ReadOnly<{
126
126
  /**
127
127
  * Called when this view's layout changes.
128
128
  */
129
- onLayout?: ?(event: LayoutEvent) => mixed,
129
+ onLayout?: ?(event: LayoutChangeEvent) => mixed,
130
130
 
131
131
  /**
132
132
  * Called when the hover is activated to provide visual feedback.
@@ -141,22 +141,22 @@ type Props = $ReadOnly<{
141
141
  /**
142
142
  * Called when a long-tap gesture is detected.
143
143
  */
144
- onLongPress?: ?(event: PressEvent) => mixed,
144
+ onLongPress?: ?(event: GestureResponderEvent) => mixed,
145
145
 
146
146
  /**
147
147
  * Called when a single tap gesture is detected.
148
148
  */
149
- onPress?: ?(event: PressEvent) => mixed,
149
+ onPress?: ?(event: GestureResponderEvent) => mixed,
150
150
 
151
151
  /**
152
152
  * Called when a touch is engaged before `onPress`.
153
153
  */
154
- onPressIn?: ?(event: PressEvent) => mixed,
154
+ onPressIn?: ?(event: GestureResponderEvent) => mixed,
155
155
 
156
156
  /**
157
157
  * Called when a touch is released before `onPress`.
158
158
  */
159
- onPressOut?: ?(event: PressEvent) => mixed,
159
+ onPressOut?: ?(event: GestureResponderEvent) => mixed,
160
160
 
161
161
  /**
162
162
  * Either view styles or a function that receives a boolean reflecting whether
@@ -299,7 +299,7 @@ function Pressable(
299
299
  onHoverOut,
300
300
  onLongPress,
301
301
  onPress,
302
- onPressIn(event: PressEvent): void {
302
+ onPressIn(event: GestureResponderEvent): void {
303
303
  if (android_rippleConfig != null) {
304
304
  android_rippleConfig.onPressIn(event);
305
305
  }
@@ -309,7 +309,7 @@ function Pressable(
309
309
  }
310
310
  },
311
311
  onPressMove: android_rippleConfig?.onPressMove,
312
- onPressOut(event: PressEvent): void {
312
+ onPressOut(event: GestureResponderEvent): void {
313
313
  if (android_rippleConfig != null) {
314
314
  android_rippleConfig.onPressOut(event);
315
315
  }