@office-iss/react-native-win32 0.69.0 → 0.70.0-preview.1

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 (154) hide show
  1. package/.eslintrc.js +0 -1
  2. package/.flowconfig +5 -1
  3. package/CHANGELOG.json +194 -32
  4. package/CHANGELOG.md +79 -19
  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/Core/ExceptionsManager.js +2 -0
  62. package/Libraries/Core/ReactNativeVersion.js +2 -2
  63. package/Libraries/Core/Timers/JSTimers.js +2 -2
  64. package/Libraries/Core/polyfillPromise.js +0 -32
  65. package/Libraries/Core/setUpBatchedBridge.js +5 -1
  66. package/Libraries/Core/setUpPerformance.js +1 -1
  67. package/Libraries/EventEmitter/NativeEventEmitter.js +0 -13
  68. package/Libraries/Image/AssetSourceResolver.js +2 -2
  69. package/Libraries/Image/Image.android.js +5 -3
  70. package/Libraries/Image/Image.ios.js +6 -3
  71. package/Libraries/Image/Image.win32.js +6 -3
  72. package/Libraries/Image/ImageSource.js +7 -5
  73. package/Libraries/Inspector/ElementBox.js +2 -2
  74. package/Libraries/Inspector/NetworkOverlay.js +13 -8
  75. package/Libraries/Interaction/PanResponder.js +16 -14
  76. package/Libraries/Linking/Linking.js +0 -11
  77. package/Libraries/Lists/FlatList.js +3 -2
  78. package/Libraries/Lists/SectionList.js +2 -0
  79. package/Libraries/Lists/ViewabilityHelper.js +7 -3
  80. package/Libraries/Lists/VirtualizeUtils.js +33 -20
  81. package/Libraries/Lists/VirtualizedList.js +93 -47
  82. package/Libraries/Lists/VirtualizedListContext.js +1 -0
  83. package/Libraries/Lists/VirtualizedSectionList.js +14 -9
  84. package/Libraries/Lists/__tests__/VirtualizeUtils-test.js +19 -18
  85. package/Libraries/Lists/__tests__/VirtualizedList-test.js +10 -6
  86. package/Libraries/LogBox/Data/LogBoxData.js +1 -1
  87. package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
  88. package/Libraries/LogBox/LogBox.js +3 -1
  89. package/Libraries/LogBox/UI/AnsiHighlight.js +2 -0
  90. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +3 -0
  91. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +0 -3
  92. package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +8 -3
  93. package/Libraries/NativeComponent/BaseViewConfig.android.js +9 -18
  94. package/Libraries/NativeComponent/BaseViewConfig.ios.js +26 -12
  95. package/Libraries/NativeComponent/BaseViewConfig.win32.js +26 -12
  96. package/Libraries/Network/XMLHttpRequest.js +9 -11
  97. package/Libraries/Performance/PureComponentDebug.js +1 -0
  98. package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +9 -1
  99. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +16 -0
  100. package/Libraries/Pressability/Pressability.js +26 -16
  101. package/Libraries/Pressability/Pressability.win32.js +26 -16
  102. package/Libraries/Promise.js +0 -1
  103. package/Libraries/ReactNative/AppRegistry.js +16 -13
  104. package/Libraries/ReactNative/BridgelessUIManager.js +2 -0
  105. package/Libraries/ReactNative/PaperUIManager.js +9 -9
  106. package/Libraries/ReactNative/PaperUIManager.win32.js +7 -8
  107. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +12 -0
  108. package/Libraries/ReactNative/ReactNativeRuntimeDiagnostics.js +68 -0
  109. package/Libraries/ReactNative/getNativeComponentAttributes.js +6 -7
  110. package/Libraries/ReactNative/renderApplication.js +1 -1
  111. package/Libraries/Renderer/implementations/ReactFabric-dev.js +4443 -3615
  112. package/Libraries/Renderer/implementations/ReactFabric-prod.js +1496 -1170
  113. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +1694 -1356
  114. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +4439 -3588
  115. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +1583 -1249
  116. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +1719 -1372
  117. package/Libraries/Storage/AsyncStorage.js +7 -1
  118. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +8 -0
  119. package/Libraries/StyleSheet/flattenStyle.js +1 -1
  120. package/Libraries/StyleSheet/processTransform.js +2 -0
  121. package/Libraries/StyleSheet/splitLayoutProps.js +2 -0
  122. package/Libraries/Text/Text.js +15 -7
  123. package/Libraries/Types/CoreEventTypes.js +137 -11
  124. package/Libraries/Types/CoreEventTypes.win32.js +147 -22
  125. package/Libraries/Utilities/Dimensions.js +0 -13
  126. package/Libraries/Utilities/Dimensions.win32.js +0 -9
  127. package/Libraries/Utilities/HMRClient.js +3 -3
  128. package/Libraries/Utilities/Platform.ios.js +0 -7
  129. package/Libraries/Utilities/ReactNativeTestTools.js +3 -1
  130. package/Libraries/Utilities/codegenNativeCommands.js +11 -2
  131. package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +2 -0
  132. package/Libraries/Utilities/stringifySafe.js +3 -1
  133. package/Libraries/Utilities/truncate.js +1 -1
  134. package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +2 -2
  135. package/Libraries/Vibration/Vibration.js +1 -1
  136. package/Libraries/WebSocket/WebSocket.js +1 -0
  137. package/Libraries/vendor/emitter/EventEmitter.js +105 -12
  138. package/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +73 -117
  139. package/flow/JSITimerInternalType.js +30 -0
  140. package/jest/assetFileTransformer.js +3 -2
  141. package/jest/setup.js +4 -0
  142. package/jest.config.js +0 -1
  143. package/overrides.json +23 -16
  144. package/package.json +23 -24
  145. package/rntypes/index.d.ts +0 -1
  146. package/src/rntypes/index.d.ts +0 -1
  147. package/Libraries/vendor/emitter/EventSubscription.js +0 -19
  148. package/Libraries/vendor/emitter/_EmitterSubscription.js +0 -62
  149. package/Libraries/vendor/emitter/_EventEmitter.js +0 -184
  150. package/Libraries/vendor/emitter/_EventSubscription.js +0 -45
  151. package/Libraries/vendor/emitter/_EventSubscriptionVendor.js +0 -108
  152. package/jest/preprocessor.js +0 -40
  153. package/jest/preprocessor_DO_NOT_USE.js +0 -122
  154. package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizeUtils-test.js.snap +0 -3
