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
|
@@ -53,5 +53,20 @@ namespace Microsoft.ReactNative
|
|
|
53
53
|
"Generally you can use @IReactContext.JSDispatcher to get the value of this property for "
|
|
54
54
|
"a specific React instance.")
|
|
55
55
|
static IReactPropertyName JSDispatcherProperty { get; };
|
|
56
|
+
|
|
57
|
+
DOC_STRING(
|
|
58
|
+
"Gets the name of the `JSDispatcherTaskStartingEventName` property for the @IReactNotificationService.\n"
|
|
59
|
+
"This notification name is to be used with IReactNotificationService.")
|
|
60
|
+
static IReactPropertyName JSDispatcherTaskStartingEventName{ get; };
|
|
61
|
+
|
|
62
|
+
DOC_STRING(
|
|
63
|
+
"Gets the name of the `JSDispatcherIdleWaitStartingEventName` property for the @IReactNotificationService.\n"
|
|
64
|
+
"This notification name is to be used with IReactNotificationService.")
|
|
65
|
+
static IReactPropertyName JSDispatcherIdleWaitStartingEventName{ get; };
|
|
66
|
+
|
|
67
|
+
DOC_STRING(
|
|
68
|
+
"Gets the name of the `JSDispatcherIdleWaitCompletedEventName` property for the @IReactNotificationService.\n"
|
|
69
|
+
"This notification name is to be used with IReactNotificationService.")
|
|
70
|
+
static IReactPropertyName JSDispatcherIdleWaitCompletedEventName{ get; };
|
|
56
71
|
}
|
|
57
72
|
} // namespace ReactNative
|
|
@@ -8,77 +8,183 @@
|
|
|
8
8
|
namespace winrt::Microsoft::ReactNative::implementation {
|
|
9
9
|
|
|
10
10
|
//=============================================================================
|
|
11
|
-
//
|
|
11
|
+
// IReactNotificationSubscription implementation
|
|
12
12
|
//=============================================================================
|
|
13
13
|
|
|
14
|
-
ReactNotificationSubscription
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
14
|
+
// Common interface to share functionality between ReactNotificationSubscription and ReactNotificationSubscriptionView
|
|
15
|
+
MSO_GUID(IReactNotificationSubscriptionPrivate, "09437980-3508-4690-930c-7c310e205e6b")
|
|
16
|
+
struct IReactNotificationSubscriptionPrivate : ::IUnknown {
|
|
17
|
+
virtual void SetParent(IReactNotificationSubscription const &parentSubscription) noexcept = 0;
|
|
18
|
+
virtual void CallHandler(
|
|
19
|
+
Windows::Foundation::IInspectable const &sender,
|
|
20
|
+
Windows::Foundation::IInspectable const &data) noexcept = 0;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// The Notification subscription class.
|
|
24
|
+
// Instances of this class are stored in the "child" notification services.
|
|
25
|
+
struct ReactNotificationSubscription
|
|
26
|
+
: implements<ReactNotificationSubscription, IReactNotificationSubscription, IReactNotificationSubscriptionPrivate> {
|
|
27
|
+
ReactNotificationSubscription(
|
|
28
|
+
Mso::RefCountedPtr<std::mutex> const &mutex,
|
|
29
|
+
weak_ref<ReactNotificationService> &¬ificationService,
|
|
30
|
+
IReactPropertyName const ¬ificationName,
|
|
31
|
+
IReactDispatcher const &dispatcher,
|
|
32
|
+
ReactNotificationHandler const &handler) noexcept
|
|
33
|
+
: m_mutex{mutex},
|
|
34
|
+
m_notificationService{std::move(notificationService)},
|
|
35
|
+
m_notificationName{notificationName},
|
|
36
|
+
m_dispatcher{dispatcher},
|
|
37
|
+
m_handler{handler} {}
|
|
38
|
+
|
|
39
|
+
~ReactNotificationSubscription() noexcept {
|
|
40
|
+
Unsubscribe();
|
|
41
|
+
}
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
public: // IReactNotificationSubscription implementation
|
|
44
|
+
IReactNotificationService NotificationService() const noexcept {
|
|
45
|
+
return m_notificationService.get().as<IReactNotificationService>();
|
|
46
|
+
}
|
|
41
47
|
|
|
42
|
-
IReactPropertyName
|
|
43
|
-
|
|
44
|
-
}
|
|
48
|
+
IReactPropertyName NotificationName() const noexcept {
|
|
49
|
+
return m_notificationName;
|
|
50
|
+
}
|
|
45
51
|
|
|
46
|
-
IReactDispatcher
|
|
47
|
-
|
|
48
|
-
}
|
|
52
|
+
IReactDispatcher Dispatcher() const noexcept {
|
|
53
|
+
return m_dispatcher;
|
|
54
|
+
}
|
|
49
55
|
|
|
50
|
-
bool
|
|
51
|
-
|
|
52
|
-
}
|
|
56
|
+
bool IsSubscribed() const noexcept {
|
|
57
|
+
return GetHandler() != nullptr;
|
|
58
|
+
}
|
|
53
59
|
|
|
54
|
-
void
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
void Unsubscribe() noexcept {
|
|
61
|
+
if (m_parentSubscription) {
|
|
62
|
+
m_parentSubscription.Unsubscribe();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
bool isSubscribed{false};
|
|
66
|
+
{
|
|
67
|
+
std::scoped_lock lock{*m_mutex};
|
|
68
|
+
if (m_handler) {
|
|
69
|
+
isSubscribed = true;
|
|
70
|
+
// Remove handler to free any objects captured by it.
|
|
71
|
+
m_handler = nullptr;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (isSubscribed) {
|
|
76
|
+
if (auto notificationService = m_notificationService.get()) {
|
|
77
|
+
notificationService->Unsubscribe(*this);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public: // IReactNotificationSubscriptionPrivate implementation
|
|
83
|
+
void SetParent(IReactNotificationSubscription const &parentSubscription) noexcept override {
|
|
84
|
+
m_parentSubscription = parentSubscription;
|
|
57
85
|
}
|
|
58
86
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
87
|
+
void CallHandler(IInspectable const &sender, IInspectable const &data) noexcept override {
|
|
88
|
+
auto args = make<ReactNotificationArgs>(*this, data);
|
|
89
|
+
if (auto handler = GetHandler()) {
|
|
90
|
+
if (m_dispatcher) {
|
|
91
|
+
m_dispatcher.Post([thisPtr = get_strong(), sender, args]() noexcept {
|
|
92
|
+
if (auto handler = thisPtr->GetHandler()) {
|
|
93
|
+
handler(sender, args);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
} else {
|
|
97
|
+
handler(sender, args);
|
|
98
|
+
}
|
|
62
99
|
}
|
|
63
100
|
}
|
|
64
|
-
}
|
|
65
101
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
102
|
+
private:
|
|
103
|
+
ReactNotificationHandler GetHandler() const noexcept {
|
|
104
|
+
std::scoped_lock lock{*m_mutex};
|
|
105
|
+
return m_handler;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private:
|
|
109
|
+
Mso::RefCountedPtr<std::mutex> m_mutex;
|
|
110
|
+
IReactNotificationSubscription m_parentSubscription{nullptr};
|
|
111
|
+
const weak_ref<ReactNotificationService> m_notificationService{nullptr};
|
|
112
|
+
const IReactPropertyName m_notificationName{nullptr};
|
|
113
|
+
const IReactDispatcher m_dispatcher{nullptr};
|
|
114
|
+
ReactNotificationHandler m_handler{nullptr};
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// The notification subscription view to wrap up child notification service.
|
|
118
|
+
// Instances of this class are stored in the parent notification services.
|
|
119
|
+
struct ReactNotificationSubscriptionView : implements<
|
|
120
|
+
ReactNotificationSubscriptionView,
|
|
121
|
+
IReactNotificationSubscription,
|
|
122
|
+
IReactNotificationSubscriptionPrivate> {
|
|
123
|
+
ReactNotificationSubscriptionView(
|
|
124
|
+
weak_ref<ReactNotificationService> &¬ificationService,
|
|
125
|
+
IReactNotificationSubscription const &childSubscription) noexcept
|
|
126
|
+
: m_notificationService{std::move(notificationService)}, m_childSubscription{weak_ref(childSubscription)} {
|
|
127
|
+
childSubscription.as<IReactNotificationSubscriptionPrivate>()->SetParent(*this);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
~ReactNotificationSubscriptionView() noexcept {
|
|
131
|
+
Unsubscribe();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
public: // IReactNotificationSubscription implementation
|
|
135
|
+
IReactNotificationService NotificationService() const noexcept {
|
|
136
|
+
return m_notificationService.get().as<IReactNotificationService>();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
IReactPropertyName NotificationName() const noexcept {
|
|
140
|
+
if (auto childSubscription = m_childSubscription.get()) {
|
|
141
|
+
return childSubscription.NotificationName();
|
|
77
142
|
} else {
|
|
78
|
-
|
|
143
|
+
return IReactPropertyName{nullptr};
|
|
79
144
|
}
|
|
80
145
|
}
|
|
81
|
-
|
|
146
|
+
|
|
147
|
+
IReactDispatcher Dispatcher() const noexcept {
|
|
148
|
+
if (auto childSubscription = m_childSubscription.get()) {
|
|
149
|
+
return childSubscription.Dispatcher();
|
|
150
|
+
} else {
|
|
151
|
+
return IReactDispatcher{nullptr};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
bool IsSubscribed() const noexcept {
|
|
156
|
+
return m_isSubscribed;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
void Unsubscribe() noexcept {
|
|
160
|
+
if (m_parentSubscription) {
|
|
161
|
+
m_parentSubscription.Unsubscribe();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (m_isSubscribed.exchange(false)) {
|
|
165
|
+
if (auto notificationService = m_notificationService.get()) {
|
|
166
|
+
notificationService->Unsubscribe(*this);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
public: // IReactNotificationSubscriptionPrivate implementation
|
|
172
|
+
void SetParent(IReactNotificationSubscription const &parentSubscription) noexcept override {
|
|
173
|
+
m_parentSubscription = parentSubscription;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
void CallHandler(IInspectable const &sender, IInspectable const &data) noexcept override {
|
|
177
|
+
if (auto childSubscription = m_childSubscription.get()) {
|
|
178
|
+
childSubscription.as<IReactNotificationSubscriptionPrivate>()->CallHandler(sender, data);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
private:
|
|
183
|
+
IReactNotificationSubscription m_parentSubscription{nullptr};
|
|
184
|
+
const weak_ref<IReactNotificationSubscription> m_childSubscription{nullptr};
|
|
185
|
+
const weak_ref<ReactNotificationService> m_notificationService{nullptr};
|
|
186
|
+
std::atomic_bool m_isSubscribed{true};
|
|
187
|
+
};
|
|
82
188
|
|
|
83
189
|
//=============================================================================
|
|
84
190
|
// ReactNotificationService implementation
|
|
@@ -99,7 +205,7 @@ void ReactNotificationService::ModifySubscriptions(
|
|
|
99
205
|
// Get the current snapshot under the lock
|
|
100
206
|
SubscriptionSnapshotPtr currentSnapshotPtr;
|
|
101
207
|
{
|
|
102
|
-
std::scoped_lock lock{m_mutex};
|
|
208
|
+
std::scoped_lock lock{*m_mutex};
|
|
103
209
|
auto it = m_subscriptions.find(notificationName);
|
|
104
210
|
if (it != m_subscriptions.end()) {
|
|
105
211
|
currentSnapshotPtr = it->second;
|
|
@@ -113,7 +219,7 @@ void ReactNotificationService::ModifySubscriptions(
|
|
|
113
219
|
|
|
114
220
|
// Try to set the new snapshot under the lock
|
|
115
221
|
SubscriptionSnapshotPtr snapshotPtr;
|
|
116
|
-
std::scoped_lock lock{m_mutex};
|
|
222
|
+
std::scoped_lock lock{*m_mutex};
|
|
117
223
|
auto it = m_subscriptions.find(notificationName);
|
|
118
224
|
if (it != m_subscriptions.end()) {
|
|
119
225
|
snapshotPtr = it->second;
|
|
@@ -146,20 +252,42 @@ IReactNotificationSubscription ReactNotificationService::Subscribe(
|
|
|
146
252
|
IReactPropertyName const ¬ificationName,
|
|
147
253
|
IReactDispatcher const &dispatcher,
|
|
148
254
|
ReactNotificationHandler const &handler) noexcept {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
255
|
+
VerifyElseCrashSz(notificationName, "notificationName must be not null");
|
|
256
|
+
VerifyElseCrashSz(handler, "handler must be not null");
|
|
257
|
+
|
|
258
|
+
IReactNotificationSubscription subscription =
|
|
259
|
+
make<ReactNotificationSubscription>(m_mutex, get_weak(), notificationName, dispatcher, handler);
|
|
260
|
+
AddSubscription(notificationName, subscription);
|
|
261
|
+
AddSubscriptionToParent(notificationName, subscription);
|
|
262
|
+
return subscription;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
void ReactNotificationService::AddSubscription(
|
|
266
|
+
IReactPropertyName const ¬ificationName,
|
|
267
|
+
IReactNotificationSubscription const &subscription) noexcept {
|
|
156
268
|
ModifySubscriptions(
|
|
157
269
|
notificationName, [&subscription](std::vector<IReactNotificationSubscription> const &snapshot) noexcept {
|
|
158
270
|
auto newSnapshot = std::vector<IReactNotificationSubscription>(snapshot);
|
|
159
271
|
newSnapshot.push_back(subscription);
|
|
160
272
|
return newSnapshot;
|
|
161
273
|
});
|
|
162
|
-
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
void ReactNotificationService::AddSubscriptionToParent(
|
|
277
|
+
IReactPropertyName const ¬ificationName,
|
|
278
|
+
IReactNotificationSubscription const &subscription) noexcept {
|
|
279
|
+
if (m_parentNotificationService) {
|
|
280
|
+
get_self<ReactNotificationService>(m_parentNotificationService)
|
|
281
|
+
->AddSubscriptionFromChild(notificationName, subscription);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
void ReactNotificationService::AddSubscriptionFromChild(
|
|
286
|
+
IReactPropertyName const ¬ificationName,
|
|
287
|
+
IReactNotificationSubscription const &childSubscription) noexcept {
|
|
288
|
+
auto subscription = make<ReactNotificationSubscriptionView>(get_weak(), childSubscription);
|
|
289
|
+
AddSubscription(notificationName, subscription);
|
|
290
|
+
AddSubscriptionToParent(notificationName, subscription);
|
|
163
291
|
}
|
|
164
292
|
|
|
165
293
|
void ReactNotificationService::Unsubscribe(IReactNotificationSubscription const &subscription) noexcept {
|
|
@@ -180,7 +308,7 @@ void ReactNotificationService::UnsubscribeAll() noexcept {
|
|
|
180
308
|
// The subscription will call the parent Unsubscribe on its own.
|
|
181
309
|
decltype(m_subscriptions) subscriptions;
|
|
182
310
|
{
|
|
183
|
-
std::scoped_lock lock{m_mutex};
|
|
311
|
+
std::scoped_lock lock{*m_mutex};
|
|
184
312
|
subscriptions = std::move(m_subscriptions);
|
|
185
313
|
}
|
|
186
314
|
|
|
@@ -203,7 +331,7 @@ void ReactNotificationService::SendNotification(
|
|
|
203
331
|
SubscriptionSnapshotPtr currentSnapshotPtr;
|
|
204
332
|
|
|
205
333
|
{
|
|
206
|
-
std::scoped_lock lock{m_mutex};
|
|
334
|
+
std::scoped_lock lock{*m_mutex};
|
|
207
335
|
auto it = m_subscriptions.find(notificationName);
|
|
208
336
|
if (it != m_subscriptions.end()) {
|
|
209
337
|
currentSnapshotPtr = it->second;
|
|
@@ -213,8 +341,7 @@ void ReactNotificationService::SendNotification(
|
|
|
213
341
|
// Call notification handlers outside of lock.
|
|
214
342
|
if (currentSnapshotPtr) {
|
|
215
343
|
for (auto &subscription : *currentSnapshotPtr) {
|
|
216
|
-
|
|
217
|
-
get_self<ReactNotificationSubscription>(subscription)->CallHandler(sender, args);
|
|
344
|
+
subscription.as<IReactNotificationSubscriptionPrivate>()->CallHandler(sender, data);
|
|
218
345
|
}
|
|
219
346
|
}
|
|
220
347
|
}
|
|
@@ -91,9 +91,19 @@ struct ReactNotificationService : implements<ReactNotificationService, IReactNot
|
|
|
91
91
|
IReactPropertyName const ¬ificationName,
|
|
92
92
|
Mso::FunctorRef<SubscriptionSnapshot(SubscriptionSnapshot const &)> const &modifySnapshot);
|
|
93
93
|
|
|
94
|
+
void AddSubscription(
|
|
95
|
+
IReactPropertyName const ¬ificationName,
|
|
96
|
+
IReactNotificationSubscription const &subscription) noexcept;
|
|
97
|
+
void AddSubscriptionToParent(
|
|
98
|
+
IReactPropertyName const ¬ificationName,
|
|
99
|
+
IReactNotificationSubscription const &subscription) noexcept;
|
|
100
|
+
void AddSubscriptionFromChild(
|
|
101
|
+
IReactPropertyName const ¬ificationName,
|
|
102
|
+
IReactNotificationSubscription const &childSubscription) noexcept;
|
|
103
|
+
|
|
94
104
|
private:
|
|
95
105
|
const IReactNotificationService m_parentNotificationService;
|
|
96
|
-
std::mutex m_mutex;
|
|
106
|
+
Mso::RefCountedPtr<std::mutex> m_mutex{Mso::Make_RefCounted<std::mutex>()};
|
|
97
107
|
std::unordered_map<IReactPropertyName, SubscriptionSnapshotPtr> m_subscriptions;
|
|
98
108
|
};
|
|
99
109
|
|
|
@@ -103,35 +113,6 @@ struct ReactNotificationServiceHelper {
|
|
|
103
113
|
static IReactNotificationService CreateNotificationService() noexcept;
|
|
104
114
|
};
|
|
105
115
|
|
|
106
|
-
struct ReactNotificationSubscription : implements<ReactNotificationSubscription, IReactNotificationSubscription> {
|
|
107
|
-
ReactNotificationSubscription(
|
|
108
|
-
IReactNotificationSubscription const &parentSubscription,
|
|
109
|
-
weak_ref<ReactNotificationService> &¬ificationService,
|
|
110
|
-
IReactPropertyName const ¬ificationName,
|
|
111
|
-
IReactDispatcher const &dispatcher) noexcept;
|
|
112
|
-
ReactNotificationSubscription(
|
|
113
|
-
weak_ref<ReactNotificationService> &¬ificationService,
|
|
114
|
-
IReactPropertyName const ¬ificationName,
|
|
115
|
-
IReactDispatcher const &dispatcher,
|
|
116
|
-
ReactNotificationHandler const &handler) noexcept;
|
|
117
|
-
~ReactNotificationSubscription() noexcept;
|
|
118
|
-
|
|
119
|
-
IReactNotificationService NotificationService() const noexcept;
|
|
120
|
-
IReactPropertyName NotificationName() const noexcept;
|
|
121
|
-
IReactDispatcher Dispatcher() const noexcept;
|
|
122
|
-
bool IsSubscribed() const noexcept;
|
|
123
|
-
void Unsubscribe() noexcept;
|
|
124
|
-
void CallHandler(IInspectable const &sender, IReactNotificationArgs const &args) noexcept;
|
|
125
|
-
|
|
126
|
-
private:
|
|
127
|
-
const IReactNotificationSubscription m_parentSubscription{nullptr};
|
|
128
|
-
const weak_ref<ReactNotificationService> m_notificationService;
|
|
129
|
-
const IReactPropertyName m_notificationName;
|
|
130
|
-
const IReactDispatcher m_dispatcher;
|
|
131
|
-
const ReactNotificationHandler m_handler;
|
|
132
|
-
std::atomic_bool m_isSubscribed{true};
|
|
133
|
-
};
|
|
134
|
-
|
|
135
116
|
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
136
117
|
|
|
137
118
|
namespace winrt::Microsoft::ReactNative::factory_implementation {
|
|
@@ -191,6 +191,15 @@ IInspectable ReactPropertyBag::Set(IReactPropertyName const &propertyName, IInsp
|
|
|
191
191
|
return result;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
void ReactPropertyBag::CopyFrom(IReactPropertyBag const &other) noexcept {
|
|
195
|
+
std::scoped_lock lock{m_mutex};
|
|
196
|
+
auto otherImpl = winrt::get_self<ReactPropertyBag>(other);
|
|
197
|
+
std::scoped_lock otherLock{otherImpl->m_mutex};
|
|
198
|
+
for (auto const &entry : otherImpl->m_entries) {
|
|
199
|
+
m_entries.emplace(entry);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
194
203
|
/*static*/ IReactPropertyNamespace ReactPropertyBagHelper::GlobalNamespace() noexcept {
|
|
195
204
|
return ReactPropertyNamespace::GlobalNamespace().as<IReactPropertyNamespace>();
|
|
196
205
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#pragma once
|
|
5
5
|
#include "ReactPropertyBagHelper.g.h"
|
|
6
|
+
#include <winrt/Windows.Foundation.Collections.h>
|
|
6
7
|
|
|
7
8
|
namespace winrt::Microsoft::ReactNative::implementation {
|
|
8
9
|
|
|
@@ -13,6 +14,8 @@ struct ReactPropertyBag : implements<ReactPropertyBag, IReactPropertyBag> {
|
|
|
13
14
|
IInspectable GetOrCreate(IReactPropertyName const &name, ReactCreatePropertyValue const &createValue) noexcept;
|
|
14
15
|
IInspectable Set(IReactPropertyName const &name, IInspectable const &value) noexcept;
|
|
15
16
|
|
|
17
|
+
void CopyFrom(IReactPropertyBag const &) noexcept;
|
|
18
|
+
|
|
16
19
|
private:
|
|
17
20
|
std::mutex m_mutex;
|
|
18
21
|
std::map<IReactPropertyName, IInspectable> m_entries;
|
|
@@ -62,6 +62,9 @@ namespace Microsoft.ReactNative
|
|
|
62
62
|
"It returns null if the property did not exist.\n"
|
|
63
63
|
"If the new value is null, then the property is removed.")
|
|
64
64
|
Object Set(IReactPropertyName name, Object value);
|
|
65
|
+
|
|
66
|
+
DOC_STRING("Copies the properties from another property bag")
|
|
67
|
+
void CopyFrom(IReactPropertyBag other);
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
[webhosthidden]
|
|
@@ -63,6 +63,11 @@ struct PointerAccessor : facebook::jsi::Pointer {
|
|
|
63
63
|
return {reinterpret_cast<uint64_t>(std::exchange(accessor.ptr_, nullptr))};
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
static JsiBigIntRef MakeJsiBigIntData(facebook::jsi::BigInt &&bigInt) {
|
|
67
|
+
auto &&accessor = AsPointerAccessor(std::move(bigInt));
|
|
68
|
+
return {reinterpret_cast<uint64_t>(std::exchange(accessor.ptr_, nullptr))};
|
|
69
|
+
}
|
|
70
|
+
|
|
66
71
|
static JsiStringRef MakeJsiStringData(facebook::jsi::String &&str) {
|
|
67
72
|
auto &&accessor = AsPointerAccessor(std::move(str));
|
|
68
73
|
return {reinterpret_cast<uint64_t>(std::exchange(accessor.ptr_, nullptr))};
|
|
@@ -101,6 +106,7 @@ struct PointerAccessor : facebook::jsi::Pointer {
|
|
|
101
106
|
struct ValueAccessor {
|
|
102
107
|
static JsiValueRef ToJsiValueData(facebook::jsi::Value const &value) noexcept {
|
|
103
108
|
ValueAccessor const &accessor = reinterpret_cast<ValueAccessor const &>(value);
|
|
109
|
+
// TODO: JSIVALUECONVERSION - Use JsiValueKindHelper::ToJsiValueKind
|
|
104
110
|
return {
|
|
105
111
|
static_cast<JsiValueKind>(static_cast<int32_t>(accessor.m_kind)),
|
|
106
112
|
*reinterpret_cast<uint64_t const *>(&accessor.m_data)};
|
|
@@ -108,12 +114,14 @@ struct ValueAccessor {
|
|
|
108
114
|
|
|
109
115
|
static JsiValueRef MakeJsiValueData(facebook::jsi::Value &&value) {
|
|
110
116
|
ValueAccessor &&accessor = reinterpret_cast<ValueAccessor &&>(value);
|
|
117
|
+
// TODO: JSIVALUECONVERSION - Use JsiValueKindHelper::ToJsiValueKind
|
|
111
118
|
return {
|
|
112
119
|
static_cast<JsiValueKind>(static_cast<int32_t>(std::exchange(accessor.m_kind, UndefinedKind))),
|
|
113
120
|
*reinterpret_cast<uint64_t *>(&accessor.m_data)};
|
|
114
121
|
}
|
|
115
122
|
|
|
116
123
|
private:
|
|
124
|
+
// TODO: JSIVALUECONVERSION - Use FacebookJsiValueKind enum
|
|
117
125
|
enum ValueKind { UndefinedKind } m_kind;
|
|
118
126
|
double m_data;
|
|
119
127
|
|
|
@@ -133,6 +141,7 @@ struct RuntimeAccessor : facebook::jsi::Runtime {
|
|
|
133
141
|
|
|
134
142
|
using facebook::jsi::Runtime::call;
|
|
135
143
|
using facebook::jsi::Runtime::callAsConstructor;
|
|
144
|
+
using facebook::jsi::Runtime::cloneBigInt;
|
|
136
145
|
using facebook::jsi::Runtime::cloneObject;
|
|
137
146
|
using facebook::jsi::Runtime::clonePropNameID;
|
|
138
147
|
using facebook::jsi::Runtime::cloneString;
|
|
@@ -182,6 +191,10 @@ struct RuntimeAccessor : facebook::jsi::Runtime {
|
|
|
182
191
|
return *reinterpret_cast<facebook::jsi::Symbol const *>(ptr);
|
|
183
192
|
}
|
|
184
193
|
|
|
194
|
+
static facebook::jsi::BigInt const &AsBigInt(facebook::jsi::Runtime::PointerValue const **ptr) noexcept {
|
|
195
|
+
return *reinterpret_cast<facebook::jsi::BigInt const *>(ptr);
|
|
196
|
+
}
|
|
197
|
+
|
|
185
198
|
static facebook::jsi::String const &AsString(facebook::jsi::Runtime::PointerValue const **ptr) noexcept {
|
|
186
199
|
return *reinterpret_cast<facebook::jsi::String const *>(ptr);
|
|
187
200
|
}
|
|
@@ -207,6 +220,7 @@ struct RuntimeAccessor : facebook::jsi::Runtime {
|
|
|
207
220
|
}
|
|
208
221
|
|
|
209
222
|
static facebook::jsi::Value const *AsValue(JsiValueRef const &data) noexcept {
|
|
223
|
+
// TODO: JSIVALUECONVERSION
|
|
210
224
|
return reinterpret_cast<facebook::jsi::Value const *>(&data);
|
|
211
225
|
}
|
|
212
226
|
|
|
@@ -214,6 +228,10 @@ struct RuntimeAccessor : facebook::jsi::Runtime {
|
|
|
214
228
|
return {reinterpret_cast<uint64_t>(pointerValue)};
|
|
215
229
|
}
|
|
216
230
|
|
|
231
|
+
static JsiBigIntRef MakeJsiBigIntData(facebook::jsi::Runtime::PointerValue *pointerValue) {
|
|
232
|
+
return {reinterpret_cast<uint64_t>(pointerValue)};
|
|
233
|
+
}
|
|
234
|
+
|
|
217
235
|
static JsiStringRef MakeJsiStringData(facebook::jsi::Runtime::PointerValue *pointerValue) {
|
|
218
236
|
return {reinterpret_cast<uint64_t>(pointerValue)};
|
|
219
237
|
}
|
|
@@ -232,10 +250,12 @@ struct RuntimeAccessor : facebook::jsi::Runtime {
|
|
|
232
250
|
}
|
|
233
251
|
|
|
234
252
|
static JsiValueRef const *AsJsiValueData(facebook::jsi::Value const *value) noexcept {
|
|
235
|
-
|
|
253
|
+
auto ref = ValueAccessor::ToJsiValueData(*value);
|
|
254
|
+
return &ref;
|
|
236
255
|
}
|
|
237
256
|
|
|
238
257
|
static facebook::jsi::Value &&ToValue(JsiValueRef &&value) noexcept {
|
|
258
|
+
// TODO: JSIVALUECONVERSION
|
|
239
259
|
return reinterpret_cast<facebook::jsi::Value &&>(value);
|
|
240
260
|
}
|
|
241
261
|
|
|
@@ -522,6 +542,13 @@ JsiSymbolRef JsiRuntime::CloneSymbol(JsiSymbolRef symbol) try {
|
|
|
522
542
|
throw;
|
|
523
543
|
}
|
|
524
544
|
|
|
545
|
+
JsiBigIntRef JsiRuntime::CloneBigInt(JsiBigIntRef bigInt) try {
|
|
546
|
+
return PointerAccessor::MakeJsiBigIntData(m_runtimeAccessor->make<facebook::jsi::BigInt>(
|
|
547
|
+
m_runtimeAccessor->cloneBigInt(RuntimeAccessor::AsPointerValue(bigInt))));
|
|
548
|
+
} catch (JSI_SET_ERROR) {
|
|
549
|
+
throw;
|
|
550
|
+
}
|
|
551
|
+
|
|
525
552
|
JsiStringRef JsiRuntime::CloneString(JsiStringRef str) try {
|
|
526
553
|
return PointerAccessor::MakeJsiStringData(m_runtimeAccessor->make<facebook::jsi::String>(
|
|
527
554
|
m_runtimeAccessor->cloneString(RuntimeAccessor::AsPointerValue(str))));
|
|
@@ -920,6 +947,14 @@ bool JsiRuntime::SymbolStrictEquals(JsiSymbolRef left, JsiSymbolRef right) try {
|
|
|
920
947
|
throw;
|
|
921
948
|
}
|
|
922
949
|
|
|
950
|
+
bool JsiRuntime::BigIntStrictEquals(JsiBigIntRef left, JsiBigIntRef right) try {
|
|
951
|
+
auto leftPtr = RuntimeAccessor::AsPointerValue(left);
|
|
952
|
+
auto rightPtr = RuntimeAccessor::AsPointerValue(right);
|
|
953
|
+
return m_runtimeAccessor->strictEquals(RuntimeAccessor::AsBigInt(&leftPtr), RuntimeAccessor::AsBigInt(&rightPtr));
|
|
954
|
+
} catch (JSI_SET_ERROR) {
|
|
955
|
+
throw;
|
|
956
|
+
}
|
|
957
|
+
|
|
923
958
|
bool JsiRuntime::StringStrictEquals(JsiStringRef left, JsiStringRef right) try {
|
|
924
959
|
auto leftPtr = RuntimeAccessor::AsPointerValue(left);
|
|
925
960
|
auto rightPtr = RuntimeAccessor::AsPointerValue(right);
|
|
@@ -949,6 +984,11 @@ void JsiRuntime::ReleaseSymbol(JsiSymbolRef const &symbolData) {
|
|
|
949
984
|
RuntimeAccessor::make<facebook::jsi::Symbol>(reinterpret_cast<RuntimeAccessor::PointerValue *>(symbolData.Data));
|
|
950
985
|
}
|
|
951
986
|
|
|
987
|
+
void JsiRuntime::ReleaseBigInt(JsiBigIntRef const &bigIntData) {
|
|
988
|
+
auto bigInt =
|
|
989
|
+
RuntimeAccessor::make<facebook::jsi::BigInt>(reinterpret_cast<RuntimeAccessor::PointerValue *>(bigIntData.Data));
|
|
990
|
+
}
|
|
991
|
+
|
|
952
992
|
void JsiRuntime::ReleaseString(JsiStringRef const &stringData) {
|
|
953
993
|
auto str =
|
|
954
994
|
RuntimeAccessor::make<facebook::jsi::String>(reinterpret_cast<RuntimeAccessor::PointerValue *>(stringData.Data));
|
|
@@ -82,6 +82,7 @@ struct JsiRuntime : JsiRuntimeT<JsiRuntime> {
|
|
|
82
82
|
bool IsInspectable();
|
|
83
83
|
|
|
84
84
|
JsiSymbolRef CloneSymbol(JsiSymbolRef symbol);
|
|
85
|
+
JsiBigIntRef CloneBigInt(JsiBigIntRef bigInt);
|
|
85
86
|
JsiStringRef CloneString(JsiStringRef str);
|
|
86
87
|
JsiObjectRef CloneObject(JsiObjectRef obj);
|
|
87
88
|
JsiPropertyIdRef ClonePropertyId(JsiPropertyIdRef propertyId);
|
|
@@ -142,11 +143,13 @@ struct JsiRuntime : JsiRuntimeT<JsiRuntime> {
|
|
|
142
143
|
void PopScope(JsiScopeState scopeState);
|
|
143
144
|
|
|
144
145
|
bool SymbolStrictEquals(JsiSymbolRef left, JsiSymbolRef right);
|
|
146
|
+
bool BigIntStrictEquals(JsiBigIntRef left, JsiBigIntRef right);
|
|
145
147
|
bool StringStrictEquals(JsiStringRef left, JsiStringRef right);
|
|
146
148
|
bool ObjectStrictEquals(JsiObjectRef left, JsiObjectRef right);
|
|
147
149
|
bool InstanceOf(JsiObjectRef obj, JsiObjectRef constructor);
|
|
148
150
|
|
|
149
151
|
void ReleaseSymbol(JsiSymbolRef const &symbol);
|
|
152
|
+
void ReleaseBigInt(JsiBigIntRef const &bigInt);
|
|
150
153
|
void ReleaseString(JsiStringRef const &str);
|
|
151
154
|
void ReleaseObject(JsiObjectRef const &obj);
|
|
152
155
|
void ReleasePropertyId(JsiPropertyIdRef const &propertyId);
|
|
@@ -50,7 +50,7 @@ namespace Microsoft.ReactNative
|
|
|
50
50
|
void GetData(JsiByteArrayUser useBytes);
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
// Type of the JavaScript value. It is currently matching the full JavaScript set of types
|
|
53
|
+
// Type of the JavaScript value. It is currently matching the full JavaScript set of types.
|
|
54
54
|
[experimental]
|
|
55
55
|
DOC_STRING(
|
|
56
56
|
"An experimental API. Do not use it directly. "
|
|
@@ -65,8 +65,10 @@ namespace Microsoft.ReactNative
|
|
|
65
65
|
Boolean,
|
|
66
66
|
Number,
|
|
67
67
|
Symbol,
|
|
68
|
+
BigInt, // TODO: JSIVALUECONVERSION - This is where RN wants to put the new enum
|
|
68
69
|
String,
|
|
69
70
|
Object,
|
|
71
|
+
// BigInt, // TODO: JSIVALUECONVERSION - This is where we WANT to put the new enum
|
|
70
72
|
};
|
|
71
73
|
|
|
72
74
|
[experimental, webhosthidden]
|
|
@@ -94,6 +96,19 @@ namespace Microsoft.ReactNative
|
|
|
94
96
|
UInt64 Data;
|
|
95
97
|
};
|
|
96
98
|
|
|
99
|
+
[experimental]
|
|
100
|
+
DOC_STRING(
|
|
101
|
+
"An experimental API. Do not use it directly. "
|
|
102
|
+
"It may be removed or changed in a future version. Instead, use the JSI API that uses this API internally.\n"
|
|
103
|
+
"See the `ExecuteJsi` method in `JsiApiContext.h` of the `Microsoft.ReactNative.Cxx` shared project, "
|
|
104
|
+
"or the examples of the JSI-based TurboModules in the `Microsoft.ReactNative.IntegrationTests` project.\n"
|
|
105
|
+
"Note that the JSI is defined only for C++ code. We plan to add the .Net support in future.")
|
|
106
|
+
struct JsiBigIntRef
|
|
107
|
+
{
|
|
108
|
+
UInt64 Data;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
|
|
97
112
|
[experimental]
|
|
98
113
|
DOC_STRING(
|
|
99
114
|
"An experimental API. Do not use it directly. "
|
|
@@ -238,6 +253,7 @@ namespace Microsoft.ReactNative
|
|
|
238
253
|
Boolean IsInspectable { get; };
|
|
239
254
|
|
|
240
255
|
JsiSymbolRef CloneSymbol(JsiSymbolRef symbol);
|
|
256
|
+
JsiBigIntRef CloneBigInt (JsiBigIntRef bigInt);
|
|
241
257
|
JsiStringRef CloneString(JsiStringRef str);
|
|
242
258
|
JsiObjectRef CloneObject(JsiObjectRef obj);
|
|
243
259
|
JsiPropertyIdRef ClonePropertyId(JsiPropertyIdRef propertyId);
|
|
@@ -297,12 +313,14 @@ namespace Microsoft.ReactNative
|
|
|
297
313
|
void PopScope(JsiScopeState scopeState);
|
|
298
314
|
|
|
299
315
|
Boolean SymbolStrictEquals(JsiSymbolRef left, JsiSymbolRef right);
|
|
316
|
+
Boolean BigIntStrictEquals(JsiBigIntRef left, JsiBigIntRef right);
|
|
300
317
|
Boolean StringStrictEquals(JsiStringRef left, JsiStringRef right);
|
|
301
318
|
Boolean ObjectStrictEquals(JsiObjectRef left, JsiObjectRef right);
|
|
302
319
|
|
|
303
320
|
Boolean InstanceOf(JsiObjectRef obj, JsiObjectRef constructor);
|
|
304
321
|
|
|
305
322
|
void ReleaseSymbol(JsiSymbolRef symbol);
|
|
323
|
+
void ReleaseBigInt(JsiBigIntRef bigInt);
|
|
306
324
|
void ReleaseString(JsiStringRef str);
|
|
307
325
|
void ReleaseObject(JsiObjectRef obj);
|
|
308
326
|
void ReleasePropertyId(JsiPropertyIdRef propertyId);
|