react-native-windows 0.78.4 → 0.78.6
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/Directory.Build.props +6 -4
- package/Folly/Folly.vcxproj +46 -6
- package/Folly/Folly.vcxproj.filters +16 -4
- package/Folly/TEMP_UntilFollyUpdate/ConstexprMath.h +26 -18
- package/Folly/TEMP_UntilFollyUpdate/Conv.cpp +1205 -0
- package/Folly/TEMP_UntilFollyUpdate/chrono/Hardware.h +155 -0
- package/Folly/TEMP_UntilFollyUpdate/concurrency/CacheLocality.cpp +633 -0
- package/Folly/TEMP_UntilFollyUpdate/{dynamic-inl.h → json/dynamic-inl.h} +3 -4
- package/Folly/TEMP_UntilFollyUpdate/{json.cpp → json/json.cpp} +14 -10
- package/Folly/TEMP_UntilFollyUpdate/lang/SafeAssert.h +7 -14
- package/Folly/TEMP_UntilFollyUpdate/lang/ToAscii.h +6 -6
- package/Folly/ThreadNameStub.cpp +10 -0
- package/Folly/cgmanifest.json +11 -1
- package/Libraries/Components/View/View.windows.js +107 -56
- package/Libraries/Components/View/ViewAccessibility.d.ts +60 -1
- package/Libraries/Image/Image.windows.js +42 -21
- package/Libraries/Modal/Modal.d.ts +7 -0
- package/Libraries/Modal/Modal.windows.js +7 -1
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +3 -0
- package/Libraries/Text/Text.d.ts +18 -0
- package/Microsoft.ReactNative/AsynchronousEventBeat.cpp +4 -25
- package/Microsoft.ReactNative/AsynchronousEventBeat.h +0 -3
- package/Microsoft.ReactNative/Base/FollyIncludes.h +1 -0
- package/Microsoft.ReactNative/CallInvoker.cpp +42 -0
- package/Microsoft.ReactNative/CallInvoker.h +34 -0
- package/Microsoft.ReactNative/{JSDispatcherWriter.cpp → CallInvokerWriter.cpp} +35 -47
- package/Microsoft.ReactNative/CallInvokerWriter.h +74 -0
- package/Microsoft.ReactNative/CompositionComponentView.idl +0 -5
- package/Microsoft.ReactNative/CompositionSwitcher.idl +7 -0
- package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +8 -10
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +12 -2
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.cpp +100 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.h +31 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +77 -11
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +43 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +7 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +86 -56
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +5 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +0 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService.cpp +0 -2
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +118 -63
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +133 -8
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +16 -2
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.cpp +4 -2
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.h +9 -1
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +34 -11
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +3 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +133 -135
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +9 -6
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +46 -49
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +6 -1
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +13 -8
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +5 -2
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +146 -25
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +14 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +160 -12
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +6 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.cpp +47 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.h +15 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputProps.cpp +6 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputProps.h +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +7 -9
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +5 -0
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +40 -36
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +68 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +11 -0
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +70 -13
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +10 -2
- package/Microsoft.ReactNative/Fabric/ImageManager.cpp +5 -5
- package/Microsoft.ReactNative/Fabric/ImageRequestParams.cpp +26 -0
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +47 -8
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.h +10 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/CompositionAccessibilityProps.h +67 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.cpp +22 -4
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.h +15 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +20 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +5 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/MouseEvent.h +20 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/HostPlatformColor.h +5 -8
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorParser.h +1 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +247 -45
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.h +15 -0
- package/Microsoft.ReactNative/Fabric/platform/react/threading/MessageQueueThreadImpl.cpp +39 -0
- package/Microsoft.ReactNative/Fabric/platform/react/threading/MessageQueueThreadImpl.h +54 -0
- package/Microsoft.ReactNative/Fabric/platform/react/threading/TaskDispatchThread.cpp +126 -0
- package/Microsoft.ReactNative/Fabric/platform/react/threading/TaskDispatchThread.h +73 -0
- package/Microsoft.ReactNative/IReactContext.cpp +17 -0
- package/Microsoft.ReactNative/IReactContext.h +1 -0
- package/Microsoft.ReactNative/IReactContext.idl +18 -1
- package/Microsoft.ReactNative/IReactDispatcher.idl +1 -0
- package/Microsoft.ReactNative/IReactModuleBuilder.cpp +12 -0
- package/Microsoft.ReactNative/IReactModuleBuilder.h +2 -0
- package/Microsoft.ReactNative/IReactModuleBuilder.idl +8 -0
- package/Microsoft.ReactNative/JsiApi.cpp +10 -2
- package/Microsoft.ReactNative/JsiApi.h +1 -0
- package/Microsoft.ReactNative/JsiApi.idl +1 -0
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +0 -3
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +2 -3
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +7 -12
- package/Microsoft.ReactNative/Modules/Animated/AnimationDriver.cpp +2 -1
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedModule.cpp +4 -8
- package/Microsoft.ReactNative/Modules/AppStateModule.cpp +2 -2
- package/Microsoft.ReactNative/Modules/ClipboardModule.cpp +6 -8
- package/Microsoft.ReactNative/Modules/ClipboardModule.h +1 -1
- package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +6 -15
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +13 -24
- package/Microsoft.ReactNative/QuirkSettings.cpp +0 -16
- package/Microsoft.ReactNative/QuirkSettings.h +0 -3
- package/Microsoft.ReactNative/ReactHost/ReactHost.cpp +11 -1
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +78 -68
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -2
- package/Microsoft.ReactNative/ReactInstanceSettings.cpp +12 -0
- package/Microsoft.ReactNative/ReactInstanceSettings.h +2 -0
- package/Microsoft.ReactNative/ReactInstanceSettings.idl +6 -0
- package/Microsoft.ReactNative/ReactNativeIsland.idl +3 -0
- package/Microsoft.ReactNative/ReactSupport.cpp +44 -11
- package/Microsoft.ReactNative/RedBox.cpp +30 -1
- package/Microsoft.ReactNative/SchedulerSettings.cpp +4 -4
- package/Microsoft.ReactNative/SchedulerSettings.h +1 -1
- package/Microsoft.ReactNative/TurboModulesProvider.cpp +30 -12
- package/Microsoft.ReactNative/Utils/ImageUtils.h +1 -0
- package/Microsoft.ReactNative/Utils/LocalBundleReader.cpp +37 -31
- package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.cpp +1 -0
- package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.inc +2 -0
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi_posix.cpp +1 -1
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.cpp +94 -27
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +27 -6
- package/Microsoft.ReactNative.Cxx/JSI/JsiApiContext.cpp +45 -11
- package/Microsoft.ReactNative.Cxx/JSI/JsiApiContext.h +6 -0
- package/Microsoft.ReactNative.Cxx/JSI/decorator.h +220 -0
- package/Microsoft.ReactNative.Cxx/JSI/instrumentation.h +28 -0
- package/Microsoft.ReactNative.Cxx/JSI/jsi-inl.h +6 -0
- package/Microsoft.ReactNative.Cxx/JSI/jsi.cpp +241 -4
- package/Microsoft.ReactNative.Cxx/JSI/jsi.h +207 -19
- package/Microsoft.ReactNative.Cxx/JSValue.cpp +19 -3
- package/Microsoft.ReactNative.Cxx/JSValue.h +15 -7
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +2 -2
- package/Microsoft.ReactNative.Cxx/NativeModules.h +60 -2
- package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.cpp +1267 -614
- package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.h +4 -2
- package/Microsoft.ReactNative.Cxx/ReactContext.h +7 -0
- package/Microsoft.ReactNative.Cxx/TurboModuleProvider.cpp +11 -13
- package/Microsoft.ReactNative.Cxx/TurboModuleProvider.h +2 -3
- package/Microsoft.ReactNative.Cxx/node-api/js_native_api.h +81 -20
- package/Microsoft.ReactNative.Cxx/node-api/js_native_api_types.h +47 -2
- package/Microsoft.ReactNative.Cxx/node-api/js_runtime_api.h +13 -0
- package/Microsoft.ReactNative.Cxx/stubs/glog/logging.h +1 -1
- package/Microsoft.ReactNative.Managed/ReactContext.cs +3 -1
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/JSEngine.props +1 -1
- package/PropertySheets/React.Cpp.props +2 -1
- package/PropertySheets/WebView2.props +1 -1
- package/PropertySheets/WinUI.props +2 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jserrorhandler/JsErrorHandler.cpp +429 -0
- package/ReactCommon/cgmanifest.json +1 -1
- package/Shared/HermesRuntimeHolder.cpp +6 -0
- package/Shared/JSI/ChakraRuntime.cpp +4 -0
- package/Shared/JSI/ChakraRuntime.h +2 -0
- package/Shared/Modules/BlobModule.cpp +14 -16
- package/Shared/Modules/BlobModule.h +3 -1
- package/Shared/Networking/WinRTWebSocketResource.cpp +82 -101
- package/Shared/Networking/WinRTWebSocketResource.h +91 -7
- package/Shared/Shared.vcxitems +11 -7
- package/Shared/Shared.vcxitems.filters +6 -1
- package/Shared/TurboModuleManager.cpp +0 -15
- package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +6 -6
- package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +6 -6
- package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +6 -6
- package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +6 -6
- package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +6 -6
- package/codegen/react/components/rnwcore/AndroidSwitch.g.h +6 -6
- package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +6 -6
- package/codegen/react/components/rnwcore/InputAccessory.g.h +6 -6
- package/codegen/react/components/rnwcore/ModalHostView.g.h +11 -7
- package/codegen/react/components/rnwcore/Props.cpp +2 -1
- package/codegen/react/components/rnwcore/Props.h +1 -0
- package/codegen/react/components/rnwcore/PullToRefreshView.g.h +6 -6
- package/codegen/react/components/rnwcore/SafeAreaView.g.h +6 -6
- package/codegen/react/components/rnwcore/Switch.g.h +6 -6
- package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +6 -6
- package/index.windows.js +4 -2
- package/package.json +3 -4
- package/src/private/specs/components/RCTModalHostViewNativeComponent.js +8 -0
- package/stubs/glog/logging.h +1 -1
- package/Microsoft.ReactNative/JSDispatcherWriter.h +0 -47
- package/Microsoft.ReactNative/SynchronousEventBeat.cpp +0 -51
- package/Microsoft.ReactNative/SynchronousEventBeat.h +0 -31
|
@@ -181,17 +181,25 @@ bool operator!=(JSValueArray const &left, JSValueArray const &right) noexcept;
|
|
|
181
181
|
//! For copy operations the explicit Copy() method must be used.
|
|
182
182
|
//! Note that the move operations are not thread safe.
|
|
183
183
|
struct JSValue {
|
|
184
|
-
//! JSValue with JSValueType::Null.
|
|
184
|
+
//! JSValue with JSValueType::Null. - Maybe removed in future version - replaced with NullRef
|
|
185
185
|
static JSValue const Null;
|
|
186
|
+
//! JSValue with JSValueType::Null.
|
|
187
|
+
static const JSValue &NullRef() noexcept;
|
|
186
188
|
|
|
187
|
-
//! JSValue with empty object.
|
|
189
|
+
//! JSValue with empty object. - Maybe removed in future version - replaced with EmptyObjectRef
|
|
188
190
|
static JSValue const EmptyObject;
|
|
191
|
+
//! JSValue with empty object.
|
|
192
|
+
static const JSValue &EmptyObjectRef() noexcept;
|
|
189
193
|
|
|
190
|
-
//! JSValue with empty array.
|
|
194
|
+
//! JSValue with empty array. - Maybe removed in future version - replaced with EmptyArrayRef
|
|
191
195
|
static JSValue const EmptyArray;
|
|
196
|
+
//! JSValue with empty array.
|
|
197
|
+
static const JSValue &EmptyArrayRef() noexcept;
|
|
192
198
|
|
|
193
|
-
//! JSValue with empty string.
|
|
199
|
+
//! JSValue with empty string. - Maybe removed in future version - replaced with EmptyStringRef
|
|
194
200
|
static JSValue const EmptyString;
|
|
201
|
+
//! JSValue with empty string.
|
|
202
|
+
static const JSValue &EmptyStringRef() noexcept;
|
|
195
203
|
|
|
196
204
|
//! Create a Null JSValue.
|
|
197
205
|
JSValue() noexcept;
|
|
@@ -654,11 +662,11 @@ inline double const *JSValue::TryGetDouble() const noexcept {
|
|
|
654
662
|
}
|
|
655
663
|
|
|
656
664
|
inline JSValueObject const &JSValue::AsObject() const noexcept {
|
|
657
|
-
return (m_type == JSValueType::Object) ? m_object :
|
|
665
|
+
return (m_type == JSValueType::Object) ? m_object : EmptyObjectRef().m_object;
|
|
658
666
|
}
|
|
659
667
|
|
|
660
668
|
inline JSValueArray const &JSValue::AsArray() const noexcept {
|
|
661
|
-
return (m_type == JSValueType::Array) ? m_array :
|
|
669
|
+
return (m_type == JSValueType::Array) ? m_array : EmptyArrayRef().m_array;
|
|
662
670
|
}
|
|
663
671
|
|
|
664
672
|
inline int8_t JSValue::AsInt8() const noexcept {
|
|
@@ -860,7 +868,7 @@ inline const JSValueArray &JSValue::Array() const noexcept {
|
|
|
860
868
|
}
|
|
861
869
|
|
|
862
870
|
inline const std::string &JSValue::String() const noexcept {
|
|
863
|
-
return (m_type == JSValueType::String) ? m_string :
|
|
871
|
+
return (m_type == JSValueType::String) ? m_string : EmptyStringRef().m_string;
|
|
864
872
|
}
|
|
865
873
|
|
|
866
874
|
inline bool JSValue::Boolean() const noexcept {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<!-- If your project is using glog, then GLog_IncludeDir could be set to include the actual location of glog -->
|
|
15
15
|
<GLog_IncludeDir Condition="'$(GLog_IncludeDir)' == '' AND Exists('$(MSBuildThisFileDirectory)stubs\glog\logging.h')">$(MSBuildThisFileDirectory)stubs</GLog_IncludeDir>
|
|
16
16
|
|
|
17
|
-
<NodeApiJsiCommitHash>
|
|
17
|
+
<NodeApiJsiCommitHash>980cb60d7911237d0f647fc566543ef627adac70</NodeApiJsiCommitHash>
|
|
18
18
|
<NodeApiJsiLocal Condition="Exists('$(MSBuildThisFileDirectory)NodeApiJsiRuntime.cpp')">true</NodeApiJsiLocal>
|
|
19
19
|
<NodeApiJsiDir Condition="'$(NodeApiJsiDir)' == '' AND '$(NodeApiJsiLocal)' == 'true'">$(MSBuildThisFileDirectory)</NodeApiJsiDir>
|
|
20
20
|
<NodeApiJsiDir Condition="'$(NodeApiJsiDir)' == '' AND '$(ReactNativeDir)' != ''">$(ReactNativeDir)\..\..\node_modules\.node-api-jsi\node-api-jsi-$(NodeApiJsiCommitHash)\</NodeApiJsiDir>
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
$(NodeApiJsiSrcDir);
|
|
36
36
|
%(AdditionalIncludeDirectories)
|
|
37
37
|
</AdditionalIncludeDirectories>
|
|
38
|
-
<PreprocessorDefinitions>JSI_VERSION=
|
|
38
|
+
<PreprocessorDefinitions>JSI_VERSION=19;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
39
39
|
</ClCompile>
|
|
40
40
|
<Midl>
|
|
41
41
|
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
#pragma once
|
|
8
8
|
#include <winrt/Microsoft.ReactNative.h>
|
|
9
9
|
#include <winrt/Windows.Foundation.h>
|
|
10
|
+
#include "JSI/JsiApiContext.h"
|
|
10
11
|
#include "JSValueReader.h"
|
|
11
12
|
#include "JSValueWriter.h"
|
|
12
13
|
#include "ModuleRegistration.h"
|
|
@@ -411,6 +412,26 @@ constexpr bool MatchInputArg<std::string, std::wstring>() noexcept {
|
|
|
411
412
|
return true;
|
|
412
413
|
}
|
|
413
414
|
|
|
415
|
+
template <>
|
|
416
|
+
constexpr bool MatchInputArg<std::string, winrt::hstring>() noexcept {
|
|
417
|
+
return true;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
template <>
|
|
421
|
+
constexpr bool MatchInputArg<winrt::hstring, std::string>() noexcept {
|
|
422
|
+
return true;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
template <>
|
|
426
|
+
constexpr bool MatchInputArg<std::wstring, winrt::hstring>() noexcept {
|
|
427
|
+
return true;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
template <>
|
|
431
|
+
constexpr bool MatchInputArg<winrt::hstring, std::wstring>() noexcept {
|
|
432
|
+
return true;
|
|
433
|
+
}
|
|
434
|
+
|
|
414
435
|
template <class TResult, class TInputArgs, class TOutputCallbacks, class TOutputPromises>
|
|
415
436
|
struct MethodSignature {
|
|
416
437
|
using Result = TResult;
|
|
@@ -480,6 +501,7 @@ template <class TModule>
|
|
|
480
501
|
struct ModuleInitMethodInfo<void (TModule::*)(ReactContext const &) noexcept> {
|
|
481
502
|
using ModuleType = TModule;
|
|
482
503
|
using MethodType = void (TModule::*)(ReactContext const &) noexcept;
|
|
504
|
+
using JsiMethodType = void (TModule::*)(ReactContext const &, facebook::jsi::Runtime &) noexcept;
|
|
483
505
|
|
|
484
506
|
static InitializerDelegate GetInitializer(void *module, MethodType method) noexcept {
|
|
485
507
|
return [module = static_cast<ModuleType *>(module), method](ReactContext const &reactContext) noexcept {
|
|
@@ -488,6 +510,23 @@ struct ModuleInitMethodInfo<void (TModule::*)(ReactContext const &) noexcept> {
|
|
|
488
510
|
}
|
|
489
511
|
};
|
|
490
512
|
|
|
513
|
+
template <class TMethod>
|
|
514
|
+
struct ModuleJsiInitMethodInfo;
|
|
515
|
+
|
|
516
|
+
template <class TModule>
|
|
517
|
+
struct ModuleJsiInitMethodInfo<void (TModule::*)(ReactContext const &, facebook::jsi::Runtime &) noexcept> {
|
|
518
|
+
using ModuleType = TModule;
|
|
519
|
+
using MethodType = void (TModule::*)(ReactContext const &, facebook::jsi::Runtime &) noexcept;
|
|
520
|
+
|
|
521
|
+
static JsiInitializerDelegate GetJsiInitializer(void *module, MethodType method) noexcept {
|
|
522
|
+
return
|
|
523
|
+
[module = static_cast<ModuleType *>(module), method](
|
|
524
|
+
ReactContext const &reactContext, winrt::Windows::Foundation::IInspectable const &runtimeHandle) noexcept {
|
|
525
|
+
(module->*method)(reactContext, GetOrCreateContextRuntime(reactContext, runtimeHandle));
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
|
|
491
530
|
// ==== MakeCallbackSignatures =================================================
|
|
492
531
|
|
|
493
532
|
template <class TResult, class TOutputCallbackTuple>
|
|
@@ -1021,6 +1060,9 @@ struct ReactModuleBuilder {
|
|
|
1021
1060
|
for (auto &initializer : m_initializers) {
|
|
1022
1061
|
m_moduleBuilder.AddInitializer(initializer);
|
|
1023
1062
|
}
|
|
1063
|
+
for (auto &initializer : m_jsiinitializers) {
|
|
1064
|
+
m_moduleBuilder.AddJsiInitializer(initializer);
|
|
1065
|
+
}
|
|
1024
1066
|
}
|
|
1025
1067
|
|
|
1026
1068
|
template <class TMember, class TAttribute, int I>
|
|
@@ -1049,8 +1091,14 @@ struct ReactModuleBuilder {
|
|
|
1049
1091
|
|
|
1050
1092
|
template <class TMethod>
|
|
1051
1093
|
void RegisterInitMethod(TMethod method) noexcept {
|
|
1052
|
-
|
|
1053
|
-
|
|
1094
|
+
if constexpr (ModuleMethodInfo<TMethod>::ArgCount == 1) {
|
|
1095
|
+
auto initializer = ModuleInitMethodInfo<TMethod>::GetInitializer(m_module, method);
|
|
1096
|
+
m_initializers.push_back(std::move(initializer));
|
|
1097
|
+
} else {
|
|
1098
|
+
static_assert(ModuleMethodInfo<TMethod>::ArgCount == 2);
|
|
1099
|
+
auto jsiinitializer = ModuleJsiInitMethodInfo<TMethod>::GetJsiInitializer(m_module, method);
|
|
1100
|
+
m_jsiinitializers.push_back(std::move(jsiinitializer));
|
|
1101
|
+
}
|
|
1054
1102
|
}
|
|
1055
1103
|
|
|
1056
1104
|
template <class TMethod>
|
|
@@ -1109,6 +1157,7 @@ struct ReactModuleBuilder {
|
|
|
1109
1157
|
std::wstring_view m_moduleName{L""};
|
|
1110
1158
|
std::wstring_view m_eventEmitterName{L""};
|
|
1111
1159
|
std::vector<InitializerDelegate> m_initializers;
|
|
1160
|
+
std::vector<JsiInitializerDelegate> m_jsiinitializers;
|
|
1112
1161
|
};
|
|
1113
1162
|
|
|
1114
1163
|
struct VerificationResult {
|
|
@@ -1457,6 +1506,15 @@ inline ReactModuleProvider MakeTurboModuleProvider() noexcept {
|
|
|
1457
1506
|
return MakeModuleProvider<TModule>();
|
|
1458
1507
|
}
|
|
1459
1508
|
|
|
1509
|
+
// Clang does not allow a virtual function address to be a constexpr statement
|
|
1510
|
+
#if !defined(CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS)
|
|
1511
|
+
#if defined(__clang__)
|
|
1512
|
+
#define CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS
|
|
1513
|
+
#else
|
|
1514
|
+
#define CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS constexpr
|
|
1515
|
+
#endif
|
|
1516
|
+
#endif
|
|
1517
|
+
|
|
1460
1518
|
} // namespace winrt::Microsoft::ReactNative
|
|
1461
1519
|
|
|
1462
1520
|
namespace React {
|