@office-iss/react-native-win32 0.69.0 → 0.70.0

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 (157) hide show
  1. package/.eslintrc.js +0 -1
  2. package/.flowconfig +5 -1
  3. package/CHANGELOG.json +241 -31
  4. package/CHANGELOG.md +97 -18
  5. package/IntegrationTests/AsyncStorageTest.js +20 -4
  6. package/IntegrationTests/BUCK +2 -2
  7. package/IntegrationTests/LayoutEventsTest.js +4 -1
  8. package/IntegrationTests/{launchWebSocketServer.command → launchWebSocketServer.sh} +3 -9
  9. package/Libraries/Alert/Alert.js +18 -4
  10. package/Libraries/Alert/Alert.win32.js +2 -0
  11. package/Libraries/Alert/NativeAlertManager.js +1 -0
  12. package/Libraries/Animated/Animated.js +2 -2
  13. package/Libraries/Animated/AnimatedEvent.js +7 -4
  14. package/Libraries/Animated/AnimatedImplementation.js +17 -3
  15. package/Libraries/Animated/AnimatedMock.js +7 -2
  16. package/Libraries/Animated/NativeAnimatedHelper.js +220 -95
  17. package/Libraries/Animated/NativeAnimatedModule.js +3 -0
  18. package/Libraries/Animated/NativeAnimatedTurboModule.js +3 -0
  19. package/Libraries/Animated/animations/SpringAnimation.js +3 -3
  20. package/Libraries/Animated/animations/TimingAnimation.js +3 -3
  21. package/Libraries/Animated/createAnimatedComponent.js +8 -1
  22. package/Libraries/Animated/nodes/AnimatedAddition.js +3 -1
  23. package/Libraries/Animated/nodes/AnimatedColor.js +50 -29
  24. package/Libraries/Animated/nodes/AnimatedDiffClamp.js +3 -1
  25. package/Libraries/Animated/nodes/AnimatedDivision.js +3 -1
  26. package/Libraries/Animated/nodes/AnimatedInterpolation.js +22 -21
  27. package/Libraries/Animated/nodes/AnimatedModulo.js +3 -1
  28. package/Libraries/Animated/nodes/AnimatedMultiplication.js +3 -2
  29. package/Libraries/Animated/nodes/AnimatedProps.js +20 -12
  30. package/Libraries/Animated/nodes/AnimatedStyle.js +19 -16
  31. package/Libraries/Animated/nodes/AnimatedSubtraction.js +3 -1
  32. package/Libraries/Animated/nodes/AnimatedTransform.js +5 -5
  33. package/Libraries/Animated/nodes/AnimatedValue.js +14 -5
  34. package/Libraries/Animated/nodes/AnimatedValueXY.js +28 -1
  35. package/Libraries/Animated/useAnimatedProps.js +1 -0
  36. package/Libraries/AppState/AppState.js +0 -32
  37. package/Libraries/BatchedBridge/MessageQueue.js +21 -15
  38. package/Libraries/BatchedBridge/NativeModules.js +3 -4
  39. package/Libraries/Blob/FileReader.js +0 -6
  40. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +0 -20
  41. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +0 -20
  42. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -0
  43. package/Libraries/Components/Keyboard/Keyboard.js +0 -11
  44. package/Libraries/Components/Pressable/Pressable.js +2 -0
  45. package/Libraries/Components/Pressable/Pressable.win32.js +2 -0
  46. package/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js +1 -3
  47. package/Libraries/Components/SafeAreaView/SafeAreaView.js +3 -30
  48. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +4 -32
  49. package/Libraries/Components/ScrollView/ScrollView.js +13 -11
  50. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +5 -3
  51. package/Libraries/Components/StatusBar/StatusBar.js +10 -7
  52. package/Libraries/Components/TextInput/InputAccessoryView.js +14 -13
  53. package/Libraries/Components/TextInput/TextInput.js +12 -2
  54. package/Libraries/Components/Touchable/PooledClass.js +16 -4
  55. package/Libraries/Components/Touchable/Touchable.js +50 -1
  56. package/Libraries/Components/Touchable/Touchable.win32.js +972 -0
  57. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +6 -2
  58. package/Libraries/Components/View/ReactNativeStyleAttributes.js +0 -7
  59. package/Libraries/Components/View/ViewPropTypes.js +3 -8
  60. package/Libraries/Components/View/ViewPropTypes.win32.js +3 -8
  61. package/Libraries/Components/View/ViewWin32.Props.d.ts +1 -1
  62. package/Libraries/Components/View/ViewWin32.Props.js.map +1 -1
  63. package/Libraries/Core/ExceptionsManager.js +2 -0
  64. package/Libraries/Core/ReactNativeVersion.js +1 -1
  65. package/Libraries/Core/Timers/JSTimers.js +2 -2
  66. package/Libraries/Core/polyfillPromise.js +0 -32
  67. package/Libraries/Core/setUpBatchedBridge.js +5 -1
  68. package/Libraries/Core/setUpPerformance.js +1 -1
  69. package/Libraries/EventEmitter/NativeEventEmitter.js +0 -13
  70. package/Libraries/Image/AssetSourceResolver.js +2 -2
  71. package/Libraries/Image/Image.android.js +5 -3
  72. package/Libraries/Image/Image.ios.js +6 -3
  73. package/Libraries/Image/Image.win32.js +6 -3
  74. package/Libraries/Image/ImageSource.js +7 -5
  75. package/Libraries/Inspector/ElementBox.js +2 -2
  76. package/Libraries/Inspector/NetworkOverlay.js +13 -8
  77. package/Libraries/Interaction/PanResponder.js +16 -14
  78. package/Libraries/Linking/Linking.js +0 -11
  79. package/Libraries/Lists/FlatList.js +3 -2
  80. package/Libraries/Lists/SectionList.js +2 -0
  81. package/Libraries/Lists/ViewabilityHelper.js +7 -3
  82. package/Libraries/Lists/VirtualizeUtils.js +33 -20
  83. package/Libraries/Lists/VirtualizedList.js +93 -47
  84. package/Libraries/Lists/VirtualizedListContext.js +1 -0
  85. package/Libraries/Lists/VirtualizedSectionList.js +14 -9
  86. package/Libraries/Lists/__tests__/VirtualizeUtils-test.js +19 -18
  87. package/Libraries/Lists/__tests__/VirtualizedList-test.js +10 -6
  88. package/Libraries/LogBox/Data/LogBoxData.js +1 -1
  89. package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
  90. package/Libraries/LogBox/LogBox.js +3 -1
  91. package/Libraries/LogBox/UI/AnsiHighlight.js +2 -0
  92. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +3 -0
  93. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +0 -3
  94. package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +8 -3
  95. package/Libraries/NativeComponent/BaseViewConfig.android.js +9 -18
  96. package/Libraries/NativeComponent/BaseViewConfig.ios.js +26 -12
  97. package/Libraries/NativeComponent/BaseViewConfig.win32.js +26 -12
  98. package/Libraries/Network/XMLHttpRequest.js +9 -11
  99. package/Libraries/Performance/PureComponentDebug.js +1 -0
  100. package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +9 -1
  101. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +16 -0
  102. package/Libraries/Pressability/Pressability.js +26 -16
  103. package/Libraries/Pressability/Pressability.win32.js +26 -16
  104. package/Libraries/Promise.js +0 -1
  105. package/Libraries/ReactNative/AppRegistry.js +16 -13
  106. package/Libraries/ReactNative/BridgelessUIManager.js +2 -0
  107. package/Libraries/ReactNative/PaperUIManager.js +9 -9
  108. package/Libraries/ReactNative/PaperUIManager.win32.js +7 -8
  109. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +12 -0
  110. package/Libraries/ReactNative/ReactNativeRuntimeDiagnostics.js +68 -0
  111. package/Libraries/ReactNative/getNativeComponentAttributes.js +6 -7
  112. package/Libraries/ReactNative/renderApplication.js +1 -1
  113. package/Libraries/Renderer/implementations/ReactFabric-dev.js +4443 -3615
  114. package/Libraries/Renderer/implementations/ReactFabric-prod.js +1496 -1170
  115. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +1694 -1356
  116. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +4439 -3588
  117. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +1583 -1249
  118. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +1719 -1372
  119. package/Libraries/Storage/AsyncStorage.js +7 -1
  120. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +8 -0
  121. package/Libraries/StyleSheet/flattenStyle.js +1 -1
  122. package/Libraries/StyleSheet/processTransform.js +2 -0
  123. package/Libraries/StyleSheet/splitLayoutProps.js +2 -0
  124. package/Libraries/Text/Text.js +15 -7
  125. package/Libraries/Types/CoreEventTypes.js +137 -11
  126. package/Libraries/Types/CoreEventTypes.win32.js +147 -22
  127. package/Libraries/Utilities/Dimensions.js +0 -13
  128. package/Libraries/Utilities/Dimensions.win32.js +0 -9
  129. package/Libraries/Utilities/HMRClient.js +3 -3
  130. package/Libraries/Utilities/Platform.ios.js +0 -7
  131. package/Libraries/Utilities/ReactNativeTestTools.js +3 -1
  132. package/Libraries/Utilities/codegenNativeCommands.js +11 -2
  133. package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +2 -0
  134. package/Libraries/Utilities/stringifySafe.js +3 -1
  135. package/Libraries/Utilities/truncate.js +1 -1
  136. package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +2 -2
  137. package/Libraries/Vibration/Vibration.js +1 -1
  138. package/Libraries/WebSocket/WebSocket.js +1 -0
  139. package/Libraries/vendor/emitter/EventEmitter.js +105 -12
  140. package/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +73 -117
  141. package/flow/JSITimerInternalType.js +30 -0
  142. package/jest/assetFileTransformer.js +3 -2
  143. package/jest/setup.js +4 -0
  144. package/jest.config.js +0 -1
  145. package/overrides.json +23 -16
  146. package/package.json +21 -22
  147. package/rntypes/index.d.ts +0 -1
  148. package/src/Libraries/Components/View/ViewWin32.Props.ts +2 -1
  149. package/src/rntypes/index.d.ts +0 -1
  150. package/Libraries/vendor/emitter/EventSubscription.js +0 -19
  151. package/Libraries/vendor/emitter/_EmitterSubscription.js +0 -62
  152. package/Libraries/vendor/emitter/_EventEmitter.js +0 -184
  153. package/Libraries/vendor/emitter/_EventSubscription.js +0 -45
  154. package/Libraries/vendor/emitter/_EventSubscriptionVendor.js +0 -108
  155. package/jest/preprocessor.js +0 -40
  156. package/jest/preprocessor_DO_NOT_USE.js +0 -122
  157. package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizeUtils-test.js.snap +0 -3
