@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.
- package/.eslintrc.js +0 -1
- package/.flowconfig +5 -1
- package/CHANGELOG.json +194 -32
- package/CHANGELOG.md +79 -19
- package/IntegrationTests/AsyncStorageTest.js +20 -4
- package/IntegrationTests/BUCK +2 -2
- package/IntegrationTests/LayoutEventsTest.js +4 -1
- package/IntegrationTests/{launchWebSocketServer.command → launchWebSocketServer.sh} +3 -9
- package/Libraries/Alert/Alert.js +18 -4
- package/Libraries/Alert/Alert.win32.js +2 -0
- package/Libraries/Alert/NativeAlertManager.js +1 -0
- package/Libraries/Animated/Animated.js +2 -2
- package/Libraries/Animated/AnimatedEvent.js +7 -4
- package/Libraries/Animated/AnimatedImplementation.js +17 -3
- package/Libraries/Animated/AnimatedMock.js +7 -2
- package/Libraries/Animated/NativeAnimatedHelper.js +220 -95
- package/Libraries/Animated/NativeAnimatedModule.js +3 -0
- package/Libraries/Animated/NativeAnimatedTurboModule.js +3 -0
- package/Libraries/Animated/animations/SpringAnimation.js +3 -3
- package/Libraries/Animated/animations/TimingAnimation.js +3 -3
- package/Libraries/Animated/createAnimatedComponent.js +8 -1
- package/Libraries/Animated/nodes/AnimatedAddition.js +3 -1
- package/Libraries/Animated/nodes/AnimatedColor.js +50 -29
- package/Libraries/Animated/nodes/AnimatedDiffClamp.js +3 -1
- package/Libraries/Animated/nodes/AnimatedDivision.js +3 -1
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +22 -21
- package/Libraries/Animated/nodes/AnimatedModulo.js +3 -1
- package/Libraries/Animated/nodes/AnimatedMultiplication.js +3 -2
- package/Libraries/Animated/nodes/AnimatedProps.js +20 -12
- package/Libraries/Animated/nodes/AnimatedStyle.js +19 -16
- package/Libraries/Animated/nodes/AnimatedSubtraction.js +3 -1
- package/Libraries/Animated/nodes/AnimatedTransform.js +5 -5
- package/Libraries/Animated/nodes/AnimatedValue.js +14 -5
- package/Libraries/Animated/nodes/AnimatedValueXY.js +28 -1
- package/Libraries/Animated/useAnimatedProps.js +1 -0
- package/Libraries/AppState/AppState.js +0 -32
- package/Libraries/BatchedBridge/MessageQueue.js +21 -15
- package/Libraries/BatchedBridge/NativeModules.js +3 -4
- package/Libraries/Blob/FileReader.js +0 -6
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +0 -20
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +0 -20
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -0
- package/Libraries/Components/Keyboard/Keyboard.js +0 -11
- package/Libraries/Components/Pressable/Pressable.js +2 -0
- package/Libraries/Components/Pressable/Pressable.win32.js +2 -0
- package/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js +1 -3
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +3 -30
- package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +4 -32
- package/Libraries/Components/ScrollView/ScrollView.js +13 -11
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +5 -3
- package/Libraries/Components/StatusBar/StatusBar.js +10 -7
- package/Libraries/Components/TextInput/InputAccessoryView.js +14 -13
- package/Libraries/Components/TextInput/TextInput.js +12 -2
- package/Libraries/Components/Touchable/PooledClass.js +16 -4
- package/Libraries/Components/Touchable/Touchable.js +50 -1
- package/Libraries/Components/Touchable/Touchable.win32.js +972 -0
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +6 -2
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +0 -7
- package/Libraries/Components/View/ViewPropTypes.js +3 -8
- package/Libraries/Components/View/ViewPropTypes.win32.js +3 -8
- package/Libraries/Core/ExceptionsManager.js +2 -0
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/Timers/JSTimers.js +2 -2
- package/Libraries/Core/polyfillPromise.js +0 -32
- package/Libraries/Core/setUpBatchedBridge.js +5 -1
- package/Libraries/Core/setUpPerformance.js +1 -1
- package/Libraries/EventEmitter/NativeEventEmitter.js +0 -13
- package/Libraries/Image/AssetSourceResolver.js +2 -2
- package/Libraries/Image/Image.android.js +5 -3
- package/Libraries/Image/Image.ios.js +6 -3
- package/Libraries/Image/Image.win32.js +6 -3
- package/Libraries/Image/ImageSource.js +7 -5
- package/Libraries/Inspector/ElementBox.js +2 -2
- package/Libraries/Inspector/NetworkOverlay.js +13 -8
- package/Libraries/Interaction/PanResponder.js +16 -14
- package/Libraries/Linking/Linking.js +0 -11
- package/Libraries/Lists/FlatList.js +3 -2
- package/Libraries/Lists/SectionList.js +2 -0
- package/Libraries/Lists/ViewabilityHelper.js +7 -3
- package/Libraries/Lists/VirtualizeUtils.js +33 -20
- package/Libraries/Lists/VirtualizedList.js +93 -47
- package/Libraries/Lists/VirtualizedListContext.js +1 -0
- package/Libraries/Lists/VirtualizedSectionList.js +14 -9
- package/Libraries/Lists/__tests__/VirtualizeUtils-test.js +19 -18
- package/Libraries/Lists/__tests__/VirtualizedList-test.js +10 -6
- package/Libraries/LogBox/Data/LogBoxData.js +1 -1
- package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
- package/Libraries/LogBox/LogBox.js +3 -1
- package/Libraries/LogBox/UI/AnsiHighlight.js +2 -0
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +3 -0
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +0 -3
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +8 -3
- package/Libraries/NativeComponent/BaseViewConfig.android.js +9 -18
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +26 -12
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +26 -12
- package/Libraries/Network/XMLHttpRequest.js +9 -11
- package/Libraries/Performance/PureComponentDebug.js +1 -0
- package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +9 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +16 -0
- package/Libraries/Pressability/Pressability.js +26 -16
- package/Libraries/Pressability/Pressability.win32.js +26 -16
- package/Libraries/Promise.js +0 -1
- package/Libraries/ReactNative/AppRegistry.js +16 -13
- package/Libraries/ReactNative/BridgelessUIManager.js +2 -0
- package/Libraries/ReactNative/PaperUIManager.js +9 -9
- package/Libraries/ReactNative/PaperUIManager.win32.js +7 -8
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +12 -0
- package/Libraries/ReactNative/ReactNativeRuntimeDiagnostics.js +68 -0
- package/Libraries/ReactNative/getNativeComponentAttributes.js +6 -7
- package/Libraries/ReactNative/renderApplication.js +1 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +4443 -3615
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +1496 -1170
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +1694 -1356
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +4439 -3588
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +1583 -1249
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +1719 -1372
- package/Libraries/Storage/AsyncStorage.js +7 -1
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +8 -0
- package/Libraries/StyleSheet/flattenStyle.js +1 -1
- package/Libraries/StyleSheet/processTransform.js +2 -0
- package/Libraries/StyleSheet/splitLayoutProps.js +2 -0
- package/Libraries/Text/Text.js +15 -7
- package/Libraries/Types/CoreEventTypes.js +137 -11
- package/Libraries/Types/CoreEventTypes.win32.js +147 -22
- package/Libraries/Utilities/Dimensions.js +0 -13
- package/Libraries/Utilities/Dimensions.win32.js +0 -9
- package/Libraries/Utilities/HMRClient.js +3 -3
- package/Libraries/Utilities/Platform.ios.js +0 -7
- package/Libraries/Utilities/ReactNativeTestTools.js +3 -1
- package/Libraries/Utilities/codegenNativeCommands.js +11 -2
- package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +2 -0
- package/Libraries/Utilities/stringifySafe.js +3 -1
- package/Libraries/Utilities/truncate.js +1 -1
- package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +2 -2
- package/Libraries/Vibration/Vibration.js +1 -1
- package/Libraries/WebSocket/WebSocket.js +1 -0
- package/Libraries/vendor/emitter/EventEmitter.js +105 -12
- package/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +73 -117
- package/flow/JSITimerInternalType.js +30 -0
- package/jest/assetFileTransformer.js +3 -2
- package/jest/setup.js +4 -0
- package/jest.config.js +0 -1
- package/overrides.json +23 -16
- package/package.json +23 -24
- package/rntypes/index.d.ts +0 -1
- package/src/rntypes/index.d.ts +0 -1
- package/Libraries/vendor/emitter/EventSubscription.js +0 -19
- package/Libraries/vendor/emitter/_EmitterSubscription.js +0 -62
- package/Libraries/vendor/emitter/_EventEmitter.js +0 -184
- package/Libraries/vendor/emitter/_EventSubscription.js +0 -45
- package/Libraries/vendor/emitter/_EventSubscriptionVendor.js +0 -108
- package/jest/preprocessor.js +0 -40
- package/jest/preprocessor_DO_NOT_USE.js +0 -122
- package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizeUtils-test.js.snap +0 -3
|
@@ -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
|
-
|
|
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
|
-
|
|
22
|
+
emit<TEvent: $Keys<TEventToArgsMap>>(
|
|
23
|
+
eventType: TEvent,
|
|
24
|
+
...args: $ElementType<TEventToArgsMap, TEvent>
|
|
25
|
+
): void;
|
|
14
26
|
|
|
15
|
-
|
|
27
|
+
removeAllListeners<TEvent: $Keys<TEventToArgsMap>>(eventType?: ?TEvent): void;
|
|
28
|
+
|
|
29
|
+
listenerCount<TEvent: $Keys<TEventToArgsMap>>(eventType: TEvent): number;
|
|
30
|
+
}
|
|
16
31
|
|
|
17
|
-
|
|
32
|
+
interface Registration<TArgs> {
|
|
33
|
+
+context: mixed;
|
|
34
|
+
+listener: (...args: TArgs) => mixed;
|
|
35
|
+
+remove: () => void;
|
|
36
|
+
}
|
|
18
37
|
|
|
19
|
-
|
|
38
|
+
type Registry<TEventToArgsMap: {...}> = $ObjMap<
|
|
39
|
+
TEventToArgsMap,
|
|
40
|
+
<TArgs>(TArgs) => Set<Registration<TArgs>>,
|
|
41
|
+
>;
|
|
20
42
|
|
|
21
43
|
/**
|
|
22
|
-
*
|
|
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
|
|
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
|
|
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>>(
|
|
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.
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
package/overrides.json
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
"**/__snapshots__/**",
|
|
8
8
|
"src/rntypes/**"
|
|
9
9
|
],
|
|
10
|
-
"baseVersion": "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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
472
|
+
"baseHash": "06117559e6ff351f390ab2412a75cd223c6007eb"
|
|
466
473
|
},
|
|
467
474
|
{
|
|
468
475
|
"type": "platform",
|