react-native-windows 0.73.14 → 0.73.15
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/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +6 -1
- package/Microsoft.ReactNative/Modules/ExceptionsManager.cpp +110 -0
- package/Microsoft.ReactNative/Modules/ExceptionsManager.h +54 -0
- package/Microsoft.ReactNative/Modules/PlatformConstantsWinModule.cpp +43 -0
- package/Microsoft.ReactNative/Modules/PlatformConstantsWinModule.h +18 -0
- package/Microsoft.ReactNative/Modules/SourceCode.cpp +31 -0
- package/Microsoft.ReactNative/Modules/SourceCode.h +28 -0
- package/Microsoft.ReactNative/Modules/StatusBarManager.h +12 -0
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +63 -12
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/Shared/DevSettings.h +3 -0
- package/Shared/OInstance.cpp +6 -2
- package/Shared/Shared.vcxitems +3 -0
- package/Shared/Shared.vcxitems.filters +3 -0
- package/package.json +1 -1
|
@@ -107,6 +107,7 @@
|
|
|
107
107
|
$(ReactNativeWindowsDir)Microsoft.ReactNative\Views;
|
|
108
108
|
$(ReactNativeWindowsDir);
|
|
109
109
|
$(ReactNativeWindowsDir)codegen;
|
|
110
|
+
$(ReactNativeWindowsDir)codegen\react\components\rnwcore;
|
|
110
111
|
$(ReactNativeWindowsDir)Common;
|
|
111
112
|
$(ReactNativeWindowsDir)include;
|
|
112
113
|
$(ReactNativeWindowsDir)Shared;
|
|
@@ -117,21 +118,25 @@
|
|
|
117
118
|
$(GeneratedFilesDir);
|
|
118
119
|
%(AdditionalIncludeDirectories)
|
|
119
120
|
</AdditionalIncludeDirectories>
|
|
120
|
-
<PreprocessorDefinitions>DISABLE_XAML_GENERATED_MAIN;FOLLY_NO_CONFIG;NOMINMAX;_HAS_AUTO_PTR_ETC;_USE_MATH_DEFINES;RN_EXPORT=;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
121
121
|
<!--
|
|
122
122
|
REACTWINDOWS_BUILD - building with REACTWINDOWS_API as dll exports
|
|
123
123
|
OLD_CPPWINRT is a workaround to make target version to 19H1
|
|
124
124
|
-->
|
|
125
125
|
<PreprocessorDefinitions>
|
|
126
|
+
DISABLE_XAML_GENERATED_MAIN;
|
|
126
127
|
REACTWINDOWS_BUILD;
|
|
127
128
|
RN_PLATFORM=windows;
|
|
128
129
|
NOMINMAX;
|
|
130
|
+
FOLLY_CFG_NO_COROUTINES;
|
|
129
131
|
FOLLY_NO_CONFIG;
|
|
130
132
|
RN_EXPORT=;
|
|
131
133
|
JSI_EXPORT=;
|
|
132
134
|
WIN32=0;
|
|
133
135
|
WINRT=1;
|
|
134
136
|
_HAS_AUTO_PTR_ETC;
|
|
137
|
+
_USE_MATH_DEFINES;
|
|
138
|
+
<!-- See https://cplusplus.github.io/LWG/issue3840 -->
|
|
139
|
+
_SILENCE_CXX20_U8PATH_DEPRECATION_WARNING;
|
|
135
140
|
%(PreprocessorDefinitions)
|
|
136
141
|
</PreprocessorDefinitions>
|
|
137
142
|
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "pch.h"
|
|
5
|
+
#include "ExceptionsManager.h"
|
|
6
|
+
|
|
7
|
+
#include <DynamicWriter.h>
|
|
8
|
+
#include <IRedBoxHandler.h>
|
|
9
|
+
#include <JSValueWriter.h>
|
|
10
|
+
|
|
11
|
+
namespace Microsoft::ReactNative {
|
|
12
|
+
|
|
13
|
+
static const React::ReactPropertyId<React::ReactNonAbiValue<std::shared_ptr<Mso::React::IRedBoxHandler>>>
|
|
14
|
+
&RedBoxHandlerPropertyId() noexcept {
|
|
15
|
+
static const React::ReactPropertyId<React::ReactNonAbiValue<std::shared_ptr<Mso::React::IRedBoxHandler>>> prop{
|
|
16
|
+
L"ReactNative.ExceptionsManager", L"RedBoxHandler"};
|
|
17
|
+
return prop;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
Mso::React::ErrorInfo CreateErrorInfo(
|
|
21
|
+
std::string message,
|
|
22
|
+
std::vector<ReactNativeSpecs::ExceptionsManagerSpec_StackFrame> const &stack,
|
|
23
|
+
double exceptionId) {
|
|
24
|
+
Mso::React::ErrorInfo errorInfo;
|
|
25
|
+
errorInfo.Message = message;
|
|
26
|
+
errorInfo.Id = static_cast<uint32_t>(exceptionId);
|
|
27
|
+
for (auto frame : stack) {
|
|
28
|
+
errorInfo.Callstack.push_back(Mso::React::ErrorFrameInfo{
|
|
29
|
+
frame.file.value_or(""),
|
|
30
|
+
frame.methodName,
|
|
31
|
+
static_cast<int>(frame.lineNumber.value_or(0)),
|
|
32
|
+
static_cast<int>(frame.column.value_or(0)),
|
|
33
|
+
frame.collapse.value_or(false)});
|
|
34
|
+
}
|
|
35
|
+
return errorInfo;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
void ExceptionsManager::Initialize(winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept {
|
|
39
|
+
m_reactContext = reactContext;
|
|
40
|
+
m_redboxHandler = *m_reactContext.Properties().Get(RedBoxHandlerPropertyId());
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
void ExceptionsManager::reportFatalException(
|
|
44
|
+
std::string message,
|
|
45
|
+
std::vector<ReactNativeSpecs::ExceptionsManagerSpec_StackFrame> const &stack,
|
|
46
|
+
double exceptionId) noexcept {
|
|
47
|
+
if (m_redboxHandler && m_redboxHandler->isDevSupportEnabled()) {
|
|
48
|
+
m_redboxHandler->showNewError(
|
|
49
|
+
std::move(CreateErrorInfo(message, stack, exceptionId)), Mso::React::ErrorType::JSFatal);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
void ExceptionsManager::reportSoftException(
|
|
54
|
+
std::string message,
|
|
55
|
+
std::vector<ReactNativeSpecs::ExceptionsManagerSpec_StackFrame> const &stack,
|
|
56
|
+
double exceptionId) noexcept {
|
|
57
|
+
if (m_redboxHandler && m_redboxHandler->isDevSupportEnabled()) {
|
|
58
|
+
m_redboxHandler->showNewError(
|
|
59
|
+
std::move(CreateErrorInfo(message, stack, exceptionId)), Mso::React::ErrorType::JSSoft);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
void ExceptionsManager::reportException(ReactNativeSpecs::ExceptionsManagerSpec_ExceptionData &&data) noexcept {
|
|
64
|
+
if (m_redboxHandler && m_redboxHandler->isDevSupportEnabled()) {
|
|
65
|
+
Mso::React::ErrorInfo errorInfo;
|
|
66
|
+
errorInfo.Message = data.message;
|
|
67
|
+
errorInfo.OriginalMessage = data.originalMessage.value_or("");
|
|
68
|
+
errorInfo.Name = data.name.value_or("");
|
|
69
|
+
errorInfo.ComponentStack = data.componentStack.value_or("");
|
|
70
|
+
errorInfo.Id = static_cast<uint32_t>(data.id);
|
|
71
|
+
|
|
72
|
+
auto writer = winrt::make_self<winrt::Microsoft::ReactNative::DynamicWriter>();
|
|
73
|
+
winrt::Microsoft::ReactNative::WriteValue(
|
|
74
|
+
writer.as<winrt::Microsoft::ReactNative::IJSValueWriter>(), data.extraData);
|
|
75
|
+
errorInfo.ExtraData = writer->TakeValue();
|
|
76
|
+
|
|
77
|
+
for (auto frame : data.stack) {
|
|
78
|
+
errorInfo.Callstack.push_back(Mso::React::ErrorFrameInfo{
|
|
79
|
+
frame.file.value_or(""),
|
|
80
|
+
frame.methodName,
|
|
81
|
+
static_cast<int>(frame.lineNumber.value_or(0)),
|
|
82
|
+
static_cast<int>(frame.column.value_or(0)),
|
|
83
|
+
frame.collapse.value_or(false)});
|
|
84
|
+
}
|
|
85
|
+
m_redboxHandler->showNewError(
|
|
86
|
+
std::move(errorInfo), data.isFatal ? Mso::React::ErrorType::JSFatal : Mso::React::ErrorType::JSSoft);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
void ExceptionsManager::updateExceptionMessage(
|
|
91
|
+
std::string message,
|
|
92
|
+
std::vector<ReactNativeSpecs::ExceptionsManagerSpec_StackFrame> const &stack,
|
|
93
|
+
double exceptionId) noexcept {
|
|
94
|
+
if (m_redboxHandler && m_redboxHandler->isDevSupportEnabled()) {
|
|
95
|
+
m_redboxHandler->updateError(std::move(CreateErrorInfo(message, stack, exceptionId)));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
void ExceptionsManager::dismissRedbox() noexcept {
|
|
100
|
+
if (m_redboxHandler)
|
|
101
|
+
m_redboxHandler->dismissRedbox();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
void ExceptionsManager::SetRedBoxHander(
|
|
105
|
+
const winrt::Microsoft::ReactNative::ReactPropertyBag &properties,
|
|
106
|
+
std::shared_ptr<Mso::React::IRedBoxHandler> handler) noexcept {
|
|
107
|
+
properties.Set(RedBoxHandlerPropertyId(), handler);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
} // namespace Microsoft::ReactNative
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
#pragma once
|
|
4
|
+
|
|
5
|
+
#include "codegen/NativeExceptionsManagerSpec.g.h"
|
|
6
|
+
#include <NativeModules.h>
|
|
7
|
+
|
|
8
|
+
namespace Mso::React {
|
|
9
|
+
struct IRedBoxHandler;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
namespace Microsoft::ReactNative {
|
|
13
|
+
|
|
14
|
+
REACT_MODULE(ExceptionsManager)
|
|
15
|
+
struct ExceptionsManager {
|
|
16
|
+
using ModuleSpec = ReactNativeSpecs::ExceptionsManagerSpec;
|
|
17
|
+
|
|
18
|
+
REACT_INIT(Initialize)
|
|
19
|
+
void Initialize(winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept;
|
|
20
|
+
|
|
21
|
+
REACT_METHOD(reportFatalException)
|
|
22
|
+
void reportFatalException(
|
|
23
|
+
std::string message,
|
|
24
|
+
std::vector<ReactNativeSpecs::ExceptionsManagerSpec_StackFrame> const &stack,
|
|
25
|
+
double exceptionId) noexcept;
|
|
26
|
+
|
|
27
|
+
REACT_METHOD(reportSoftException)
|
|
28
|
+
void reportSoftException(
|
|
29
|
+
std::string message,
|
|
30
|
+
std::vector<ReactNativeSpecs::ExceptionsManagerSpec_StackFrame> const &stack,
|
|
31
|
+
double exceptionId) noexcept;
|
|
32
|
+
|
|
33
|
+
REACT_METHOD(reportException)
|
|
34
|
+
void reportException(ReactNativeSpecs::ExceptionsManagerSpec_ExceptionData &&data) noexcept;
|
|
35
|
+
|
|
36
|
+
REACT_METHOD(updateExceptionMessage)
|
|
37
|
+
void updateExceptionMessage(
|
|
38
|
+
std::string message,
|
|
39
|
+
std::vector<ReactNativeSpecs::ExceptionsManagerSpec_StackFrame> const &stack,
|
|
40
|
+
double exceptionId) noexcept;
|
|
41
|
+
|
|
42
|
+
REACT_METHOD(dismissRedbox)
|
|
43
|
+
void dismissRedbox() noexcept;
|
|
44
|
+
|
|
45
|
+
static void SetRedBoxHander(
|
|
46
|
+
const winrt::Microsoft::ReactNative::ReactPropertyBag &properties,
|
|
47
|
+
std::shared_ptr<Mso::React::IRedBoxHandler> handler) noexcept;
|
|
48
|
+
|
|
49
|
+
private:
|
|
50
|
+
std::shared_ptr<Mso::React::IRedBoxHandler> m_redboxHandler;
|
|
51
|
+
winrt::Microsoft::ReactNative::ReactContext m_reactContext;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace Microsoft::ReactNative
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "pch.h"
|
|
5
|
+
#include "PlatformConstantsWinModule.h"
|
|
6
|
+
|
|
7
|
+
#include <VersionHelpers.h>
|
|
8
|
+
#include <cxxreact/ReactNativeVersion.h>
|
|
9
|
+
#include <winrt/Windows.Foundation.Metadata.h>
|
|
10
|
+
|
|
11
|
+
namespace Microsoft::ReactNative {
|
|
12
|
+
|
|
13
|
+
ReactNativeSpecs::PlatformConstantsWinSpec_PlatformConstantsWindows PlatformConstants::GetConstants() noexcept {
|
|
14
|
+
ReactNativeSpecs::PlatformConstantsWinSpec_PlatformConstantsWindows constants;
|
|
15
|
+
|
|
16
|
+
// We don't currently treat Native code differently in a test environment
|
|
17
|
+
constants.isTesting = false;
|
|
18
|
+
|
|
19
|
+
// Provide version information stamped into the compiled version of react-native
|
|
20
|
+
constants.reactNativeVersion.major = facebook::react::ReactNativeVersion.Major;
|
|
21
|
+
constants.reactNativeVersion.minor = facebook::react::ReactNativeVersion.Minor;
|
|
22
|
+
constants.reactNativeVersion.patch = facebook::react::ReactNativeVersion.Patch;
|
|
23
|
+
if (!facebook::react::ReactNativeVersion.Prerelease.empty()) {
|
|
24
|
+
constants.reactNativeVersion.prerelease = facebook::react::ReactNativeVersion.Prerelease;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Provide the universal API contract as an OS version
|
|
28
|
+
if (!IsWindows10OrGreater()) {
|
|
29
|
+
constants.osVersion = -1;
|
|
30
|
+
} else {
|
|
31
|
+
for (uint16_t i = 1;; ++i) {
|
|
32
|
+
if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(
|
|
33
|
+
L"Windows.Foundation.UniversalApiContract", i)) {
|
|
34
|
+
constants.osVersion = i - 1;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return constants;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
} // namespace Microsoft::ReactNative
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
#pragma once
|
|
4
|
+
|
|
5
|
+
#include "codegen/NativePlatformConstantsWinSpec.g.h"
|
|
6
|
+
#include <NativeModules.h>
|
|
7
|
+
|
|
8
|
+
namespace Microsoft::ReactNative {
|
|
9
|
+
|
|
10
|
+
REACT_MODULE(PlatformConstants)
|
|
11
|
+
struct PlatformConstants {
|
|
12
|
+
using ModuleSpec = ReactNativeSpecs::PlatformConstantsWinSpec;
|
|
13
|
+
|
|
14
|
+
REACT_GET_CONSTANTS(GetConstants)
|
|
15
|
+
ReactNativeSpecs::PlatformConstantsWinSpec_PlatformConstantsWindows GetConstants() noexcept;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
} // namespace Microsoft::ReactNative
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "pch.h"
|
|
5
|
+
#include "SourceCode.h"
|
|
6
|
+
|
|
7
|
+
namespace Microsoft::ReactNative {
|
|
8
|
+
|
|
9
|
+
static const React::ReactPropertyId<React::ReactNonAbiValue<std::string>> &ScriptUrlPropertyId() noexcept {
|
|
10
|
+
static const React::ReactPropertyId<React::ReactNonAbiValue<std::string>> prop{
|
|
11
|
+
L"ReactNative.SourceCode", L"ScriptUrl"};
|
|
12
|
+
return prop;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
void SourceCode::Initialize(winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept {
|
|
16
|
+
m_reactContext = reactContext;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
ReactNativeSpecs::SourceCodeSpec_SourceCodeConstants SourceCode::GetConstants() noexcept {
|
|
20
|
+
ReactNativeSpecs::SourceCodeSpec_SourceCodeConstants constants;
|
|
21
|
+
constants.scriptURL = *m_reactContext.Properties().Get(ScriptUrlPropertyId());
|
|
22
|
+
return constants;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
void SourceCode::SetScriptUrl(
|
|
26
|
+
const winrt::Microsoft::ReactNative::ReactPropertyBag &propertyBag,
|
|
27
|
+
const std::string &scriptUrl) noexcept {
|
|
28
|
+
propertyBag.Set(ScriptUrlPropertyId(), scriptUrl);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
} // namespace Microsoft::ReactNative
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
#pragma once
|
|
4
|
+
|
|
5
|
+
#include "codegen/NativeSourceCodeSpec.g.h"
|
|
6
|
+
#include <NativeModules.h>
|
|
7
|
+
|
|
8
|
+
namespace Microsoft::ReactNative {
|
|
9
|
+
|
|
10
|
+
REACT_MODULE(SourceCode)
|
|
11
|
+
struct SourceCode {
|
|
12
|
+
using ModuleSpec = ReactNativeSpecs::SourceCodeSpec;
|
|
13
|
+
|
|
14
|
+
REACT_INIT(Initialize)
|
|
15
|
+
void Initialize(winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept;
|
|
16
|
+
|
|
17
|
+
REACT_GET_CONSTANTS(GetConstants)
|
|
18
|
+
ReactNativeSpecs::SourceCodeSpec_SourceCodeConstants GetConstants() noexcept;
|
|
19
|
+
|
|
20
|
+
static void SetScriptUrl(
|
|
21
|
+
const winrt::Microsoft::ReactNative::ReactPropertyBag &propertyBag,
|
|
22
|
+
const std::string &scriptUrl) noexcept;
|
|
23
|
+
|
|
24
|
+
private:
|
|
25
|
+
winrt::Microsoft::ReactNative::ReactContext m_reactContext;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
} // namespace Microsoft::ReactNative
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
#pragma once
|
|
4
|
+
|
|
5
|
+
#include <NativeModules.h>
|
|
6
|
+
|
|
7
|
+
namespace Microsoft::ReactNative {
|
|
8
|
+
|
|
9
|
+
REACT_MODULE(StatusBarManager)
|
|
10
|
+
struct StatusBarManager {};
|
|
11
|
+
|
|
12
|
+
} // namespace Microsoft::ReactNative
|
|
@@ -63,8 +63,14 @@
|
|
|
63
63
|
#include "Modules/NativeUIManager.h"
|
|
64
64
|
#include "Modules/PaperUIManagerModule.h"
|
|
65
65
|
#include "Modules/TimingModule.h"
|
|
66
|
+
#else
|
|
67
|
+
#include "Modules/DesktopTimingModule.h"
|
|
66
68
|
#endif
|
|
69
|
+
#include "Modules/ExceptionsManager.h"
|
|
70
|
+
#include "Modules/PlatformConstantsWinModule.h"
|
|
67
71
|
#include "Modules/ReactRootViewTagGenerator.h"
|
|
72
|
+
#include "Modules/SourceCode.h"
|
|
73
|
+
#include "Modules/StatusBarManager.h"
|
|
68
74
|
|
|
69
75
|
#ifndef CORE_ABI
|
|
70
76
|
#include <Utils/UwpPreparedScriptStore.h>
|
|
@@ -255,6 +261,7 @@ ReactInstanceWin::ReactInstanceWin(
|
|
|
255
261
|
m_whenDestroyedResult =
|
|
256
262
|
m_whenDestroyed.AsFuture().Then<Mso::Executors::Inline>([whenLoaded = m_whenLoaded,
|
|
257
263
|
onDestroyed = m_options.OnInstanceDestroyed,
|
|
264
|
+
// If the ReactHost has been released, this
|
|
258
265
|
// instance might be the only thing keeping
|
|
259
266
|
// the propertyBag alive.
|
|
260
267
|
// We want it to remain alive for the
|
|
@@ -316,6 +323,7 @@ void ReactInstanceWin::InstanceCrashHandler(int fileDescriptor) noexcept {
|
|
|
316
323
|
}
|
|
317
324
|
|
|
318
325
|
void ReactInstanceWin::LoadModules(
|
|
326
|
+
const std::shared_ptr<facebook::react::DevSettings> &devSettings,
|
|
319
327
|
const std::shared_ptr<winrt::Microsoft::ReactNative::NativeModulesProvider> &nativeModulesProvider,
|
|
320
328
|
const std::shared_ptr<winrt::Microsoft::ReactNative::TurboModulesProvider> &turboModulesProvider) noexcept {
|
|
321
329
|
auto registerTurboModule = [this, &nativeModulesProvider, &turboModulesProvider](
|
|
@@ -385,6 +393,45 @@ void ReactInstanceWin::LoadModules(
|
|
|
385
393
|
}
|
|
386
394
|
#endif
|
|
387
395
|
|
|
396
|
+
if (devSettings->useTurboModulesOnly) {
|
|
397
|
+
::Microsoft::ReactNative::ExceptionsManager::SetRedBoxHander(
|
|
398
|
+
winrt::Microsoft::ReactNative::ReactPropertyBag(m_reactContext->Properties()), m_redboxHandler);
|
|
399
|
+
registerTurboModule(
|
|
400
|
+
L"ExceptionsManager",
|
|
401
|
+
winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::ExceptionsManager>());
|
|
402
|
+
|
|
403
|
+
registerTurboModule(
|
|
404
|
+
L"StatusBarManager",
|
|
405
|
+
winrt::Microsoft::ReactNative::MakeModuleProvider<::Microsoft::ReactNative::StatusBarManager>());
|
|
406
|
+
|
|
407
|
+
registerTurboModule(
|
|
408
|
+
L"PlatformConstants",
|
|
409
|
+
winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::PlatformConstants>());
|
|
410
|
+
|
|
411
|
+
uint32_t hermesBytecodeVersion = 0;
|
|
412
|
+
#if defined(USE_HERMES) && defined(ENABLE_DEVSERVER_HBCBUNDLES)
|
|
413
|
+
hermesBytecodeVersion = ::hermes::hbc::BYTECODE_VERSION;
|
|
414
|
+
#endif
|
|
415
|
+
|
|
416
|
+
std::string bundleUrl = (devSettings->useWebDebugger || devSettings->liveReloadCallback)
|
|
417
|
+
? facebook::react::DevServerHelper::get_BundleUrl(
|
|
418
|
+
devSettings->sourceBundleHost,
|
|
419
|
+
devSettings->sourceBundlePort,
|
|
420
|
+
devSettings->debugBundlePath,
|
|
421
|
+
devSettings->platformName,
|
|
422
|
+
devSettings->bundleAppId,
|
|
423
|
+
devSettings->devBundle,
|
|
424
|
+
devSettings->useFastRefresh,
|
|
425
|
+
devSettings->inlineSourceMap,
|
|
426
|
+
hermesBytecodeVersion)
|
|
427
|
+
: devSettings->bundleRootPath;
|
|
428
|
+
::Microsoft::ReactNative::SourceCode::SetScriptUrl(
|
|
429
|
+
winrt::Microsoft::ReactNative::ReactPropertyBag(m_reactContext->Properties()), bundleUrl);
|
|
430
|
+
|
|
431
|
+
registerTurboModule(
|
|
432
|
+
L"SourceCode", winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::SourceCode>());
|
|
433
|
+
}
|
|
434
|
+
|
|
388
435
|
registerTurboModule(
|
|
389
436
|
L"DevSettings", winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::DevSettings>());
|
|
390
437
|
|
|
@@ -396,8 +443,9 @@ void ReactInstanceWin::LoadModules(
|
|
|
396
443
|
L"LinkingManager",
|
|
397
444
|
winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::LinkingManager>());
|
|
398
445
|
|
|
399
|
-
registerTurboModule(
|
|
400
|
-
|
|
446
|
+
registerTurboModule(L"Timing", winrt::Microsoft::ReactNative::MakeModuleProvider<::Microsoft::ReactNative::Timing>());
|
|
447
|
+
#else
|
|
448
|
+
registerTurboModule(L"Timing", winrt::Microsoft::ReactNative::MakeModuleProvider<::facebook::react::Timing>());
|
|
401
449
|
#endif
|
|
402
450
|
|
|
403
451
|
registerTurboModule(
|
|
@@ -439,13 +487,10 @@ void ReactInstanceWin::Initialize() noexcept {
|
|
|
439
487
|
winrt::Microsoft::ReactNative::ReactPropertyBag(strongThis->Options().Properties));
|
|
440
488
|
Microsoft::ReactNative::Appearance::InitOnUIThread(strongThis->GetReactContext());
|
|
441
489
|
Microsoft::ReactNative::DeviceInfoHolder::InitDeviceInfoHolder(strongThis->GetReactContext());
|
|
442
|
-
|
|
443
490
|
#endif // CORE_ABI
|
|
444
491
|
|
|
445
492
|
strongThis->Queue().Post([this, weakThis]() noexcept {
|
|
446
493
|
if (auto strongThis = weakThis.GetStrongPtr()) {
|
|
447
|
-
// auto cxxModulesProviders = GetCxxModuleProviders();
|
|
448
|
-
|
|
449
494
|
auto devSettings = std::make_shared<facebook::react::DevSettings>();
|
|
450
495
|
devSettings->useJITCompilation = m_options.EnableJITCompilation;
|
|
451
496
|
devSettings->sourceBundleHost = SourceBundleHost();
|
|
@@ -478,10 +523,21 @@ void ReactInstanceWin::Initialize() noexcept {
|
|
|
478
523
|
}
|
|
479
524
|
};
|
|
480
525
|
|
|
526
|
+
auto getBoolProperty = [properties = ReactPropertyBag{m_options.Properties}](
|
|
527
|
+
const wchar_t *ns, const wchar_t *name, bool defaultValue) noexcept -> bool {
|
|
528
|
+
ReactPropertyId<bool> propId{ns == nullptr ? ReactPropertyNamespace() : ReactPropertyNamespace(ns), name};
|
|
529
|
+
std::optional<bool> propValue = properties.Get(propId);
|
|
530
|
+
return propValue.value_or(defaultValue);
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
devSettings->omitNetworkingCxxModules = getBoolProperty(nullptr, L"OmitNetworkingCxxModules", false);
|
|
534
|
+
devSettings->useWebSocketTurboModule = getBoolProperty(nullptr, L"UseWebSocketTurboModule", false);
|
|
535
|
+
devSettings->useTurboModulesOnly = getBoolProperty(L"DevSettings", L"UseTurboModulesOnly", false);
|
|
536
|
+
|
|
481
537
|
std::vector<facebook::react::NativeModuleDescription> cxxModules;
|
|
482
538
|
auto nmp = std::make_shared<winrt::Microsoft::ReactNative::NativeModulesProvider>();
|
|
483
539
|
|
|
484
|
-
LoadModules(nmp, m_options.TurboModuleProvider);
|
|
540
|
+
LoadModules(devSettings, nmp, m_options.TurboModuleProvider);
|
|
485
541
|
|
|
486
542
|
auto modules = nmp->GetModules(m_reactContext, m_jsMessageThread.Load());
|
|
487
543
|
cxxModules.insert(
|
|
@@ -569,12 +625,7 @@ void ReactInstanceWin::Initialize() noexcept {
|
|
|
569
625
|
// We need to keep the instance wrapper alive as its destruction shuts down the native queue.
|
|
570
626
|
m_options.TurboModuleProvider->SetReactContext(
|
|
571
627
|
winrt::make<implementation::ReactContext>(Mso::Copy(m_reactContext)));
|
|
572
|
-
|
|
573
|
-
auto omitNetCxxPropValue = m_options.Properties.Get(omitNetCxxPropName);
|
|
574
|
-
devSettings->omitNetworkingCxxModules = winrt::unbox_value_or(omitNetCxxPropValue, false);
|
|
575
|
-
auto useWebSocketTurboModulePropName = ReactPropertyBagHelper::GetName(nullptr, L"UseWebSocketTurboModule");
|
|
576
|
-
auto useWebSocketTurboModulePropValue = m_options.Properties.Get(useWebSocketTurboModulePropName);
|
|
577
|
-
devSettings->useWebSocketTurboModule = winrt::unbox_value_or(useWebSocketTurboModulePropValue, false);
|
|
628
|
+
|
|
578
629
|
auto bundleRootPath = devSettings->bundleRootPath;
|
|
579
630
|
auto instanceWrapper = facebook::react::CreateReactInstance(
|
|
580
631
|
std::shared_ptr<facebook::react::Instance>(strongThis->m_instance.Load()),
|
|
@@ -95,6 +95,7 @@ class ReactInstanceWin final : public Mso::ActiveObject<IReactInstanceInternal>
|
|
|
95
95
|
Mso::Promise<void> &&whenLoaded,
|
|
96
96
|
Mso::VoidFunctor &&updateUI) noexcept;
|
|
97
97
|
void LoadModules(
|
|
98
|
+
const std::shared_ptr<facebook::react::DevSettings> &devSettings,
|
|
98
99
|
const std::shared_ptr<winrt::Microsoft::ReactNative::NativeModulesProvider> &nativeModulesProvider,
|
|
99
100
|
const std::shared_ptr<winrt::Microsoft::ReactNative::TurboModulesProvider> &turboModulesProvider) noexcept;
|
|
100
101
|
void Initialize() noexcept override;
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.73.
|
|
13
|
+
<ReactNativeWindowsVersion>0.73.15</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>73</ReactNativeWindowsMinor>
|
|
16
|
-
<ReactNativeWindowsPatch>
|
|
16
|
+
<ReactNativeWindowsPatch>15</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>7cb849542746286f1fb7758306cdf152c89db1aa</ReactNativeWindowsCommitId>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
</Project>
|
package/Shared/DevSettings.h
CHANGED
|
@@ -105,6 +105,9 @@ struct DevSettings {
|
|
|
105
105
|
|
|
106
106
|
// OC:8368383 - Memory leak under investigation.
|
|
107
107
|
bool useWebSocketTurboModule{false};
|
|
108
|
+
|
|
109
|
+
// If true, then use only Turbo Modules instead of CxxModules.
|
|
110
|
+
bool useTurboModulesOnly{false};
|
|
108
111
|
};
|
|
109
112
|
|
|
110
113
|
} // namespace react
|
package/Shared/OInstance.cpp
CHANGED
|
@@ -549,6 +549,10 @@ InstanceImpl::~InstanceImpl() {
|
|
|
549
549
|
std::vector<std::unique_ptr<NativeModule>> InstanceImpl::GetDefaultNativeModules(
|
|
550
550
|
std::shared_ptr<MessageQueueThread> nativeQueue) {
|
|
551
551
|
std::vector<std::unique_ptr<NativeModule>> modules;
|
|
552
|
+
if (m_devSettings->useTurboModulesOnly) {
|
|
553
|
+
return modules;
|
|
554
|
+
}
|
|
555
|
+
|
|
552
556
|
auto transitionalProps{ReactPropertyBagHelper::CreatePropertyBag()};
|
|
553
557
|
|
|
554
558
|
// These modules are instantiated separately in MSRN (Universal Windows).
|
|
@@ -566,9 +570,9 @@ std::vector<std::unique_ptr<NativeModule>> InstanceImpl::GetDefaultNativeModules
|
|
|
566
570
|
nativeQueue));
|
|
567
571
|
}
|
|
568
572
|
|
|
569
|
-
// Applications using the Windows ABI feature should
|
|
573
|
+
// Applications using the Windows ABI feature should load the networking TurboModule variants instead.
|
|
570
574
|
if (!m_devSettings->omitNetworkingCxxModules) {
|
|
571
|
-
// Use in case the host app provides its a non-Blob-
|
|
575
|
+
// Use in case the host app provides its a non-Blob-compatible HTTP module.
|
|
572
576
|
if (!Microsoft::React::GetRuntimeOptionBool("Blob.DisableModule")) {
|
|
573
577
|
modules.push_back(std::make_unique<CxxNativeModule>(
|
|
574
578
|
m_innerInstance,
|
package/Shared/Shared.vcxitems
CHANGED
|
@@ -403,6 +403,9 @@
|
|
|
403
403
|
<ClInclude Include="$(MSBuildThisFileDirectory)WebSocketJSExecutorFactory.h" />
|
|
404
404
|
<ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Modules\DevSettingsModule.cpp" />
|
|
405
405
|
<ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Modules\ReactRootViewTagGenerator.cpp" />
|
|
406
|
+
<ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Modules\PlatformConstantsWinModule.cpp" />
|
|
407
|
+
<ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Modules\ExceptionsManager.cpp" />
|
|
408
|
+
<ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Modules\SourceCode.cpp" />
|
|
406
409
|
<ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\NativeModulesProvider.cpp" />
|
|
407
410
|
<ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\ReactHost\AsyncActionQueue.cpp" />
|
|
408
411
|
<ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\ReactHost\CrashManager.cpp" />
|
|
@@ -279,6 +279,9 @@
|
|
|
279
279
|
</ClCompile>
|
|
280
280
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\platform\react\renderer\components\view\HostPlatformViewProps.cpp" />
|
|
281
281
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\platform\react\renderer\components\view\HostPlatformViewEventEmitter.cpp" />
|
|
282
|
+
<ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Modules\PlatformConstantsWinModule.cpp" />
|
|
283
|
+
<ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Modules\ExceptionsManager.cpp" />
|
|
284
|
+
<ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Modules\SourceCode.cpp" />
|
|
282
285
|
</ItemGroup>
|
|
283
286
|
<ItemGroup>
|
|
284
287
|
<Filter Include="Source Files">
|