@@ -8,16 +8,16 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import type {RootTag} from 'react-native/Libraries/Types/RootTagTypes';
12
+
13
+ import NativeUIManager from './NativeUIManager';
14
+
11
15
  const NativeModules = require('../BatchedBridge/NativeModules');
16
+ const defineLazyObjectProperty = require('../Utilities/defineLazyObjectProperty');
12
17
  const Platform = require('../Utilities/Platform');
13
18
  const UIManagerProperties = require('./UIManagerProperties');
14
19
 
15
- const defineLazyObjectProperty = require('../Utilities/defineLazyObjectProperty');
16
-
17
- import NativeUIManager from './NativeUIManager';
18
- import type {RootTag} from 'react-native/Libraries/Types/RootTagTypes';
19
-
20
- const viewManagerConfigs = {};
20
+ const viewManagerConfigs: {[string]: any | null} = {};
21
21
 
22
22
  const triedLoadingConfig = new Set();
23
23
 
@@ -114,14 +114,14 @@ const UIManagerJS = {
114
114
  // $FlowFixMe[prop-missing]
115
115
  NativeUIManager.getViewManagerConfig = UIManagerJS.getViewManagerConfig;
116
116
 
117
- function lazifyViewManagerConfig(viewName) {
117
+ function lazifyViewManagerConfig(viewName: string) {
118
118
  const viewConfig = getConstants()[viewName];
119
119
  viewManagerConfigs[viewName] = viewConfig;
120
120
  if (viewConfig.Manager) {
121
121
  defineLazyObjectProperty(viewConfig, 'Constants', {
122
122
  get: () => {
123
123
  const viewManager = NativeModules[viewConfig.Manager];
124
- const constants = {};
124
+ const constants: {[string]: mixed} = {};
125
125
  viewManager &&
126
126
  Object.keys(viewManager).forEach(key => {
127
127
  const value = viewManager[key];
@@ -135,7 +135,7 @@ function lazifyViewManagerConfig(viewName) {
135
135
  defineLazyObjectProperty(viewConfig, 'Commands', {
136
136
  get: () => {
137
137
  const viewManager = NativeModules[viewConfig.Manager];
138
- const commands = {};
138
+ const commands: {[string]: number} = {};
139
139
  let index = 0;
140
140
  viewManager &&
141
141
  Object.keys(viewManager).forEach(key => {
@@ -9,15 +9,14 @@
9
9
  */
10
10
 
11
11
  const NativeModules = require('../BatchedBridge/NativeModules');
12
+ const defineLazyObjectProperty = require('../Utilities/defineLazyObjectProperty');
12
13
  const Platform = require('../Utilities/Platform');
13
14
  const UIManagerProperties = require('./UIManagerProperties');
14
15
 
15
- const defineLazyObjectProperty = require('../Utilities/defineLazyObjectProperty');
16
-
17
16
  import NativeUIManager from './NativeUIManager';
18
17
  // import type {RootTag} from 'react-native/Libraries/Types/RootTagTypes'; [Windows]
19
18
 
20
- const viewManagerConfigs = {};
19
+ const viewManagerConfigs: {[string]: any | null} = {};
21
20
 
22
21
  const triedLoadingConfig = new Set();
23
22
 
@@ -97,7 +96,7 @@ UIManagerJS.getConstants = getConstants;
97
96
  // },
98
97
  // $FlowFixMe
99
98
  UIManagerJS.getViewManagerConfig = getViewManagerConfig;
100
-
99
+ // $FlowFixMe
101
100
  UIManagerJS.hasViewManagerConfig = (viewManagerName: string) =>
102
101
  getViewManagerConfig(viewManagerName) != null;
103
102
 
@@ -114,14 +113,14 @@ if (!global.nativeCallSyncHook)
114
113
  // $FlowFixMe
115
114
  NativeUIManager.getViewManagerConfig = UIManagerJS.getViewManagerConfig;
116
115
 
117
- function lazifyViewManagerConfig(viewName) {
116
+ function lazifyViewManagerConfig(viewName: string) {
118
117
  const viewConfig = getConstants()[viewName];
119
118
  viewManagerConfigs[viewName] = viewConfig;
120
119
  if (viewConfig.Manager) {
121
120
  defineLazyObjectProperty(viewConfig, 'Constants', {
122
121
  get: () => {
123
122
  const viewManager = NativeModules[viewConfig.Manager];
124
- const constants = {};
123
+ const constants: {[string]: mixed} = {};
125
124
  viewManager &&
126
125
  Object.keys(viewManager).forEach(key => {
127
126
  const value = viewManager[key];
@@ -135,7 +134,7 @@ function lazifyViewManagerConfig(viewName) {
135
134
  defineLazyObjectProperty(viewConfig, 'Commands', {
136
135
  get: () => {
137
136
  const viewManager = NativeModules[viewConfig.Manager];
138
- const commands = {};
137
+ const commands: {[string]: number} = {};
139
138
  let index = 0;
140
139
  viewManager &&
141
140
  Object.keys(viewManager).forEach(key => {
@@ -179,7 +178,7 @@ if (!global.nativeCallSyncHook) {
179
178
  `Accessing view manager configs directly off UIManager via UIManager['${viewManagerName}'] ` +
180
179
  `is no longer supported. Use UIManager.getViewManagerConfig('${viewManagerName}') instead.`,
181
180
  );
182
-
181
+ // $FlowFixMe
183
182
  return UIManagerJS.getViewManagerConfig(viewManagerName);
184
183
  },
185
184
  });
@@ -28,12 +28,24 @@ export type FeatureFlags = {|
28
28
  * for its hover callbacks
29
29
  */
30
30
  shouldPressibilityUseW3CPointerEventsForHover: () => boolean,
31
+ /**
32
+ * Enables an experimental flush-queue debouncing in Animated.js.
33
+ */
34
+ animatedShouldDebounceQueueFlush: () => boolean,
35
+ /**
36
+ * Enables an experimental mega-operation for Animated.js that replaces
37
+ * many calls to native with a single call into native, to reduce JSI/JNI
38
+ * traffic.
39
+ */
40
+ animatedShouldUseSingleOp: () => boolean,
31
41
  |};
32
42
 
33
43
  const ReactNativeFeatureFlags: FeatureFlags = {
34
44
  isLayoutAnimationEnabled: () => true,
35
45
  shouldEmitW3CPointerEvents: () => false,
36
46
  shouldPressibilityUseW3CPointerEventsForHover: () => false,
47
+ animatedShouldDebounceQueueFlush: () => false,
48
+ animatedShouldUseSingleOp: () => false,
37
49
  };
38
50
 
39
51
  module.exports = ReactNativeFeatureFlags;
@@ -0,0 +1,68 @@
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
+ /**
14
+ * Perform a set of runtime diagnostics, usually useful for test purpose.
15
+ * This is only meaningful for __DEV__ mode.
16
+ */
17
+ export type RuntimeDiagnostics = {|
18
+ /**
19
+ * Check if the runtime diagnostics is enabled at all.
20
+ */
21
+ isEnabled: () => boolean,
22
+
23
+ /**
24
+ * If enabled, simulate early JavaScript errors during initialization.
25
+ */
26
+ simulateEarlyJavaScriptErrors: () => void,
27
+ |};
28
+
29
+ export type RuntimeDiagnosticFlag = 'early_js_errors' | 'all';
30
+
31
+ const flags: Array<RuntimeDiagnosticFlag> = [];
32
+ let isEnabled = false;
33
+ let shouldEnableAll = false;
34
+
35
+ if (__DEV__) {
36
+ if (typeof global.RN$DiagnosticFlags === 'string') {
37
+ global.RN$DiagnosticFlags.split(',').forEach(flag => {
38
+ switch (flag) {
39
+ case 'early_js_errors':
40
+ case 'all':
41
+ flags.push(flag);
42
+ break;
43
+ default:
44
+ throw Error(
45
+ `RuntimeDiagnosticsFlags: unknown flag was supplied: '${flag}'`,
46
+ );
47
+ }
48
+ });
49
+ isEnabled = flags.length > 0;
50
+ shouldEnableAll = flags.includes('all');
51
+ }
52
+ }
53
+
54
+ const ReactNativeRuntimeDiagnostics: RuntimeDiagnostics = {
55
+ isEnabled: () => isEnabled,
56
+ simulateEarlyJavaScriptErrors: () => {
57
+ if (__DEV__) {
58
+ if (!isEnabled) {
59
+ return;
60
+ }
61
+ if (shouldEnableAll || flags.includes('early_js_errors')) {
62
+ throw Error('[Runtime Diagnostics] Throwing a JavaScript error.');
63
+ }
64
+ }
65
+ },
66
+ };
67
+
68
+ module.exports = ReactNativeRuntimeDiagnostics;
@@ -11,16 +11,15 @@
11
11
  'use strict';
12
12
 
13
13
  const ReactNativeStyleAttributes = require('../Components/View/ReactNativeStyleAttributes');
14
- const UIManager = require('./UIManager');
15
-
14
+ const resolveAssetSource = require('../Image/resolveAssetSource');
15
+ const processColor = require('../StyleSheet/processColor');
16
+ const processColorArray = require('../StyleSheet/processColorArray');
16
17
  const insetsDiffer = require('../Utilities/differ/insetsDiffer');
17
- const invariant = require('invariant');
18
18
  const matricesDiffer = require('../Utilities/differ/matricesDiffer');
19
19
  const pointsDiffer = require('../Utilities/differ/pointsDiffer');
20
- const processColor = require('../StyleSheet/processColor');
21
- const processColorArray = require('../StyleSheet/processColorArray');
22
- const resolveAssetSource = require('../Image/resolveAssetSource');
23
20
  const sizesDiffer = require('../Utilities/differ/sizesDiffer');
21
+ const UIManager = require('./UIManager');
22
+ const invariant = require('invariant');
24
23
 
25
24
  function getNativeComponentAttributes(uiViewClassName: string): any {
26
25
  const viewConfig = UIManager.getViewManagerConfig(uiViewClassName);
@@ -60,7 +59,7 @@ function getNativeComponentAttributes(uiViewClassName: string): any {
60
59
  }
61
60
  }
62
61
 
63
- const validAttributes = {};
62
+ const validAttributes: {[string]: mixed} = {};
64
63
 
65
64
  for (const key in nativeProps) {
66
65
  const typeName = nativeProps[key];
@@ -38,7 +38,7 @@ function renderApplication<Props: Object>(
38
38
 
39
39
  const performanceLogger = scopedPerformanceLogger ?? GlobalPerformanceLogger;
40
40
 
41
- let renderable = (
41
+ let renderable: React.MixedElement = (
42
42
  <PerformanceLoggerContext.Provider value={performanceLogger}>
43
43
  <AppContainer
44
44
  rootTag={rootTag}