@@ -40,7 +40,7 @@ function vibrateByPattern(pattern: Array<number>, repeat: boolean = false) {
40
40
  }
41
41
 
42
42
  function vibrateScheduler(
43
- id,
43
+ id: number,
44
44
  pattern: Array<number>,
45
45
  repeat: boolean,
46
46
  nextIndex: number,
@@ -104,6 +104,7 @@ class WebSocket extends (EventTarget(...WEBSOCKET_EVENTS): any) {
104
104
  const {headers = {}, ...unrecognized} = options || {};
105
105
 
106
106
  // Preserve deprecated backwards compatibility for the 'origin' option
107
+ // $FlowFixMe[prop-missing]
107
108
  if (unrecognized && typeof unrecognized.origin === 'string') {
108
109
  console.warn(
109
110
  'Specifying `origin` as a WebSocket connection option is deprecated. Include it under `headers` instead.',
@@ -8,20 +8,63 @@
8
8
  * @format
9
9
  */
10
10
 
11
- 'use strict';
11
+ export interface EventSubscription {
12
+ remove(): void;
13
+ }
14
+
15
+ export interface IEventEmitter<TEventToArgsMap: {...}> {
16
+ addListener<TEvent: $Keys<TEventToArgsMap>>(
17
+ eventType: TEvent,
18
+ listener: (...args: $ElementType<TEventToArgsMap, TEvent>) => mixed,
19
+ context?: mixed,
20
+ ): EventSubscription;
12
21
 
13
- const EventEmitter = require('./_EventEmitter');
22
+ emit<TEvent: $Keys<TEventToArgsMap>>(
23
+ eventType: TEvent,
24
+ ...args: $ElementType<TEventToArgsMap, TEvent>
25
+ ): void;
14
26
 
15
- import type {EventSubscription} from './EventSubscription';
27
+ removeAllListeners<TEvent: $Keys<TEventToArgsMap>>(eventType?: ?TEvent): void;
28
+
29
+ listenerCount<TEvent: $Keys<TEventToArgsMap>>(eventType: TEvent): number;
30
+ }
16
31
 
17
- export default EventEmitter;
32
+ interface Registration<TArgs> {
33
+ +context: mixed;
34
+ +listener: (...args: TArgs) => mixed;
35
+ +remove: () => void;
36
+ }
18
37
 
19
- export type {EventSubscription};
38
+ type Registry<TEventToArgsMap: {...}> = $ObjMap<
39
+ TEventToArgsMap,
40
+ <TArgs>(TArgs) => Set<Registration<TArgs>>,
41
+ >;
20
42
 
21
43
  /**
22
- * Essential interface for an EventEmitter.
44
+ * EventEmitter manages listeners and publishes events to them.
45
+ *
46
+ * EventEmitter accepts a single type parameter that defines the valid events
47
+ * and associated listener argument(s).
48
+ *
49
+ * @example
50
+ *
51
+ * const emitter = new EventEmitter<{
52
+ * success: [number, string],
53
+ * error: [Error],
54
+ * }>();
55
+ *
56
+ * emitter.on('success', (statusCode, responseText) => {...});
57
+ * emitter.emit('success', 200, '...');
58
+ *
59
+ * emitter.on('error', error => {...});
60
+ * emitter.emit('error', new Error('Resource not found'));
61
+ *
23
62
  */
24
- export interface IEventEmitter<TEventToArgsMap: {...}> {
63
+ export default class EventEmitter<TEventToArgsMap: {...}>
64
+ implements IEventEmitter<TEventToArgsMap>
65
+ {
66
+ _registry: Registry<TEventToArgsMap> = {};
67
+
25
68
  /**
26
69
  * Registers a listener that is called when the supplied event is emitted.
27
70
  * Returns a subscription that has a `remove` method to undo registration.
@@ -29,25 +72,75 @@ export interface IEventEmitter<TEventToArgsMap: {...}> {
29
72
  addListener<TEvent: $Keys<TEventToArgsMap>>(
30
73
  eventType: TEvent,
31
74
  listener: (...args: $ElementType<TEventToArgsMap, TEvent>) => mixed,
32
- context?: mixed,
33
- ): EventSubscription;
75
+ context: mixed,
76
+ ): EventSubscription {
77
+ const registrations = allocate(this._registry, eventType);
78
+ const registration: Registration<$ElementType<TEventToArgsMap, TEvent>> = {
79
+ context,
80
+ listener,
81
+ remove(): void {
82
+ registrations.delete(registration);
83
+ },
84
+ };
85
+ registrations.add(registration);
86
+ return registration;
87
+ }
34
88
 
35
89
  /**
36
90
  * Emits the supplied event. Additional arguments supplied to `emit` will be
37
91
  * passed through to each of the registered listeners.
92
+ *
93
+ * If a listener modifies the listeners registered for the same event, those
94
+ * changes will not be reflected in the current invocation of `emit`.
38
95
  */
39
96
  emit<TEvent: $Keys<TEventToArgsMap>>(
40
97
  eventType: TEvent,
41
98
  ...args: $ElementType<TEventToArgsMap, TEvent>
42
- ): void;
99
+ ): void {
100
+ const registrations: ?Set<
101
+ Registration<$ElementType<TEventToArgsMap, TEvent>>,
102
+ > = this._registry[eventType];
103
+ if (registrations != null) {
104
+ for (const registration of [...registrations]) {
105
+ registration.listener.apply(registration.context, args);
106
+ }
107
+ }
108
+ }
43
109
 
44
110
  /**
45
111
  * Removes all registered listeners.
46
112
  */
47
- removeAllListeners<TEvent: $Keys<TEventToArgsMap>>(eventType?: ?TEvent): void;
113
+ removeAllListeners<TEvent: $Keys<TEventToArgsMap>>(
114
+ eventType?: ?TEvent,
115
+ ): void {
116
+ if (eventType == null) {
117
+ this._registry = {};
118
+ } else {
119
+ delete this._registry[eventType];
120
+ }
121
+ }
48
122
 
49
123
  /**
50
124
  * Returns the number of registered listeners for the supplied event.
51
125
  */
52
- listenerCount<TEvent: $Keys<TEventToArgsMap>>(eventType: TEvent): number;
126
+ listenerCount<TEvent: $Keys<TEventToArgsMap>>(eventType: TEvent): number {
127
+ const registrations: ?Set<Registration<mixed>> = this._registry[eventType];
128
+ return registrations == null ? 0 : registrations.size;
129
+ }
130
+ }
131
+
132
+ function allocate<
133
+ TEventToArgsMap: {...},
134
+ TEvent: $Keys<TEventToArgsMap>,
135
+ TEventArgs: $ElementType<TEventToArgsMap, TEvent>,
136
+ >(
137
+ registry: Registry<TEventToArgsMap>,
138
+ eventType: TEvent,
139
+ ): Set<Registration<TEventArgs>> {
140
+ let registrations: ?Set<Registration<TEventArgs>> = registry[eventType];
141
+ if (registrations == null) {
142
+ registrations = new Set();
143
+ registry[eventType] = registrations;
144
+ }
145
+ return registrations;
53
146
  }
@@ -1,5 +1,8 @@
1
1
  /**
2
- * (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
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.
3
6
  *
4
7
  * @flow strict
5
8
  * @format
@@ -7,119 +10,72 @@
7
10
 
8
11
  import EventEmitter from '../EventEmitter';
9
12
 
10
- type MyEvents = {
11
- noArgsEvent: [],
12
- stringEvent: [string],
13
- numberEvent: [number],
14
- anotherNumberEvent: [number],
15
- objectAndBooleanEvent: [{prop: string}, boolean],
16
- };
17
-
18
- export function testBaseEventEmitterInstance() {
19
- const emitter = new EventEmitter<MyEvents>();
20
-
21
- emitter.addListener('noArgsEvent', expectedUndefined => {
22
- (expectedUndefined: void);
23
- });
24
-
25
- emitter.addListener('stringEvent', expectedString => {
26
- (expectedString: string);
27
- });
28
-
29
- emitter.addListener('numberEvent', expectedNumber => {
30
- (expectedNumber: number);
31
- });
32
-
33
- emitter.addListener('anotherNumberEvent', expectedNumber => {
34
- (expectedNumber: number);
35
- });
36
-
37
- emitter.addListener(
38
- 'objectAndBooleanEvent',
39
- (expectedObject, expectedBoolean, unexpectedArg) => {
40
- (expectedObject: {prop: string});
41
- (expectedBoolean: boolean);
42
- (unexpectedArg: void);
43
- },
44
- );
45
-
46
- // $FlowExpectedError[prop-missing]
47
- emitter.addListener('unexpectedEvent', () => {});
48
-
49
- // $FlowExpectedError[incompatible-call]
50
- emitter.addListener('noArgsEvent', (value: number) => {});
51
-
52
- // $FlowExpectedError[incompatible-call]
53
- emitter.addListener('numberEvent', (value: string) => {});
54
-
55
- emitter.emit('noArgsEvent');
56
- emitter.emit('stringEvent', 'value');
57
- emitter.emit('numberEvent', 4);
58
- emitter.emit('anotherNumberEvent', 4);
59
- emitter.emit('objectAndBooleanEvent', {prop: 'value'}, true);
60
- }
61
-
62
- export function testSubclass() {
63
- // $FlowExpectedError[incompatible-type-arg]
64
- class EmitterWithUndefinedDefinition extends EventEmitter<void> {}
65
-
66
- // $FlowExpectedError[incompatible-type-arg]
67
- class EmitterWithNumberDefinition extends EventEmitter<number> {}
68
-
69
- class EmitterWithInvalidDefinitions extends EventEmitter<{
70
- foo: number,
71
- }> {}
72
-
73
- const emitter = new EmitterWithInvalidDefinitions();
74
- // $FlowExpectedError[not-an-array]
75
- // $FlowExpectedError[incompatible-call]
76
- emitter.emit('foo');
77
-
78
- class EmitterWithValidDefinitions extends EventEmitter<MyEvents> {}
79
- }
80
-
81
- export function testSubclassInstance() {
82
- class MyEmitter extends EventEmitter<MyEvents> {}
83
-
84
- const emitter = new MyEmitter();
85
-
86
- emitter.addListener('noArgsEvent', expectedUndefined => {
87
- (expectedUndefined: void);
88
- });
89
-
90
- emitter.addListener('stringEvent', expectedString => {
91
- (expectedString: string);
92
- });
93
-
94
- emitter.addListener('numberEvent', expectedNumber => {
95
- (expectedNumber: number);
96
- });
97
-
98
- emitter.addListener('anotherNumberEvent', expectedNumber => {
99
- (expectedNumber: number);
100
- });
101
-
102
- emitter.addListener(
103
- 'objectAndBooleanEvent',
104
- (expectedObject, expectedBoolean, unexpectedArg) => {
105
- (expectedObject: {prop: string});
106
- (expectedBoolean: boolean);
107
- (unexpectedArg: void);
108
- },
109
- );
110
-
111
- // $FlowExpectedError[prop-missing]
112
- emitter.addListener('unexpectedEvent', () => {});
113
-
114
- // $FlowExpectedError[incompatible-call]
115
- emitter.addListener('noArgsEvent', (value: number) => {});
116
-
117
- // $FlowExpectedError[incompatible-call]
118
- emitter.addListener('numberEvent', (value: string) => {});
119
-
120
- emitter.emit('noArgsEvent');
121
- emitter.emit('stringEvent', 'value');
122
- emitter.emit('numberEvent', 4);
123
- emitter.emit('anotherNumberEvent', 4);
124
- emitter.emit('objectAndBooleanEvent', {prop: 'value'}, true);
125
- }
13
+ const emitter = new EventEmitter<{
14
+ void: [],
15
+ string: [string],
16
+ strings: [string, string],
17
+ error: [Error],
18
+ }>();
19
+
20
+ const subscription = emitter.addListener('void', unknown => {
21
+ (unknown: void);
22
+ });
23
+ subscription.remove();
24
+
25
+ emitter.addListener('string', foo => {
26
+ (foo: string);
27
+ });
28
+ emitter.addListener('strings', (foo, bar) => {
29
+ (foo: string);
30
+ (bar: string);
31
+ });
32
+ emitter.addListener('error', error => {
33
+ (error: Error);
34
+ });
35
+
36
+ emitter.emit('void');
37
+ emitter.emit('string', 'foo');
38
+ emitter.emit('strings', 'foo', 'bar');
39
+ emitter.emit('error', new Error());
40
+
41
+ emitter.removeAllListeners('void');
42
+ emitter.removeAllListeners('string');
43
+ emitter.removeAllListeners('strings');
44
+ emitter.removeAllListeners('error');
45
+ emitter.removeAllListeners();
46
+
47
+ emitter.listenerCount('void');
48
+ emitter.listenerCount('string');
49
+ emitter.listenerCount('strings');
50
+ emitter.listenerCount('error');
51
+
52
+ // $FlowExpectedError[prop-missing]
53
+ emitter.addListener('does-not-exist', () => {
54
+ // ...
55
+ });
56
+
57
+ // $FlowExpectedError[prop-missing]
58
+ subscription.context;
59
+ // $FlowExpectedError[prop-missing]
60
+ subscription.listener;
61
+ // $FlowExpectedError[prop-missing]
62
+ subscription.once;
63
+
64
+ // $FlowExpectedError[invalid-tuple-arity]
65
+ emitter.emit('void', undefined);
66
+ // $FlowExpectedError[incompatible-call]
67
+ emitter.emit('string', 123);
68
+ // $FlowExpectedError[invalid-tuple-arity]
69
+ emitter.emit('strings', 'foo');
70
+ // $FlowExpectedError[invalid-tuple-arity]
71
+ emitter.emit('strings', 'foo', 'bar', 'baz');
72
+ // $FlowExpectedError[invalid-tuple-arity]
73
+ emitter.emit('error');
74
+ // $FlowExpectedError[prop-missing]
75
+ emitter.emit('does-not-exist');
76
+
77
+ // $FlowExpectedError[prop-missing]
78
+ emitter.removeAllListeners('does-not-exist');
79
+
80
+ // $FlowExpectedError[prop-missing]
81
+ emitter.listenerCount('does-not-exist');
@@ -0,0 +1,30 @@
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
8
+ * @format
9
+ */
10
+
11
+ // Declarations for functionality exposed by Hermes' TimerStats decorator.
12
+ //
13
+ // For backwards-compatibility, code that uses such functionality must also
14
+ // check explicitly at run-time whether the object(s) and method(s) exist, and
15
+ // fail safely if not.
16
+
17
+ /**
18
+ * JSITimerInternalType is the global object installed by Hermes' TimedRuntime
19
+ * decorator, and it is used to extract runtime timing information.
20
+ */
21
+ declare type $JSITimerInternalType = {
22
+ /**
23
+ * Returns the counters that TimedRuntime keep track.
24
+ * There are no guarantees about what keys exist in it, but they can be
25
+ * printed for informational purposes.
26
+ * @return An object that maps strings to various types of performance
27
+ * statistics.
28
+ */
29
+ +getTimes?: () => {[string]: number | string, ...},
30
+ };
@@ -20,12 +20,13 @@ module.exports = {
20
20
  // the correct images are loaded for components. Essentially
21
21
  // require('img1.png') becomes `Object { "testUri": 'path/to/img1.png' }` in
22
22
  // the Jest snapshot.
23
- process: (_, filename) =>
24
- `module.exports = {
23
+ process: (_, filename) => ({
24
+ code: `module.exports = {
25
25
  testUri:
26
26
  ${JSON.stringify(
27
27
  path.relative(__dirname, filename).replace(/\\/g, '/'),
28
28
  )}
29
29
  };`,
30
+ }),
30
31
  getCacheKey: createCacheKeyFunction([__filename]),
31
32
  };
package/jest/setup.js CHANGED
@@ -355,6 +355,10 @@ jest
355
355
  '../Libraries/Utilities/verifyComponentAttributeEquivalence',
356
356
  () => function () {},
357
357
  )
358
+ .mock('../Libraries/Vibration/Vibration', () => ({
359
+ vibrate: jest.fn(),
360
+ cancel: jest.fn(),
361
+ }))
358
362
  .mock('../Libraries/Components/View/ViewNativeComponent', () => {
359
363
  const React = require('react');
360
364
  const Component = class extends React.Component {
package/jest.config.js CHANGED
@@ -5,7 +5,6 @@ module.exports = {
5
5
  transform: {
6
6
  '^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$':
7
7
  '<rootDir>/jest/assetFileTransformer.js',
8
- '.*': './jest/preprocessor.js',
9
8
  },
10
9
  transformIgnorePatterns: [],
11
10
  setupFiles: ['./jest/setup.js'],
package/overrides.json CHANGED
@@ -7,13 +7,13 @@
7
7
  "**/__snapshots__/**",
8
8
  "src/rntypes/**"
9
9
  ],
10
- "baseVersion": "0.69.0",
10
+ "baseVersion": "0.70.0-rc.1",
11
11
  "overrides": [
12
12
  {
13
13
  "type": "derived",
14
14
  "file": ".flowconfig",
15
15
  "baseFile": ".flowconfig",
16
- "baseHash": "22398587d11b601a2ec98362fa3879779983e898"
16
+ "baseHash": "fb425c3818276b4141f4c1877d4f0629f10e18ba"
17
17
  },
18
18
  {
19
19
  "type": "derived",
@@ -25,13 +25,13 @@
25
25
  "type": "patch",
26
26
  "file": "src/Libraries/Alert/Alert.win32.js",
27
27
  "baseFile": "Libraries/Alert/Alert.js",
28
- "baseHash": "bbfa56d0a75d228c12d041a37255244fc8479604"
28
+ "baseHash": "f915bdebd13c9c76d7d76b7a5d85903a308b44fd"
29
29
  },
30
30
  {
31
31
  "type": "patch",
32
32
  "file": "src/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js",
33
33
  "baseFile": "Libraries/Components/AccessibilityInfo/AccessibilityInfo.js",
34
- "baseHash": "684ad8aef9bc3250f96c52ba188773fdabd4bc99",
34
+ "baseHash": "821a00b041478c1a6a62afac525c1dd5ea62eb1a",
35
35
  "issue": 4578
36
36
  },
37
37
  {
@@ -78,7 +78,7 @@
78
78
  "type": "patch",
79
79
  "file": "src/Libraries/Components/Pressable/Pressable.win32.js",
80
80
  "baseFile": "Libraries/Components/Pressable/Pressable.js",
81
- "baseHash": "b6e9d331a959f84314be9a0efcf40ce8eca4a6d8",
81
+ "baseHash": "d1aed2015a28ce41216f8f345a9e1fdabb082935",
82
82
  "issue": 6240
83
83
  },
84
84
  {
@@ -98,7 +98,7 @@
98
98
  "type": "patch",
99
99
  "file": "src/Libraries/Components/SafeAreaView/SafeAreaView.win32.js",
100
100
  "baseFile": "Libraries/Components/SafeAreaView/SafeAreaView.js",
101
- "baseHash": "d13d67c91a9096989776ba7d7b0f8537c46b87a8"
101
+ "baseHash": "af7999060b4757bea13165789b02692a84cae2cb"
102
102
  },
103
103
  {
104
104
  "type": "platform",
@@ -124,7 +124,7 @@
124
124
  "type": "derived",
125
125
  "file": "src/Libraries/Components/TextInput/TextInput.win32.tsx",
126
126
  "baseFile": "Libraries/Components/TextInput/TextInput.js",
127
- "baseHash": "567ebad070a2fb9020ef177ee30defba9f0c54ec"
127
+ "baseHash": "4dff97dc165f821e2a57e64e09e1b07a085210f2"
128
128
  },
129
129
  {
130
130
  "type": "patch",
@@ -143,6 +143,13 @@
143
143
  "type": "platform",
144
144
  "file": "src/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx"
145
145
  },
146
+ {
147
+ "type": "patch",
148
+ "file": "src/Libraries/Components/Touchable/Touchable.win32.js",
149
+ "baseFile": "Libraries/Components/Touchable/Touchable.js",
150
+ "baseHash": "c1e6ce77fc27bfc4b39a87e6519bda6d55ded8f1",
151
+ "issue": 0
152
+ },
146
153
  {
147
154
  "type": "platform",
148
155
  "file": "src/Libraries/Components/Touchable/TouchableNativeFeedback.Props.ts"
@@ -183,7 +190,7 @@
183
190
  "type": "patch",
184
191
  "file": "src/Libraries/Components/View/ViewPropTypes.win32.js",
185
192
  "baseFile": "Libraries/Components/View/ViewPropTypes.js",
186
- "baseHash": "d2a2c68a374e334a4ff211353c534a795433bd7d",
193
+ "baseHash": "acfad8aae28439dad8792c141b5be321b3ef83b1",
187
194
  "issue": 6240
188
195
  },
189
196
  {
@@ -205,7 +212,7 @@
205
212
  "type": "derived",
206
213
  "file": "src/Libraries/Image/Image.win32.js",
207
214
  "baseFile": "Libraries/Image/Image.ios.js",
208
- "baseHash": "282cd9cc008400b06b617543b9f5f8429d91b87e",
215
+ "baseHash": "3e5ddb2e2c7fe2f4c0d3d58d07cc38e2f85d1479",
209
216
  "issue": 4320
210
217
  },
211
218
  {
@@ -304,7 +311,7 @@
304
311
  "type": "copy",
305
312
  "file": "src/Libraries/Lists/__tests__/VirtualizedList-test.js",
306
313
  "baseFile": "Libraries/Lists/__tests__/VirtualizedList-test.js",
307
- "baseHash": "6eb2a875d4eeb9ab65476661ff3fc4f6c03b329c",
314
+ "baseHash": "948d12e5f6a2638cb649bfcdc36da719150b7cd7",
308
315
  "issue": 0
309
316
  },
310
317
  {
@@ -318,7 +325,7 @@
318
325
  "type": "copy",
319
326
  "file": "src/Libraries/Lists/__tests__/VirtualizeUtils-test.js",
320
327
  "baseFile": "Libraries/Lists/__tests__/VirtualizeUtils-test.js",
321
- "baseHash": "7cbd1e3cfa7adab44c9508066bf77e29d2c55b46",
328
+ "baseHash": "6495ce722e6a7d44bb1527bf56b426a2c446ff9d",
322
329
  "issue": 0
323
330
  },
324
331
  {
@@ -350,7 +357,7 @@
350
357
  "type": "derived",
351
358
  "file": "src/Libraries/NativeComponent/BaseViewConfig.win32.js",
352
359
  "baseFile": "Libraries/NativeComponent/BaseViewConfig.ios.js",
353
- "baseHash": "ff335415e43399b3cdaf4fd2dd2063d495f39ec5"
360
+ "baseHash": "a0dca36e4c9d6c7ad4890cc0a34ec02cbbab9405"
354
361
  },
355
362
  {
356
363
  "type": "derived",
@@ -382,7 +389,7 @@
382
389
  "type": "patch",
383
390
  "file": "src/Libraries/Pressability/Pressability.win32.js",
384
391
  "baseFile": "Libraries/Pressability/Pressability.js",
385
- "baseHash": "87349e7a4175694c25df80538885fac1e0df96d1",
392
+ "baseHash": "487a7a4e21fbf611503fc0093fc629fdde62e720",
386
393
  "issue": 6240
387
394
  },
388
395
  {
@@ -405,7 +412,7 @@
405
412
  "type": "patch",
406
413
  "file": "src/Libraries/ReactNative/PaperUIManager.win32.js",
407
414
  "baseFile": "Libraries/ReactNative/PaperUIManager.js",
408
- "baseHash": "095340650dff94c140283c08d6b891685f6835ba"
415
+ "baseHash": "689b700b5b0e62cb3c115550d73dd6ed1bf42c3b"
409
416
  },
410
417
  {
411
418
  "type": "derived",
@@ -442,7 +449,7 @@
442
449
  "type": "patch",
443
450
  "file": "src/Libraries/Types/CoreEventTypes.win32.js",
444
451
  "baseFile": "Libraries/Types/CoreEventTypes.js",
445
- "baseHash": "d9fb8f9555d98ec994eaa472fce31594d37ddfd6",
452
+ "baseHash": "5bf8e4d80cf27ac6a3268977895276d5736b3138",
446
453
  "issue": 6240
447
454
  },
448
455
  {
@@ -462,7 +469,7 @@
462
469
  "type": "derived",
463
470
  "file": "src/Libraries/Utilities/Dimensions.win32.js",
464
471
  "baseFile": "Libraries/Utilities/Dimensions.js",
465
- "baseHash": "34bfe034694446b309e5ff11a860a2985e488615"
472
+ "baseHash": "06117559e6ff351f390ab2412a75cd223c6007eb"
466
473
  },
467
474
  {
468
475
  "type": "platform",