react-native-windows 0.78.5 → 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/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
|
@@ -998,14 +998,14 @@ void NativeUIManager::measure(
|
|
|
998
998
|
|
|
999
999
|
auto feView = view.try_as<xaml::FrameworkElement>();
|
|
1000
1000
|
if (feView == nullptr) {
|
|
1001
|
-
|
|
1001
|
+
callback(0, 0, 0, 0, 0, 0);
|
|
1002
1002
|
return;
|
|
1003
1003
|
}
|
|
1004
1004
|
|
|
1005
1005
|
// Retrieve the XAML element for the root view containing this view
|
|
1006
1006
|
auto feRootView = static_cast<ShadowNodeBase &>(shadowRoot).GetView().try_as<xaml::FrameworkElement>();
|
|
1007
1007
|
if (feRootView == nullptr) {
|
|
1008
|
-
|
|
1008
|
+
callback(0, 0, 0, 0, 0, 0);
|
|
1009
1009
|
return;
|
|
1010
1010
|
}
|
|
1011
1011
|
|
|
@@ -1015,9 +1015,7 @@ void NativeUIManager::measure(
|
|
|
1015
1015
|
// this is exactly, but it is not used anyway.
|
|
1016
1016
|
// Either codify this non-use or determine if and how we can send the needed
|
|
1017
1017
|
// data.
|
|
1018
|
-
|
|
1019
|
-
callback(0, 0, react.Width, react.Height, react.X, react.Y);
|
|
1020
|
-
});
|
|
1018
|
+
callback(0, 0, rectInParentCoords.Width, rectInParentCoords.Height, rectInParentCoords.X, rectInParentCoords.Y);
|
|
1021
1019
|
}
|
|
1022
1020
|
|
|
1023
1021
|
void NativeUIManager::measureInWindow(
|
|
@@ -1033,14 +1031,11 @@ void NativeUIManager::measureInWindow(
|
|
|
1033
1031
|
auto windowTransform = view.TransformToVisual(nullptr);
|
|
1034
1032
|
auto positionInWindow = windowTransform.TransformPoint({0, 0});
|
|
1035
1033
|
|
|
1036
|
-
|
|
1037
|
-
[callback = std::move(callback), pos = positionInWindow, w = view.ActualWidth(), h = view.ActualHeight()]() {
|
|
1038
|
-
callback(pos.X, pos.Y, w, h);
|
|
1039
|
-
});
|
|
1034
|
+
callback(positionInWindow.X, positionInWindow.Y, view.ActualWidth(), view.ActualHeight());
|
|
1040
1035
|
return;
|
|
1041
1036
|
}
|
|
1042
1037
|
|
|
1043
|
-
|
|
1038
|
+
callback(0, 0, 0, 0);
|
|
1044
1039
|
}
|
|
1045
1040
|
|
|
1046
1041
|
void NativeUIManager::measureLayout(
|
|
@@ -1060,15 +1055,11 @@ void NativeUIManager::measureLayout(
|
|
|
1060
1055
|
const auto height = static_cast<float>(targetElement.ActualHeight());
|
|
1061
1056
|
const auto transformedBounds = ancestorTransform.TransformBounds(winrt::Rect(0, 0, width, height));
|
|
1062
1057
|
|
|
1063
|
-
|
|
1064
|
-
callback(rect.X, rect.Y, rect.Width, rect.Height);
|
|
1065
|
-
});
|
|
1058
|
+
callback(transformedBounds.X, transformedBounds.Y, transformedBounds.Width, transformedBounds.Height);
|
|
1066
1059
|
} catch (winrt::hresult_error const &e) {
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
errorCallback(React::TakeJSValue(writer));
|
|
1071
|
-
});
|
|
1060
|
+
auto writer = React::MakeJSValueTreeWriter();
|
|
1061
|
+
writer.WriteString(e.message());
|
|
1062
|
+
errorCallback(React::TakeJSValue(writer));
|
|
1072
1063
|
}
|
|
1073
1064
|
}
|
|
1074
1065
|
|
|
@@ -1082,7 +1073,7 @@ void NativeUIManager::findSubviewIn(
|
|
|
1082
1073
|
|
|
1083
1074
|
auto rootUIView = view.try_as<xaml::UIElement>();
|
|
1084
1075
|
if (rootUIView == nullptr) {
|
|
1085
|
-
|
|
1076
|
+
callback(0, 0, 0, 0, 0);
|
|
1086
1077
|
return;
|
|
1087
1078
|
}
|
|
1088
1079
|
|
|
@@ -1111,14 +1102,12 @@ void NativeUIManager::findSubviewIn(
|
|
|
1111
1102
|
}
|
|
1112
1103
|
|
|
1113
1104
|
if (foundElement == nullptr) {
|
|
1114
|
-
|
|
1105
|
+
callback(0, 0, 0, 0, 0);
|
|
1115
1106
|
return;
|
|
1116
1107
|
}
|
|
1117
1108
|
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
callback(static_cast<double>(foundTag), box.X, box.Y, box.Width, box.Height);
|
|
1121
|
-
});
|
|
1109
|
+
auto box = GetRectOfElementInParentCoords(foundElement, rootUIView);
|
|
1110
|
+
callback(static_cast<double>(foundTag), box.X, box.Y, box.Width, box.Height);
|
|
1122
1111
|
}
|
|
1123
1112
|
|
|
1124
1113
|
void NativeUIManager::focus(int64_t reactTag) {
|
|
@@ -77,22 +77,6 @@ winrt::Microsoft::ReactNative::ReactPropertyId<bool> UseRuntimeSchedulerProperty
|
|
|
77
77
|
return propId;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
winrt::Microsoft::ReactNative::ReactPropertyId<bool> IsBridgelessProperty() noexcept {
|
|
81
|
-
winrt::Microsoft::ReactNative::ReactPropertyId<bool> propId{L"ReactNative", L"IsBridgeless"};
|
|
82
|
-
|
|
83
|
-
return propId;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/*static*/ bool QuirkSettings::GetIsBridgeless(winrt::Microsoft::ReactNative::ReactPropertyBag properties) noexcept {
|
|
87
|
-
return properties.Get(IsBridgelessProperty()).value_or(false);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/*static*/ void QuirkSettings::SetIsBridgeless(
|
|
91
|
-
const winrt::Microsoft::ReactNative::ReactPropertyBag &properties,
|
|
92
|
-
bool value) noexcept {
|
|
93
|
-
properties.Set(IsBridgelessProperty(), value);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
80
|
#pragma region IDL interface
|
|
97
81
|
|
|
98
82
|
/*static*/ void QuirkSettings::SetMatchAndroidAndIOSStretchBehavior(
|
|
@@ -39,9 +39,6 @@ struct QuirkSettings : QuirkSettingsT<QuirkSettings> {
|
|
|
39
39
|
static bool GetMapWindowDeactivatedToAppStateInactive(
|
|
40
40
|
winrt::Microsoft::ReactNative::ReactPropertyBag properties) noexcept;
|
|
41
41
|
|
|
42
|
-
static bool GetIsBridgeless(winrt::Microsoft::ReactNative::ReactPropertyBag properties) noexcept;
|
|
43
|
-
static void SetIsBridgeless(const winrt::Microsoft::ReactNative::ReactPropertyBag &properties, bool value) noexcept;
|
|
44
|
-
|
|
45
42
|
#pragma region Public API - part of IDL interface
|
|
46
43
|
static void SetMatchAndroidAndIOSStretchBehavior(
|
|
47
44
|
winrt::Microsoft::ReactNative::ReactInstanceSettings settings,
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
#include <ReactPropertyBag.h>
|
|
7
7
|
#include <winrt/Windows.Foundation.h>
|
|
8
8
|
|
|
9
|
+
#include <CppRuntimeOptions.h>
|
|
10
|
+
|
|
9
11
|
#include <react/featureflags/ReactNativeFeatureFlags.h>
|
|
10
12
|
#include <react/featureflags/ReactNativeFeatureFlagsDefaults.h>
|
|
11
13
|
|
|
@@ -283,7 +285,15 @@ bool ReactOptions::EnableDefaultCrashHandler() const noexcept {
|
|
|
283
285
|
class ReactNativeWindowsFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults {
|
|
284
286
|
public:
|
|
285
287
|
bool disableEventLoopOnBridgeless() override {
|
|
286
|
-
return
|
|
288
|
+
return Microsoft::React::GetRuntimeOptionBool("ReactFeatureFlag.enableEventLoopOnBridgeless");
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
bool enableBridgelessArchitecture() override {
|
|
292
|
+
#ifdef USE_FABRIC
|
|
293
|
+
return true;
|
|
294
|
+
#else
|
|
295
|
+
return false;
|
|
296
|
+
#endif
|
|
287
297
|
}
|
|
288
298
|
|
|
289
299
|
bool enableCppPropsIteratorSetter() override {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
#include "ReactInstanceWin.h"
|
|
5
5
|
|
|
6
6
|
#include <AppModelHelpers.h>
|
|
7
|
+
#include <CallInvoker.h>
|
|
7
8
|
#include <CppRuntimeOptions.h>
|
|
8
9
|
#include <CreateInstance.h>
|
|
9
10
|
#include <CreateModules.h>
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
#include <react/runtime/JSRuntimeFactory.h>
|
|
65
66
|
#include <react/runtime/PlatformTimerRegistry.h>
|
|
66
67
|
#include <react/runtime/TimerManager.h>
|
|
68
|
+
#include <react/threading/MessageQueueThreadImpl.h>
|
|
67
69
|
#endif
|
|
68
70
|
|
|
69
71
|
#if !defined(CORE_ABI) && !defined(USE_FABRIC)
|
|
@@ -350,12 +352,10 @@ void ReactInstanceWin::LoadModules(
|
|
|
350
352
|
#endif
|
|
351
353
|
|
|
352
354
|
#if !defined(CORE_ABI) && !defined(USE_FABRIC)
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
winrt::Microsoft::ReactNative::MakeModuleProvider<::Microsoft::ReactNative::UIManager>());
|
|
358
|
-
}
|
|
355
|
+
registerTurboModule(
|
|
356
|
+
L"UIManager",
|
|
357
|
+
// TODO: Use MakeTurboModuleProvider after it satisfies ReactNativeSpecs::UIManagerSpec
|
|
358
|
+
winrt::Microsoft::ReactNative::MakeModuleProvider<::Microsoft::ReactNative::UIManager>());
|
|
359
359
|
#endif
|
|
360
360
|
|
|
361
361
|
#ifndef CORE_ABI
|
|
@@ -489,7 +489,7 @@ void ReactInstanceWin::LoadModules(
|
|
|
489
489
|
//! Initialize() is called from the native queue.
|
|
490
490
|
void ReactInstanceWin::Initialize() noexcept {
|
|
491
491
|
#ifdef USE_FABRIC
|
|
492
|
-
if (
|
|
492
|
+
if (Microsoft::ReactNative::IsFabricEnabled(m_reactContext->Properties())) {
|
|
493
493
|
InitializeBridgeless();
|
|
494
494
|
} else
|
|
495
495
|
#endif
|
|
@@ -643,15 +643,10 @@ void ReactInstanceWin::InitializeBridgeless() noexcept {
|
|
|
643
643
|
// null moduleProvider since native modules are not supported in bridgeless
|
|
644
644
|
LoadModules(devSettings, nullptr, m_options.TurboModuleProvider);
|
|
645
645
|
|
|
646
|
-
auto
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
m_options.Properties.Set(ReactDispatcherHelper::JSDispatcherProperty(), jsDispatcher);
|
|
651
|
-
m_jsMessageThread.Exchange(std::make_shared<Mso::React::MessageDispatchQueue>(
|
|
652
|
-
jsDispatchQueue,
|
|
653
|
-
Mso::MakeWeakMemberFunctor(this, &ReactInstanceWin::OnError),
|
|
654
|
-
Mso::Copy(m_whenDestroyed)));
|
|
646
|
+
auto jsMessageThread = std::make_shared<facebook::react::MessageQueueThreadImpl>();
|
|
647
|
+
m_jsMessageThread.Exchange(jsMessageThread);
|
|
648
|
+
|
|
649
|
+
std::shared_ptr<facebook::react::CallInvoker> callInvoker;
|
|
655
650
|
|
|
656
651
|
m_jsMessageThread.Load()->runOnQueueSync([&]() {
|
|
657
652
|
SetJSThreadDescription();
|
|
@@ -674,11 +669,11 @@ void ReactInstanceWin::InitializeBridgeless() noexcept {
|
|
|
674
669
|
}
|
|
675
670
|
|
|
676
671
|
m_jsiRuntimeHolder = std::make_shared<Microsoft::ReactNative::HermesRuntimeHolder>(
|
|
677
|
-
devSettings,
|
|
672
|
+
devSettings, jsMessageThread, CreatePreparedScriptStore());
|
|
678
673
|
auto jsRuntime = std::make_unique<Microsoft::ReactNative::HermesJSRuntime>(m_jsiRuntimeHolder);
|
|
679
674
|
jsRuntime->getRuntime();
|
|
680
675
|
m_bridgelessReactInstance = std::make_unique<facebook::react::ReactInstance>(
|
|
681
|
-
std::move(jsRuntime),
|
|
676
|
+
std::move(jsRuntime), jsMessageThread, timerManager, jsErrorHandlingFunc);
|
|
682
677
|
|
|
683
678
|
auto bufferedRuntimeExecutor = m_bridgelessReactInstance->getBufferedRuntimeExecutor();
|
|
684
679
|
timerManager->setRuntimeExecutor(bufferedRuntimeExecutor);
|
|
@@ -686,56 +681,70 @@ void ReactInstanceWin::InitializeBridgeless() noexcept {
|
|
|
686
681
|
Microsoft::ReactNative::SchedulerSettings::SetRuntimeScheduler(
|
|
687
682
|
winrt::Microsoft::ReactNative::ReactPropertyBag(m_options.Properties),
|
|
688
683
|
m_bridgelessReactInstance->getRuntimeScheduler());
|
|
689
|
-
});
|
|
690
684
|
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
auto logger = [loggingHook = GetLoggingCallback()](const std::string &message, unsigned int logLevel) {
|
|
694
|
-
if (loggingHook)
|
|
695
|
-
loggingHook(static_cast<facebook::react::RCTLogLevel>(logLevel), message.c_str());
|
|
696
|
-
};
|
|
697
|
-
facebook::react::bindNativeLogger(runtime, logger);
|
|
698
|
-
|
|
699
|
-
auto turboModuleManager = std::make_shared<facebook::react::TurboModuleManager>(
|
|
700
|
-
m_options.TurboModuleProvider,
|
|
701
|
-
std::make_shared<facebook::react::RuntimeSchedulerCallInvoker>(
|
|
702
|
-
m_bridgelessReactInstance->getRuntimeScheduler()));
|
|
703
|
-
|
|
704
|
-
auto binding =
|
|
705
|
-
[turboModuleManager](const std::string &name) -> std::shared_ptr<facebook::react::TurboModule> {
|
|
706
|
-
return turboModuleManager->getModule(name);
|
|
707
|
-
};
|
|
708
|
-
|
|
709
|
-
// Use a legacy native module binding that always returns null
|
|
710
|
-
// This means that calls to NativeModules.XXX will always return null, rather than crashing on access
|
|
711
|
-
auto legacyNativeModuleBinding =
|
|
712
|
-
[](const std::string & /*name*/) -> std::shared_ptr<facebook::react::TurboModule> { return nullptr; };
|
|
713
|
-
|
|
714
|
-
facebook::react::TurboModuleBinding::install(
|
|
715
|
-
runtime,
|
|
716
|
-
std::function(binding),
|
|
717
|
-
std::function(legacyNativeModuleBinding),
|
|
718
|
-
m_options.TurboModuleProvider->LongLivedObjectCollection());
|
|
719
|
-
|
|
720
|
-
auto componentDescriptorRegistry =
|
|
721
|
-
Microsoft::ReactNative::WindowsComponentDescriptorRegistry::FromProperties(
|
|
722
|
-
winrt::Microsoft::ReactNative::ReactPropertyBag(m_options.Properties));
|
|
723
|
-
auto hasComponentProvider = [componentDescriptorRegistry](const std::string &name) -> bool {
|
|
724
|
-
return componentDescriptorRegistry->hasComponentProvider(
|
|
725
|
-
facebook::react::componentNameByReactViewName(name));
|
|
726
|
-
};
|
|
727
|
-
facebook::react::bindHasComponentProvider(runtime, std::move(hasComponentProvider));
|
|
685
|
+
callInvoker = std::make_shared<facebook::react::RuntimeSchedulerCallInvoker>(
|
|
686
|
+
m_bridgelessReactInstance->getRuntimeScheduler());
|
|
728
687
|
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
688
|
+
winrt::Microsoft::ReactNative::implementation::CallInvoker::SetProperties(
|
|
689
|
+
ReactPropertyBag(m_options.Properties),
|
|
690
|
+
winrt::make<winrt::Microsoft::ReactNative::implementation::CallInvoker>(
|
|
691
|
+
*m_reactContext, std::shared_ptr<facebook::react::CallInvoker>(callInvoker)));
|
|
733
692
|
});
|
|
734
693
|
|
|
735
694
|
m_options.TurboModuleProvider->SetReactContext(
|
|
736
695
|
winrt::make<implementation::ReactContext>(Mso::Copy(m_reactContext)));
|
|
737
696
|
|
|
738
|
-
|
|
697
|
+
facebook::react::ReactInstance::JSRuntimeFlags options;
|
|
698
|
+
m_bridgelessReactInstance->initializeRuntime(
|
|
699
|
+
options,
|
|
700
|
+
[=, onCreated = m_options.OnInstanceCreated, reactContext = m_reactContext](
|
|
701
|
+
facebook::jsi::Runtime &runtime) {
|
|
702
|
+
auto logger = [loggingHook = GetLoggingCallback()](
|
|
703
|
+
const std::string &message, unsigned int logLevel) {
|
|
704
|
+
if (loggingHook)
|
|
705
|
+
loggingHook(static_cast<facebook::react::RCTLogLevel>(logLevel), message.c_str());
|
|
706
|
+
};
|
|
707
|
+
facebook::react::bindNativeLogger(runtime, logger);
|
|
708
|
+
|
|
709
|
+
auto turboModuleManager =
|
|
710
|
+
std::make_shared<facebook::react::TurboModuleManager>(m_options.TurboModuleProvider, callInvoker);
|
|
711
|
+
|
|
712
|
+
auto binding =
|
|
713
|
+
[turboModuleManager](const std::string &name) -> std::shared_ptr<facebook::react::TurboModule> {
|
|
714
|
+
return turboModuleManager->getModule(name);
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
// Use a legacy native module binding that always returns null
|
|
718
|
+
// This means that calls to NativeModules.XXX will always return null, rather than crashing on access
|
|
719
|
+
auto legacyNativeModuleBinding =
|
|
720
|
+
[](const std::string & /*name*/) -> std::shared_ptr<facebook::react::TurboModule> {
|
|
721
|
+
return nullptr;
|
|
722
|
+
};
|
|
723
|
+
|
|
724
|
+
facebook::react::TurboModuleBinding::install(
|
|
725
|
+
runtime,
|
|
726
|
+
std::function(binding),
|
|
727
|
+
std::function(legacyNativeModuleBinding),
|
|
728
|
+
m_options.TurboModuleProvider->LongLivedObjectCollection());
|
|
729
|
+
|
|
730
|
+
auto componentDescriptorRegistry =
|
|
731
|
+
Microsoft::ReactNative::WindowsComponentDescriptorRegistry::FromProperties(
|
|
732
|
+
winrt::Microsoft::ReactNative::ReactPropertyBag(m_options.Properties));
|
|
733
|
+
auto hasComponentProvider = [componentDescriptorRegistry](const std::string &name) -> bool {
|
|
734
|
+
return componentDescriptorRegistry->hasComponentProvider(
|
|
735
|
+
facebook::react::componentNameByReactViewName(name));
|
|
736
|
+
};
|
|
737
|
+
facebook::react::bindHasComponentProvider(runtime, std::move(hasComponentProvider));
|
|
738
|
+
|
|
739
|
+
// init TurboModule
|
|
740
|
+
for (const auto &moduleName : turboModuleManager->getEagerInitModuleNames()) {
|
|
741
|
+
turboModuleManager->getModule(moduleName);
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
if (onCreated) {
|
|
745
|
+
onCreated.Get()->Invoke(reactContext);
|
|
746
|
+
}
|
|
747
|
+
});
|
|
739
748
|
|
|
740
749
|
LoadJSBundlesBridgeless(devSettings);
|
|
741
750
|
SetupHMRClient();
|
|
@@ -1092,9 +1101,9 @@ Mso::Future<void> ReactInstanceWin::Destroy() noexcept {
|
|
|
1092
1101
|
}
|
|
1093
1102
|
this->m_bridgelessReactInstance = nullptr;
|
|
1094
1103
|
jsMessageThread->quitSynchronous();
|
|
1104
|
+
m_whenDestroyed.SetValue();
|
|
1095
1105
|
});
|
|
1096
1106
|
}
|
|
1097
|
-
m_jsDispatchQueue.Exchange(nullptr);
|
|
1098
1107
|
}
|
|
1099
1108
|
#endif
|
|
1100
1109
|
|
|
@@ -1112,13 +1121,19 @@ ReactInstanceState ReactInstanceWin::State() const noexcept {
|
|
|
1112
1121
|
void ReactInstanceWin::InitJSMessageThread() noexcept {
|
|
1113
1122
|
m_instance.Exchange(std::make_shared<facebook::react::Instance>());
|
|
1114
1123
|
|
|
1124
|
+
auto callInvoker = m_instance.Load()->getJSCallInvoker();
|
|
1115
1125
|
auto scheduler = Mso::MakeJSCallInvokerScheduler(
|
|
1116
1126
|
CreateDispatchQueueSettings(m_reactContext->Notifications()),
|
|
1117
|
-
|
|
1127
|
+
std::shared_ptr<facebook::react::CallInvoker>(callInvoker),
|
|
1118
1128
|
Mso::MakeWeakMemberFunctor(this, &ReactInstanceWin::OnError),
|
|
1119
1129
|
Mso::Copy(m_whenDestroyed));
|
|
1120
1130
|
auto jsDispatchQueue = Mso::DispatchQueue::MakeCustomQueue(Mso::CntPtr(scheduler));
|
|
1121
1131
|
|
|
1132
|
+
winrt::Microsoft::ReactNative::implementation::CallInvoker::SetProperties(
|
|
1133
|
+
ReactPropertyBag(m_options.Properties),
|
|
1134
|
+
winrt::make<winrt::Microsoft::ReactNative::implementation::CallInvoker>(
|
|
1135
|
+
*m_reactContext, std::shared_ptr<facebook::react::CallInvoker>(callInvoker)));
|
|
1136
|
+
|
|
1122
1137
|
auto jsDispatcher =
|
|
1123
1138
|
winrt::make<winrt::Microsoft::ReactNative::implementation::ReactDispatcher>(Mso::Copy(jsDispatchQueue));
|
|
1124
1139
|
m_options.Properties.Set(ReactDispatcherHelper::JSDispatcherProperty(), jsDispatcher);
|
|
@@ -1161,11 +1176,6 @@ void ReactInstanceWin::InitUIMessageThread() noexcept {
|
|
|
1161
1176
|
});
|
|
1162
1177
|
}
|
|
1163
1178
|
|
|
1164
|
-
bool ReactInstanceWin::IsBridgeless() noexcept {
|
|
1165
|
-
return winrt::Microsoft::ReactNative::implementation::QuirkSettings::GetIsBridgeless(
|
|
1166
|
-
winrt::Microsoft::ReactNative::ReactPropertyBag(m_reactContext->Properties()));
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
1179
|
#if !defined(CORE_ABI) && !defined(USE_FABRIC)
|
|
1170
1180
|
void ReactInstanceWin::InitUIManager() noexcept {
|
|
1171
1181
|
std::vector<std::unique_ptr<Microsoft::ReactNative::IViewManager>> viewManagers;
|
|
@@ -136,7 +136,6 @@ class ReactInstanceWin final : public Mso::ActiveObject<IReactInstanceInternal>
|
|
|
136
136
|
std::shared_ptr<Mso::React::IRedBoxHandler> GetRedBoxHandler() noexcept;
|
|
137
137
|
std::function<void()> GetWaitingForDebuggerCallback() noexcept;
|
|
138
138
|
std::function<void()> GetDebuggerAttachCallback() noexcept;
|
|
139
|
-
bool IsBridgeless() noexcept;
|
|
140
139
|
|
|
141
140
|
void OnError(const Mso::ErrorCode &errorcode) noexcept;
|
|
142
141
|
void OnErrorWithMessage(const std::string &errorMessage) noexcept;
|
|
@@ -188,7 +187,7 @@ class ReactInstanceWin final : public Mso::ActiveObject<IReactInstanceInternal>
|
|
|
188
187
|
mutable std::mutex m_mutex;
|
|
189
188
|
|
|
190
189
|
// !Bridgeless
|
|
191
|
-
const Mso::ActiveReadableField<Mso::DispatchQueue> m_jsDispatchQueue{Queue(), m_mutex};
|
|
190
|
+
const Mso::ActiveReadableField<Mso::DispatchQueue> m_jsDispatchQueue{nullptr, Queue(), m_mutex};
|
|
192
191
|
const Mso::ActiveReadableField<std::shared_ptr<facebook::react::MessageQueueThread>> m_jsMessageThread{
|
|
193
192
|
Queue(),
|
|
194
193
|
m_mutex};
|
|
@@ -20,6 +20,12 @@ winrt::Microsoft::ReactNative::IReactContext InstanceCreatedEventArgs::Context()
|
|
|
20
20
|
return m_context;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
winrt::Windows::Foundation::IInspectable InstanceCreatedEventArgs::RuntimeHandle() noexcept {
|
|
24
|
+
return winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactContext>(m_context)
|
|
25
|
+
->GetInner()
|
|
26
|
+
.JsiRuntime();
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
InstanceLoadedEventArgs::InstanceLoadedEventArgs(Mso::CntPtr<Mso::React::IReactContext> &&context, bool failed)
|
|
24
30
|
: m_context(winrt::make<ReactContext>(std::move(context))), m_failed(failed) {}
|
|
25
31
|
|
|
@@ -31,6 +37,12 @@ winrt::Microsoft::ReactNative::IReactContext InstanceLoadedEventArgs::Context()
|
|
|
31
37
|
return m_context;
|
|
32
38
|
}
|
|
33
39
|
|
|
40
|
+
winrt::Windows::Foundation::IInspectable InstanceLoadedEventArgs::RuntimeHandle() noexcept {
|
|
41
|
+
return winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactContext>(m_context)
|
|
42
|
+
->GetInner()
|
|
43
|
+
.JsiRuntime();
|
|
44
|
+
}
|
|
45
|
+
|
|
34
46
|
InstanceDestroyedEventArgs::InstanceDestroyedEventArgs(Mso::CntPtr<Mso::React::IReactContext> &&context)
|
|
35
47
|
: m_context(winrt::make<ReactContext>(std::move(context))) {}
|
|
36
48
|
|
|
@@ -19,6 +19,7 @@ struct InstanceCreatedEventArgs : InstanceCreatedEventArgsT<InstanceCreatedEvent
|
|
|
19
19
|
InstanceCreatedEventArgs(Mso::CntPtr<Mso::React::IReactContext> &&context);
|
|
20
20
|
|
|
21
21
|
winrt::Microsoft::ReactNative::IReactContext Context() noexcept;
|
|
22
|
+
winrt::Windows::Foundation::IInspectable RuntimeHandle() noexcept;
|
|
22
23
|
|
|
23
24
|
private:
|
|
24
25
|
winrt::Microsoft::ReactNative::IReactContext m_context;
|
|
@@ -29,6 +30,7 @@ struct InstanceLoadedEventArgs : InstanceLoadedEventArgsT<InstanceLoadedEventArg
|
|
|
29
30
|
InstanceLoadedEventArgs(Mso::CntPtr<Mso::React::IReactContext> &&context, bool failed);
|
|
30
31
|
|
|
31
32
|
winrt::Microsoft::ReactNative::IReactContext Context() noexcept;
|
|
33
|
+
winrt::Windows::Foundation::IInspectable RuntimeHandle() noexcept;
|
|
32
34
|
bool Failed() noexcept;
|
|
33
35
|
|
|
34
36
|
private:
|
|
@@ -45,6 +45,9 @@ namespace Microsoft.ReactNative
|
|
|
45
45
|
{
|
|
46
46
|
DOC_STRING("Gets the @IReactContext for the React instance that was just created.")
|
|
47
47
|
IReactContext Context { get; };
|
|
48
|
+
|
|
49
|
+
DOC_STRING("Provides access to the jsi::Runtime for synchronous access using GetOrCreateContextRuntime")
|
|
50
|
+
Object RuntimeHandle { get; };
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
[webhosthidden]
|
|
@@ -57,6 +60,9 @@ namespace Microsoft.ReactNative
|
|
|
57
60
|
|
|
58
61
|
DOC_STRING("Returns `true` if the JavaScript bundle failed to load.")
|
|
59
62
|
Boolean Failed { get; };
|
|
63
|
+
|
|
64
|
+
DOC_STRING("Provides access to the jsi::Runtime for synchronous access using GetOrCreateContextRuntime")
|
|
65
|
+
Object RuntimeHandle { get; };
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
[webhosthidden]
|
|
@@ -119,6 +119,9 @@ namespace Microsoft.ReactNative
|
|
|
119
119
|
Microsoft.ReactNative.Composition.Theme Theme { get; };
|
|
120
120
|
Int64 RootTag { get; };
|
|
121
121
|
|
|
122
|
+
DOC_STRING("Initial props should be set on ReactViewHost. This is used to update props after the initial props are set")
|
|
123
|
+
void SetProperties(JSValueArgWriter props);
|
|
124
|
+
|
|
122
125
|
#ifdef USE_WINUI3
|
|
123
126
|
Microsoft.UI.Content.ContentIsland Island { get; };
|
|
124
127
|
#endif
|
|
@@ -82,21 +82,30 @@ folly::dynamic ConvertToDynamic(IInspectable const &object) {
|
|
|
82
82
|
case PropertyType::BooleanArray: {
|
|
83
83
|
com_array<bool> tmpArray;
|
|
84
84
|
propValue.GetBooleanArray(tmpArray);
|
|
85
|
-
folly::dynamic d
|
|
85
|
+
folly::dynamic d = folly::dynamic::array();
|
|
86
|
+
for (bool b : tmpArray) {
|
|
87
|
+
d.push_back(folly::dynamic(b));
|
|
88
|
+
}
|
|
86
89
|
value = d;
|
|
87
90
|
break;
|
|
88
91
|
}
|
|
89
92
|
case PropertyType::Char16Array: {
|
|
90
93
|
com_array<char16_t> tmpArray;
|
|
91
94
|
propValue.GetChar16Array(tmpArray);
|
|
92
|
-
folly::dynamic d
|
|
95
|
+
folly::dynamic d = folly::dynamic::array();
|
|
96
|
+
for (char16_t b : tmpArray) {
|
|
97
|
+
d.push_back(folly::dynamic(b));
|
|
98
|
+
}
|
|
93
99
|
value = d;
|
|
94
100
|
break;
|
|
95
101
|
}
|
|
96
102
|
case PropertyType::DoubleArray: {
|
|
97
103
|
com_array<double_t> tmpArray;
|
|
98
104
|
propValue.GetDoubleArray(tmpArray);
|
|
99
|
-
folly::dynamic d
|
|
105
|
+
folly::dynamic d = folly::dynamic::array();
|
|
106
|
+
for (double_t b : tmpArray) {
|
|
107
|
+
d.push_back(folly::dynamic(b));
|
|
108
|
+
}
|
|
100
109
|
value = d;
|
|
101
110
|
break;
|
|
102
111
|
}
|
|
@@ -113,28 +122,40 @@ folly::dynamic ConvertToDynamic(IInspectable const &object) {
|
|
|
113
122
|
case PropertyType::Int16Array: {
|
|
114
123
|
com_array<int16_t> tmpArray;
|
|
115
124
|
propValue.GetInt16Array(tmpArray);
|
|
116
|
-
folly::dynamic d
|
|
125
|
+
folly::dynamic d = folly::dynamic::array();
|
|
126
|
+
for (int16_t b : tmpArray) {
|
|
127
|
+
d.push_back(folly::dynamic(b));
|
|
128
|
+
}
|
|
117
129
|
value = d;
|
|
118
130
|
break;
|
|
119
131
|
}
|
|
120
132
|
case PropertyType::Int32Array: {
|
|
121
133
|
com_array<int32_t> tmpArray;
|
|
122
134
|
propValue.GetInt32Array(tmpArray);
|
|
123
|
-
folly::dynamic d
|
|
135
|
+
folly::dynamic d = folly::dynamic::array();
|
|
136
|
+
for (int32_t b : tmpArray) {
|
|
137
|
+
d.push_back(folly::dynamic(b));
|
|
138
|
+
}
|
|
124
139
|
value = d;
|
|
125
140
|
break;
|
|
126
141
|
}
|
|
127
142
|
case PropertyType::Int64Array: {
|
|
128
143
|
com_array<int64_t> tmpArray;
|
|
129
144
|
propValue.GetInt64Array(tmpArray);
|
|
130
|
-
folly::dynamic d
|
|
145
|
+
folly::dynamic d = folly::dynamic::array();
|
|
146
|
+
for (int64_t b : tmpArray) {
|
|
147
|
+
d.push_back(folly::dynamic(b));
|
|
148
|
+
}
|
|
131
149
|
value = d;
|
|
132
150
|
break;
|
|
133
151
|
}
|
|
134
152
|
case PropertyType::SingleArray: {
|
|
135
153
|
com_array<float> tmpArray;
|
|
136
154
|
propValue.GetSingleArray(tmpArray);
|
|
137
|
-
folly::dynamic d
|
|
155
|
+
folly::dynamic d = folly::dynamic::array();
|
|
156
|
+
for (float b : tmpArray) {
|
|
157
|
+
d.push_back(folly::dynamic(b));
|
|
158
|
+
}
|
|
138
159
|
value = d;
|
|
139
160
|
break;
|
|
140
161
|
}
|
|
@@ -151,28 +172,40 @@ folly::dynamic ConvertToDynamic(IInspectable const &object) {
|
|
|
151
172
|
case PropertyType::UInt8Array: {
|
|
152
173
|
com_array<uint8_t> tmpArray;
|
|
153
174
|
propValue.GetUInt8Array(tmpArray);
|
|
154
|
-
folly::dynamic d
|
|
175
|
+
folly::dynamic d = folly::dynamic::array();
|
|
176
|
+
for (uint8_t b : tmpArray) {
|
|
177
|
+
d.push_back(folly::dynamic(b));
|
|
178
|
+
}
|
|
155
179
|
value = d;
|
|
156
180
|
break;
|
|
157
181
|
}
|
|
158
182
|
case PropertyType::UInt16Array: {
|
|
159
183
|
com_array<uint16_t> tmpArray;
|
|
160
184
|
propValue.GetUInt16Array(tmpArray);
|
|
161
|
-
folly::dynamic d
|
|
185
|
+
folly::dynamic d = folly::dynamic::array();
|
|
186
|
+
for (uint16_t b : tmpArray) {
|
|
187
|
+
d.push_back(folly::dynamic(b));
|
|
188
|
+
}
|
|
162
189
|
value = d;
|
|
163
190
|
break;
|
|
164
191
|
}
|
|
165
192
|
case PropertyType::UInt32Array: {
|
|
166
193
|
com_array<uint32_t> tmpArray;
|
|
167
194
|
propValue.GetUInt32Array(tmpArray);
|
|
168
|
-
folly::dynamic d
|
|
195
|
+
folly::dynamic d = folly::dynamic::array();
|
|
196
|
+
for (uint32_t b : tmpArray) {
|
|
197
|
+
d.push_back(folly::dynamic(b));
|
|
198
|
+
}
|
|
169
199
|
value = d;
|
|
170
200
|
break;
|
|
171
201
|
}
|
|
172
202
|
case PropertyType::UInt64Array: {
|
|
173
203
|
com_array<uint64_t> tmpArray;
|
|
174
204
|
propValue.GetUInt64Array(tmpArray);
|
|
175
|
-
folly::dynamic d
|
|
205
|
+
folly::dynamic d = folly::dynamic::array();
|
|
206
|
+
for (uint64_t b : tmpArray) {
|
|
207
|
+
d.push_back(folly::dynamic(b));
|
|
208
|
+
}
|
|
176
209
|
value = d;
|
|
177
210
|
break;
|
|
178
211
|
}
|
|
@@ -83,7 +83,36 @@ struct RedBox : public std::enable_shared_from_this<RedBox> {
|
|
|
83
83
|
// Ideally we'd have a dialog we could push UI updates to. -- Maybe we could load XAML and host the XAML dialog?
|
|
84
84
|
|
|
85
85
|
std::stringstream ss;
|
|
86
|
-
|
|
86
|
+
|
|
87
|
+
const std::regex colorsRegex(
|
|
88
|
+
"(\\x1b\\[[0-9;]*m)|(\\\\u001b\\[\\d*m)"); // strip out console colors which is often added to JS error messages
|
|
89
|
+
auto message = std::regex_replace(m_errorInfo.Message, colorsRegex, "");
|
|
90
|
+
bool needsMessage = true;
|
|
91
|
+
|
|
92
|
+
if (!message.empty() && message[0] == '{') {
|
|
93
|
+
try {
|
|
94
|
+
auto json = folly::parseJson(message);
|
|
95
|
+
|
|
96
|
+
if (json.count("type") && json["type"] == "TransformError") {
|
|
97
|
+
ss << "TransformError: " << std::endl;
|
|
98
|
+
if (json.count("errors")) {
|
|
99
|
+
for (const auto &err : json["errors"]) {
|
|
100
|
+
ss << "Filename: " << err["filename"] << std::endl;
|
|
101
|
+
ss << "lineNumber: " << err["lineNumber"] << std::endl;
|
|
102
|
+
ss << err["description"] << std::endl;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
needsMessage = false;
|
|
106
|
+
} else {
|
|
107
|
+
message = folly::toPrettyJson(json);
|
|
108
|
+
message = std::regex_replace(m_errorInfo.Message, colorsRegex, "");
|
|
109
|
+
}
|
|
110
|
+
} catch (...) {
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (needsMessage)
|
|
115
|
+
ss << message;
|
|
87
116
|
ss << std::endl << std::endl;
|
|
88
117
|
for (auto frame : m_errorInfo.Callstack) {
|
|
89
118
|
ss << frame.Method << "\n" << frame.File << ":" << frame.Line << ":" << frame.Column << std::endl;
|