react-native-windows 0.69.5 → 0.70.0-preview.2
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/.flowconfig +5 -1
- package/Chakra/ChakraHelpers.cpp +1 -1
- package/Chakra/ChakraPlatform.cpp +1 -1
- package/Chakra/ChakraValue.cpp +6 -3
- package/Chakra/ChakraValue.h +1 -1
- package/Directory.Build.props +7 -7
- package/Folly/Folly.vcxproj +20 -13
- package/Folly/cgmanifest.json +14 -0
- package/Libraries/Alert/Alert.js +18 -4
- package/Libraries/Alert/Alert.windows.js +4 -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/AppTheme/AppTheme.js +14 -8
- package/Libraries/AppTheme/AppThemeTypes.d.ts +0 -3
- 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.windows.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.windows.js +2 -0
- package/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js +1 -3
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +3 -30
- package/Libraries/Components/SafeAreaView/SafeAreaView.windows.js +4 -30
- 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/TextInput/TextInput.windows.js +12 -2
- package/Libraries/Components/Touchable/PooledClass.js +16 -4
- package/Libraries/Components/Touchable/Touchable.js +50 -1
- package/Libraries/Components/Touchable/Touchable.windows.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.windows.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.windows.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.windows.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.windows.js +30 -17
- 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.windows.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/processTransform.windows.js +2 -0
- package/Libraries/StyleSheet/splitLayoutProps.js +2 -0
- package/Libraries/Text/Text.js +15 -7
- package/Libraries/Text/Text.windows.js +14 -7
- package/Libraries/Types/CoreEventTypes.js +137 -11
- package/Libraries/Types/CoreEventTypes.windows.js +147 -22
- package/Libraries/Utilities/Dimensions.js +0 -13
- 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/Microsoft.ReactNative/Base/CoreNativeModules.cpp +24 -12
- package/Microsoft.ReactNative/CoreApp.cpp +303 -0
- package/Microsoft.ReactNative/CoreAppPage.cpp +21 -0
- package/Microsoft.ReactNative/CoreAppPage.h +15 -0
- package/Microsoft.ReactNative/CoreAppPage.idl +12 -0
- package/Microsoft.ReactNative/CoreAppPage.xaml +14 -0
- package/Microsoft.ReactNative/Fabric/ActivityIndicatorComponentView.cpp +1 -2
- package/Microsoft.ReactNative/Fabric/ActivityIndicatorComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/ComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/ImageComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/ImageComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/ParagraphComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/ParagraphComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/ScrollViewComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/ScrollViewComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/SliderComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/SliderComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/SwitchComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/SwitchComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/TextComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/TextComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/TextInput/WindowsTextInputComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/TextInput/WindowsTextInputComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/ViewComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/ViewComponentView.h +1 -1
- package/Microsoft.ReactNative/GlyphViewManager.cpp +1 -0
- package/Microsoft.ReactNative/IReactDispatcher.cpp +18 -0
- package/Microsoft.ReactNative/IReactDispatcher.h +18 -3
- package/Microsoft.ReactNative/IReactDispatcher.idl +15 -0
- package/Microsoft.ReactNative/IReactNotificationService.cpp +197 -70
- package/Microsoft.ReactNative/IReactNotificationService.h +11 -30
- package/Microsoft.ReactNative/IReactPropertyBag.cpp +9 -0
- package/Microsoft.ReactNative/IReactPropertyBag.h +3 -0
- package/Microsoft.ReactNative/IReactPropertyBag.idl +3 -0
- package/Microsoft.ReactNative/JsiApi.cpp +41 -1
- package/Microsoft.ReactNative/JsiApi.h +3 -0
- package/Microsoft.ReactNative/JsiApi.idl +19 -1
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +18 -2
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +7 -7
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.h +1 -1
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +15 -12
- package/Microsoft.ReactNative/Modules/AlertModule.h +1 -1
- package/Microsoft.ReactNative/Modules/AppStateModule.cpp +45 -9
- package/Microsoft.ReactNative/Modules/AppStateModule.h +9 -3
- package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.h +1 -1
- package/Microsoft.ReactNative/Modules/ClipboardModule.h +1 -1
- package/Microsoft.ReactNative/Modules/DevSettingsModule.h +1 -1
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.h +1 -1
- package/Microsoft.ReactNative/Modules/I18nManagerModule.h +1 -1
- package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/ImageViewManagerModule.h +1 -1
- package/Microsoft.ReactNative/Modules/LinkingManagerModule.h +1 -1
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +1 -1
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +66 -39
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +41 -11
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.h +1 -1
- package/Microsoft.ReactNative/QuirkSettings.cpp +22 -0
- package/Microsoft.ReactNative/QuirkSettings.h +10 -0
- package/Microsoft.ReactNative/QuirkSettings.idl +7 -0
- package/Microsoft.ReactNative/ReactApplication.cpp +44 -0
- package/Microsoft.ReactNative/ReactApplication.h +40 -5
- package/Microsoft.ReactNative/ReactHost/JSCallInvokerScheduler.cpp +5 -2
- package/Microsoft.ReactNative/ReactHost/JSCallInvokerScheduler.h +1 -0
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +23 -4
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -1
- package/Microsoft.ReactNative/ReactPointerEventArgs.cpp +12 -2
- package/Microsoft.ReactNative/Utils/BatchingEventEmitter.cpp +1 -0
- package/Microsoft.ReactNative/Utils/Helpers.cpp +1 -1
- package/Microsoft.ReactNative/Utils/Helpers.h +1 -1
- package/Microsoft.ReactNative/Utils/PropertyUtils.h +1 -1
- package/Microsoft.ReactNative/Utils/TransformableText.h +1 -1
- package/Microsoft.ReactNative/Utils/ValueUtils.cpp +0 -1
- package/Microsoft.ReactNative/Views/DynamicAutomationPeer.cpp +9 -7
- package/Microsoft.ReactNative/Views/DynamicAutomationProperties.cpp +3 -3
- package/Microsoft.ReactNative/Views/FlyoutViewManager.cpp +13 -1
- package/Microsoft.ReactNative/Views/FrameworkElementTransferProperties.cpp +1 -1
- package/Microsoft.ReactNative/Views/FrameworkElementViewManager.cpp +63 -13
- package/Microsoft.ReactNative/Views/Image/ImageViewManager.cpp +1 -1
- package/Microsoft.ReactNative/Views/Image/ReactImage.cpp +5 -6
- package/Microsoft.ReactNative/Views/Image/ReactImage.h +4 -4
- package/Microsoft.ReactNative/Views/Text/TextTransformParentVisitor.h +1 -1
- package/Microsoft.ReactNative/Views/TextInputViewManager.cpp +21 -2
- package/Microsoft.ReactNative/Views/TextViewManager.cpp +6 -3
- package/Microsoft.ReactNative/Views/TouchEventHandler.cpp +1 -1
- package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +7 -1
- package/Microsoft.ReactNative/Views/ViewPanel.cpp +4 -0
- package/Microsoft.ReactNative/Views/ViewViewManager.cpp +8 -3
- package/Microsoft.ReactNative/Views/cppwinrt/DynamicAutomationPeer.idl +2 -0
- package/Microsoft.ReactNative/microsoft.reactnative.def +4 -1
- package/Microsoft.ReactNative.Cxx/AppModelHelpers.h +17 -0
- package/Microsoft.ReactNative.Cxx/CoreApp.h +60 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.cpp +65 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +13 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiValueHelpers.cpp +53 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiValueHelpers.h +32 -0
- package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.cpp +14 -2
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +3 -0
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +7 -0
- package/Microsoft.ReactNative.Managed/packages.lock.json +1 -24
- package/Mso/dispatchQueue/dispatchQueue.h +12 -4
- package/Mso/src/dispatchQueue/looperScheduler.cpp +36 -9
- package/Mso/src/dispatchQueue/queueService.cpp +2 -2
- package/Mso/src/dispatchQueue/queueService.h +2 -2
- package/Mso/src/memoryApi/memoryApi.cpp +3 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/JSEngine.props +1 -1
- package/PropertySheets/Release.props +6 -0
- package/ReactCommon/ReactCommon.vcxproj +11 -21
- package/ReactCommon/ReactCommon.vcxproj.filters +64 -46
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.h +145 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +344 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/BaseTextProps.cpp +313 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/ViewProps.cpp +455 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/ConcreteComponentDescriptor.h +216 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/PropsMacros.h +91 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/graphics/RectangleEdges.h +100 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/CompactValue.h +3 -1
- package/Scripts/Microsoft.ReactNative.nuspec +6 -0
- package/Scripts/Microsoft.ReactNative.targets +7 -0
- package/Shared/DevSettings.h +4 -0
- package/Shared/JSI/ChakraRuntime.cpp +11 -2
- package/Shared/JSI/ChakraRuntime.h +2 -0
- package/Shared/Modules/BlobModule.cpp +4 -4
- package/Shared/Modules/BlobModule.h +1 -1
- package/Shared/Modules/FileReaderModule.cpp +3 -2
- package/Shared/Modules/IBlobPersistor.h +1 -1
- package/Shared/Networking/IHttpResource.h +1 -0
- package/Shared/Networking/OriginPolicyHttpFilter.cpp +16 -10
- package/Shared/Networking/WinRTHttpResource.cpp +34 -2
- package/Shared/OInstance.cpp +14 -6
- package/Shared/Threading/BatchingQueueThread.cpp +23 -12
- package/Shared/Utils.cpp +2 -5
- package/codegen/NativeAlertManagerSpec.g.h +2 -0
- package/codegen/NativeAnimatedModuleSpec.g.h +6 -0
- package/codegen/NativeAnimatedTurboModuleSpec.g.h +6 -0
- package/codegen/react/components/rnwcore/Props.cpp +2 -2
- package/codegen/react/components/rnwcore/Props.h +1 -1
- package/fmt/cgmanifest.json +14 -0
- package/fmt/fmt.vcxproj +25 -11
- package/jest/assetFileTransformer.js +3 -2
- package/jest/setup.js +4 -0
- package/package.json +27 -28
- package/rntypes/index.d.ts +0 -1
- package/template/cs-app-WinAppSDK/proj/{NuGet.Config → NuGet_Config} +0 -0
- package/template/metro.devMode.config.js +49 -2
- package/template/shared-app/proj/{NuGet.Config → NuGet_Config} +0 -0
- package/template/shared-lib/proj/{NuGet.Config → NuGet_Config} +0 -0
- 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/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +0 -87
- package/Scripts/copyRNLibraries.js +0 -99
- package/jest/preprocessor.js +0 -40
- package/jest/preprocessor_DO_NOT_USE.js +0 -122
|
@@ -8,14 +8,23 @@
|
|
|
8
8
|
* @flow
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
let dispatchCommand;
|
|
12
|
+
if (global.RN$Bridgeless) {
|
|
13
|
+
// Note: this function has the same implementation in the legacy and new renderer.
|
|
14
|
+
// However, evaluating the old renderer comes with some side effects.
|
|
15
|
+
dispatchCommand =
|
|
16
|
+
require('../../Libraries/Renderer/shims/ReactFabric').dispatchCommand;
|
|
17
|
+
} else {
|
|
18
|
+
dispatchCommand =
|
|
19
|
+
require('../../Libraries/Renderer/shims/ReactNative').dispatchCommand;
|
|
20
|
+
}
|
|
12
21
|
|
|
13
22
|
type Options<T = string> = $ReadOnly<{|
|
|
14
23
|
supportedCommands: $ReadOnlyArray<T>,
|
|
15
24
|
|}>;
|
|
16
25
|
|
|
17
26
|
function codegenNativeCommands<T: interface {}>(options: Options<$Keys<T>>): T {
|
|
18
|
-
const commandObj = {};
|
|
27
|
+
const commandObj: {[$Keys<T>]: (...$ReadOnlyArray<mixed>) => void} = {};
|
|
19
28
|
|
|
20
29
|
options.supportedCommands.forEach(command => {
|
|
21
30
|
commandObj[command] = (ref, ...args) => {
|
|
@@ -70,6 +70,8 @@ function deepFreezeAndThrowOnMutationInDev<T: {...} | Array<mixed>>(
|
|
|
70
70
|
return object;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
|
|
74
|
+
* LTI update could not be added via codemod */
|
|
73
75
|
function throwOnImmutableMutation(key: empty, value) {
|
|
74
76
|
throw Error(
|
|
75
77
|
'You attempted to set the key `' +
|
|
@@ -27,6 +27,8 @@ export function createStringifySafeWithLimits(limits: {|
|
|
|
27
27
|
maxObjectKeysLimit = Number.POSITIVE_INFINITY,
|
|
28
28
|
} = limits;
|
|
29
29
|
const stack = [];
|
|
30
|
+
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
|
31
|
+
* Flow's LTI update could not be added via codemod */
|
|
30
32
|
function replacer(key: string, value: mixed): mixed {
|
|
31
33
|
while (stack.length && this !== stack[0]) {
|
|
32
34
|
stack.shift();
|
|
@@ -65,7 +67,7 @@ export function createStringifySafeWithLimits(limits: {|
|
|
|
65
67
|
retval = `{ ... object with ${keys.length} keys ... }`;
|
|
66
68
|
} else if (keys.length > maxObjectKeysLimit) {
|
|
67
69
|
// Return a sample of the keys.
|
|
68
|
-
retval = {};
|
|
70
|
+
retval = ({}: {[string]: mixed});
|
|
69
71
|
for (let k of keys.slice(0, maxObjectKeysLimit)) {
|
|
70
72
|
retval[k] = value[k];
|
|
71
73
|
}
|
|
@@ -63,7 +63,7 @@ export default function verifyComponentAttributeEquivalence(
|
|
|
63
63
|
// Return the different key-value pairs of the right object, by iterating through the keys in the left object
|
|
64
64
|
// Note it won't return a difference where a key is missing in the left but exists the right.
|
|
65
65
|
function lefthandObjectDiff(leftObj: Object, rightObj: Object): Object {
|
|
66
|
-
const differentKeys = {};
|
|
66
|
+
const differentKeys: {[string]: any | {...}} = {};
|
|
67
67
|
|
|
68
68
|
function compare(leftItem: any, rightItem: any, key: string) {
|
|
69
69
|
if (typeof leftItem !== typeof rightItem && leftItem != null) {
|
|
@@ -110,7 +110,7 @@ export function getConfigWithoutViewProps(
|
|
|
110
110
|
|
|
111
111
|
return Object.keys(viewConfig[propName])
|
|
112
112
|
.filter(prop => !PlatformBaseViewConfig[propName][prop])
|
|
113
|
-
.reduce((obj, prop) => {
|
|
113
|
+
.reduce<{[string]: any}>((obj, prop) => {
|
|
114
114
|
obj[prop] = viewConfig[propName][prop];
|
|
115
115
|
return obj;
|
|
116
116
|
}, {});
|
|
@@ -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');
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
#include "CoreNativeModules.h"
|
|
6
6
|
|
|
7
7
|
// Modules
|
|
8
|
+
#include <AppModelHelpers.h>
|
|
8
9
|
#include <AsyncStorageModule.h>
|
|
9
10
|
#include <Modules/Animated/NativeAnimatedModule.h>
|
|
10
11
|
#include <Modules/AppearanceModule.h>
|
|
@@ -19,20 +20,17 @@
|
|
|
19
20
|
|
|
20
21
|
namespace Microsoft::ReactNative {
|
|
21
22
|
|
|
23
|
+
using winrt::Microsoft::ReactNative::ReactPropertyBag;
|
|
24
|
+
|
|
22
25
|
namespace {
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return abiPackageStatics->get_Current(winrt::put_abi(dummy)) !=
|
|
32
|
-
winrt::impl::hresult_from_win32(APPMODEL_ERROR_NO_PACKAGE);
|
|
33
|
-
}();
|
|
34
|
-
|
|
35
|
-
return hasPackageIdentity;
|
|
27
|
+
using winrt::Microsoft::ReactNative::ReactPropertyId;
|
|
28
|
+
|
|
29
|
+
ReactPropertyId<bool> HttpUseMonolithicModuleProperty() noexcept {
|
|
30
|
+
static ReactPropertyId<bool> propId{
|
|
31
|
+
L"ReactNative.Http"
|
|
32
|
+
L"UseMonolithicModule"};
|
|
33
|
+
return propId;
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
} // namespace
|
|
@@ -50,11 +48,25 @@ std::vector<facebook::react::NativeModuleDescription> GetCoreModules(
|
|
|
50
48
|
[props = context->Properties()]() { return Microsoft::React::CreateHttpModule(props); },
|
|
51
49
|
jsMessageQueue);
|
|
52
50
|
|
|
51
|
+
if (!ReactPropertyBag(context->Properties()).Get(HttpUseMonolithicModuleProperty())) {
|
|
52
|
+
modules.emplace_back(
|
|
53
|
+
Microsoft::React::GetBlobModuleName(),
|
|
54
|
+
[props = context->Properties()]() { return Microsoft::React::CreateBlobModule(props); },
|
|
55
|
+
batchingUIMessageQueue);
|
|
56
|
+
|
|
57
|
+
modules.emplace_back(
|
|
58
|
+
Microsoft::React::GetFileReaderModuleName(),
|
|
59
|
+
[props = context->Properties()]() { return Microsoft::React::CreateFileReaderModule(props); },
|
|
60
|
+
batchingUIMessageQueue);
|
|
61
|
+
}
|
|
62
|
+
|
|
53
63
|
modules.emplace_back(
|
|
54
64
|
"Timing",
|
|
55
65
|
[batchingUIMessageQueue]() { return facebook::react::CreateTimingModule(batchingUIMessageQueue); },
|
|
56
66
|
batchingUIMessageQueue);
|
|
57
67
|
|
|
68
|
+
// Note: `context` is moved to remove the reference from the current scope.
|
|
69
|
+
// This should either be the last usage of `context`, or the std::move call should happen later in this method.
|
|
58
70
|
modules.emplace_back(
|
|
59
71
|
NativeAnimatedModule::name,
|
|
60
72
|
[context = std::move(context)]() mutable { return std::make_unique<NativeAnimatedModule>(std::move(context)); },
|