react-native-windows 0.81.22 → 0.81.25
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/Common/Common.vcxproj +6 -5
- package/Common/Common.win32.vcxproj +11 -0
- package/Common/packages.lock.win32.json +23 -0
- package/Folly/Folly.vcxproj +12 -7
- package/Folly/Folly.win32.vcxproj +11 -0
- package/Folly/packages.lock.win32.json +20 -0
- package/Microsoft.ReactNative/CallInvoker.cpp +14 -4
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +8 -4
- package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.cpp +1 -1
- package/Microsoft.ReactNative/Utils/IcuUtils.cpp +92 -22
- package/Microsoft.ReactNative/Utils/IcuUtils.h +5 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/HybridCRT.props +26 -22
- package/PropertySheets/Warnings.props +5 -2
- package/ReactCommon/ReactCommon.vcxproj +13 -6
- package/ReactCommon/ReactCommon.win32.vcxproj +13 -0
- package/ReactCommon/packages.lock.win32.json +33 -0
- package/fmt/fmt.vcxproj +7 -5
- package/fmt/fmt.win32.vcxproj +10 -0
- package/package.json +1 -1
- package/templates/cpp-app/windows/MyApp/MyApp.cpp +9 -6
package/Common/Common.vcxproj
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
3
|
<PropertyGroup Label="Globals">
|
|
4
|
-
<ProjectGuid>{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}</ProjectGuid>
|
|
5
|
-
<ProjectName>Common</ProjectName>
|
|
4
|
+
<ProjectGuid Condition="'$(ReactTargetWin32)' != 'true'">{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}</ProjectGuid>
|
|
5
|
+
<ProjectName Condition="'$(ReactTargetWin32)' != 'true'">Common</ProjectName>
|
|
6
6
|
<Keyword>StaticLibrary</Keyword>
|
|
7
|
-
<AppContainerApplication>true</AppContainerApplication>
|
|
8
|
-
<ApplicationType>Windows Store</ApplicationType>
|
|
9
|
-
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
|
7
|
+
<AppContainerApplication Condition="'$(ReactTargetWin32)' != 'true'">true</AppContainerApplication>
|
|
8
|
+
<ApplicationType Condition="'$(ReactTargetWin32)' != 'true'">Windows Store</ApplicationType>
|
|
9
|
+
<ApplicationTypeRevision Condition="'$(ReactTargetWin32)' != 'true'">10.0</ApplicationTypeRevision>
|
|
10
10
|
</PropertyGroup>
|
|
11
11
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
12
12
|
<Import Project="$(ReactNativeWindowsDir)PropertySheets\React.Cpp.props" />
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
</ImportGroup>
|
|
57
57
|
<ImportGroup Label="PropertySheets">
|
|
58
58
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
59
|
+
<Import Project="$(ReactNativeWindowsDir)PropertySheets\HybridCRT.props" Condition="'$(ReactTargetWin32)' == 'true'" />
|
|
59
60
|
</ImportGroup>
|
|
60
61
|
<PropertyGroup Label="UserMacros" />
|
|
61
62
|
<PropertyGroup>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
+
<PropertyGroup Label="Globals">
|
|
4
|
+
<ProjectGuid>{07B21646-07A1-4C53-9D5C-FE7C8C9FA5C6}</ProjectGuid>
|
|
5
|
+
<ProjectName>Common.win32</ProjectName>
|
|
6
|
+
<Keyword>StaticLibrary</Keyword>
|
|
7
|
+
<ReactTargetWin32>true</ReactTargetWin32>
|
|
8
|
+
<NuGetLockFilePath>.\packages.lock.win32.json</NuGetLockFilePath>
|
|
9
|
+
</PropertyGroup>
|
|
10
|
+
<Import Project="Common.vcxproj" />
|
|
11
|
+
</Project>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"dependencies": {
|
|
4
|
+
"native,Version=v0.0": {
|
|
5
|
+
"boost": {
|
|
6
|
+
"type": "Direct",
|
|
7
|
+
"requested": "[1.84.0, )",
|
|
8
|
+
"resolved": "1.84.0",
|
|
9
|
+
"contentHash": "4el2YP3cNJDVFPdzOso+LxGvdWP2rHxML4siq8VdonNypW2m4q503tHfCj6vK0L1UfxioE2hpFGb4ITEua73tg=="
|
|
10
|
+
},
|
|
11
|
+
"Microsoft.Windows.CppWinRT": {
|
|
12
|
+
"type": "Direct",
|
|
13
|
+
"requested": "[2.0.230706.1, )",
|
|
14
|
+
"resolved": "2.0.230706.1",
|
|
15
|
+
"contentHash": "l0D7oCw/5X+xIKHqZTi62TtV+1qeSz7KVluNFdrJ9hXsst4ghvqQ/Yhura7JqRdZWBXAuDS0G0KwALptdoxweQ=="
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"native,Version=v0.0/win": {},
|
|
19
|
+
"native,Version=v0.0/win-arm64": {},
|
|
20
|
+
"native,Version=v0.0/win-x64": {},
|
|
21
|
+
"native,Version=v0.0/win-x86": {}
|
|
22
|
+
}
|
|
23
|
+
}
|
package/Folly/Folly.vcxproj
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
3
|
<PropertyGroup Label="Globals">
|
|
4
|
-
<ProjectGuid>{a990658c-ce31-4bcc-976f-0fc6b1af693d}</ProjectGuid>
|
|
4
|
+
<ProjectGuid Condition="'$(ReactTargetWin32)' != 'true'">{a990658c-ce31-4bcc-976f-0fc6b1af693d}</ProjectGuid>
|
|
5
5
|
<Keyword>StaticLibrary</Keyword>
|
|
6
|
-
<ProjectName>Folly</ProjectName>
|
|
6
|
+
<ProjectName Condition="'$(ReactTargetWin32)' != 'true'">Folly</ProjectName>
|
|
7
7
|
<RootNamespace>Folly</RootNamespace>
|
|
8
8
|
<DefaultLanguage>en-US</DefaultLanguage>
|
|
9
|
-
<ApplicationType>Windows Store</ApplicationType>
|
|
10
|
-
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
|
11
|
-
<AppContainerApplication>true</AppContainerApplication>
|
|
9
|
+
<ApplicationType Condition="'$(ReactTargetWin32)' != 'true'">Windows Store</ApplicationType>
|
|
10
|
+
<ApplicationTypeRevision Condition="'$(ReactTargetWin32)' != 'true'">10.0</ApplicationTypeRevision>
|
|
11
|
+
<AppContainerApplication Condition="'$(ReactTargetWin32)' != 'true'">true</AppContainerApplication>
|
|
12
12
|
</PropertyGroup>
|
|
13
13
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
14
14
|
<Import Project="$(ReactNativeWindowsDir)PropertySheets\React.Cpp.props" />
|
|
@@ -259,6 +259,7 @@
|
|
|
259
259
|
</ImportGroup>
|
|
260
260
|
<ImportGroup Label="PropertySheets">
|
|
261
261
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
262
|
+
<Import Project="$(ReactNativeWindowsDir)PropertySheets\HybridCRT.props" Condition="'$(ReactTargetWin32)' == 'true'" />
|
|
262
263
|
</ImportGroup>
|
|
263
264
|
<PropertyGroup Label="UserMacros" />
|
|
264
265
|
<PropertyGroup>
|
|
@@ -268,6 +269,7 @@
|
|
|
268
269
|
<ItemDefinitionGroup>
|
|
269
270
|
<ClCompile>
|
|
270
271
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
|
272
|
+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
|
271
273
|
<CompileAsWinRT>false</CompileAsWinRT>
|
|
272
274
|
<SDLCheck>true</SDLCheck>
|
|
273
275
|
<AdditionalIncludeDirectories>$(ReactNativeWindowsDir)stubs;$(FollyDir);$(FastFloatDir)\include;$(FmtDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
@@ -372,7 +374,10 @@
|
|
|
372
374
|
<Message Importance="High" Text="Applying temporary patches to folly." />
|
|
373
375
|
<Copy DestinationFiles="@(TemporaryFollyPatchFiles->'$(FollyDir)folly\%(RecursiveDir)%(Filename)%(Extension)')" SourceFiles="@(TemporaryFollyPatchFiles)" />
|
|
374
376
|
</Target>
|
|
375
|
-
<ItemGroup>
|
|
376
|
-
<ProjectReference Include="..\fmt\fmt.vcxproj" Project="{
|
|
377
|
+
<ItemGroup Condition="'$(ReactTargetWin32)' != 'true'">
|
|
378
|
+
<ProjectReference Include="..\fmt\fmt.vcxproj" Project="{14B93DC8-FD93-4A6D-81CB-8BC96644501C}" />
|
|
379
|
+
</ItemGroup>
|
|
380
|
+
<ItemGroup Condition="'$(ReactTargetWin32)' == 'true'">
|
|
381
|
+
<ProjectReference Include="..\fmt\fmt.win32.vcxproj" Project="{4A98E8E8-F0B2-4F45-8A0E-9F4C7A81A239}" />
|
|
377
382
|
</ItemGroup>
|
|
378
383
|
</Project>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
+
<PropertyGroup Label="Globals">
|
|
4
|
+
<ProjectGuid>{BFF1EAC8-4C70-4A55-9A88-3810052E8FBA}</ProjectGuid>
|
|
5
|
+
<ProjectName>Folly.win32</ProjectName>
|
|
6
|
+
<Keyword>StaticLibrary</Keyword>
|
|
7
|
+
<ReactTargetWin32>true</ReactTargetWin32>
|
|
8
|
+
<NuGetLockFilePath>.\packages.lock.win32.json</NuGetLockFilePath>
|
|
9
|
+
</PropertyGroup>
|
|
10
|
+
<Import Project="Folly.vcxproj" />
|
|
11
|
+
</Project>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"dependencies": {
|
|
4
|
+
"native,Version=v0.0": {
|
|
5
|
+
"boost": {
|
|
6
|
+
"type": "Direct",
|
|
7
|
+
"requested": "[1.84.0, )",
|
|
8
|
+
"resolved": "1.84.0",
|
|
9
|
+
"contentHash": "4el2YP3cNJDVFPdzOso+LxGvdWP2rHxML4siq8VdonNypW2m4q503tHfCj6vK0L1UfxioE2hpFGb4ITEua73tg=="
|
|
10
|
+
},
|
|
11
|
+
"fmt.win32": {
|
|
12
|
+
"type": "Project"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"native,Version=v0.0/win": {},
|
|
16
|
+
"native,Version=v0.0/win-arm64": {},
|
|
17
|
+
"native,Version=v0.0/win-x64": {},
|
|
18
|
+
"native,Version=v0.0/win-x86": {}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -19,13 +19,23 @@ CallInvoker::CallInvoker(
|
|
|
19
19
|
: m_callInvoker(callInvoker), m_context(&reactContext) {}
|
|
20
20
|
|
|
21
21
|
void CallInvoker::InvokeAsync(CallFunc func) noexcept {
|
|
22
|
-
m_callInvoker->invokeAsync(
|
|
23
|
-
|
|
22
|
+
m_callInvoker->invokeAsync([reactContext = m_context, func](facebook::jsi::Runtime & /*runtime*/) {
|
|
23
|
+
auto runtime = reactContext->JsiRuntime();
|
|
24
|
+
if (!runtime)
|
|
25
|
+
return;
|
|
26
|
+
|
|
27
|
+
func(runtime);
|
|
28
|
+
});
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
void CallInvoker::InvokeSync(CallFunc func) noexcept {
|
|
27
|
-
m_callInvoker->invokeSync(
|
|
28
|
-
|
|
32
|
+
m_callInvoker->invokeSync([reactContext = m_context, func](facebook::jsi::Runtime & /*runtime*/) {
|
|
33
|
+
auto runtime = reactContext->JsiRuntime();
|
|
34
|
+
if (!runtime)
|
|
35
|
+
return;
|
|
36
|
+
|
|
37
|
+
func(runtime);
|
|
38
|
+
});
|
|
29
39
|
}
|
|
30
40
|
|
|
31
41
|
winrt::Microsoft::ReactNative::CallInvoker CallInvoker::FromProperties(
|
|
@@ -149,11 +149,13 @@ facebook::react::SharedViewEventEmitter ParagraphComponentView::eventEmitterAtPo
|
|
|
149
149
|
uint32_t textPosition = metrics.textPosition;
|
|
150
150
|
|
|
151
151
|
for (auto fragment : m_attributedStringBox.getValue().getFragments()) {
|
|
152
|
-
|
|
152
|
+
uint32_t utf16Length =
|
|
153
|
+
static_cast<uint32_t>(::Microsoft::Common::Unicode::Utf8ToUtf16(fragment.string).length());
|
|
154
|
+
if (textPosition < utf16Length) {
|
|
153
155
|
return std::static_pointer_cast<const facebook::react::ViewEventEmitter>(
|
|
154
156
|
fragment.parentShadowView.eventEmitter);
|
|
155
157
|
}
|
|
156
|
-
textPosition -=
|
|
158
|
+
textPosition -= utf16Length;
|
|
157
159
|
}
|
|
158
160
|
}
|
|
159
161
|
}
|
|
@@ -206,10 +208,12 @@ bool ParagraphComponentView::IsTextSelectableAtPoint(facebook::react::Point pt)
|
|
|
206
208
|
|
|
207
209
|
// Finds which fragment contains this text position
|
|
208
210
|
for (auto fragment : m_attributedStringBox.getValue().getFragments()) {
|
|
209
|
-
|
|
211
|
+
uint32_t utf16Length =
|
|
212
|
+
static_cast<uint32_t>(::Microsoft::Common::Unicode::Utf8ToUtf16(fragment.string).length());
|
|
213
|
+
if (textPosition < utf16Length) {
|
|
210
214
|
return true;
|
|
211
215
|
}
|
|
212
|
-
textPosition -=
|
|
216
|
+
textPosition -= utf16Length;
|
|
213
217
|
}
|
|
214
218
|
}
|
|
215
219
|
}
|
|
@@ -66,7 +66,7 @@ void RenderText(
|
|
|
66
66
|
unsigned int position = 0;
|
|
67
67
|
unsigned int length = 0;
|
|
68
68
|
for (auto fragment : attributedString.getFragments()) {
|
|
69
|
-
length = static_cast<UINT32>(fragment.string.length());
|
|
69
|
+
length = static_cast<UINT32>(::Microsoft::Common::Unicode::Utf8ToUtf16(fragment.string).length());
|
|
70
70
|
DWRITE_TEXT_RANGE range = {position, length};
|
|
71
71
|
if (fragment.textAttributes.foregroundColor &&
|
|
72
72
|
(fragment.textAttributes.foregroundColor != textAttributes.foregroundColor) ||
|
|
@@ -262,7 +262,7 @@ void WindowsTextLayoutManager::GetTextLayout(
|
|
|
262
262
|
attachments.push_back(attachment);
|
|
263
263
|
position += 1;
|
|
264
264
|
} else {
|
|
265
|
-
unsigned int length = static_cast<UINT32>(fragment.string.length());
|
|
265
|
+
unsigned int length = static_cast<UINT32>(Microsoft::Common::Unicode::Utf8ToUtf16(fragment.string).length());
|
|
266
266
|
DWRITE_TEXT_RANGE range = {position, length};
|
|
267
267
|
TextAttributes attributes = fragment.textAttributes;
|
|
268
268
|
DWRITE_FONT_STYLE fragmentStyle = DWRITE_FONT_STYLE_NORMAL;
|
|
@@ -3,10 +3,57 @@
|
|
|
3
3
|
|
|
4
4
|
#include "pch.h"
|
|
5
5
|
#include "IcuUtils.h"
|
|
6
|
+
|
|
7
|
+
#include <cwctype>
|
|
8
|
+
|
|
9
|
+
#include <winrt/Windows.Data.Text.h>
|
|
10
|
+
#include <winrt/Windows.Foundation.Collections.h>
|
|
11
|
+
|
|
6
12
|
#include <icu.h>
|
|
7
13
|
|
|
8
14
|
namespace Microsoft::ReactNative::IcuUtils {
|
|
9
15
|
|
|
16
|
+
namespace {
|
|
17
|
+
|
|
18
|
+
// icu.dll ships in Windows 10 1903+. Desktop.DLL delay-loads it so that the
|
|
19
|
+
// react-native-win32.dll can still load on older Windows versions (e.g. 1809).
|
|
20
|
+
// Probe once per process to decide whether ICU calls are safe.
|
|
21
|
+
bool IsIcuDllAvailable() noexcept {
|
|
22
|
+
static const bool s_available = []() noexcept {
|
|
23
|
+
const HMODULE hIcu = ::LoadLibraryExW(L"icu.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
|
|
24
|
+
return hIcu != nullptr;
|
|
25
|
+
}();
|
|
26
|
+
return s_available;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
std::vector<std::pair<int32_t, int32_t>> ComputeBoundariesWithWinrt(const wchar_t *text, int32_t length) noexcept {
|
|
30
|
+
std::vector<std::pair<int32_t, int32_t>> boundaries;
|
|
31
|
+
try {
|
|
32
|
+
winrt::Windows::Data::Text::WordsSegmenter segmenter{L""};
|
|
33
|
+
const winrt::hstring src{text, static_cast<uint32_t>(length)};
|
|
34
|
+
for (const auto &token : segmenter.GetTokens(src)) {
|
|
35
|
+
const auto seg = token.SourceTextSegment();
|
|
36
|
+
const int32_t start = static_cast<int32_t>(seg.StartPosition);
|
|
37
|
+
const int32_t end = start + static_cast<int32_t>(seg.Length);
|
|
38
|
+
boundaries.emplace_back(start, end);
|
|
39
|
+
}
|
|
40
|
+
} catch (const winrt::hresult_error &) {
|
|
41
|
+
boundaries.clear();
|
|
42
|
+
}
|
|
43
|
+
return boundaries;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
bool IsAlphanumericFallback(UChar32 codePoint) noexcept {
|
|
47
|
+
// Treat supplementary-plane code points as non-alphanumeric in the fallback;
|
|
48
|
+
// this matches the degraded behavior expected when ICU is unavailable.
|
|
49
|
+
if (codePoint < 0 || codePoint > 0xFFFF) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return std::iswalnum(static_cast<wint_t>(codePoint)) != 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
} // namespace
|
|
56
|
+
|
|
10
57
|
void UBreakIteratorDeleter::operator()(void *ptr) const noexcept {
|
|
11
58
|
if (ptr) {
|
|
12
59
|
ubrk_close(static_cast<UBreakIterator *>(ptr));
|
|
@@ -14,46 +61,69 @@ void UBreakIteratorDeleter::operator()(void *ptr) const noexcept {
|
|
|
14
61
|
}
|
|
15
62
|
|
|
16
63
|
WordBreakIterator::WordBreakIterator(const wchar_t *text, int32_t length) noexcept : m_length(length) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
64
|
+
if (!text || length <= 0) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (IsIcuDllAvailable()) {
|
|
69
|
+
UErrorCode status = U_ZERO_ERROR;
|
|
70
|
+
auto *iter = ubrk_open(UBRK_WORD, nullptr, reinterpret_cast<const UChar *>(text), length, &status);
|
|
71
|
+
if (U_SUCCESS(status)) {
|
|
72
|
+
m_breakIterator.reset(static_cast<void *>(iter));
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
21
75
|
}
|
|
76
|
+
|
|
77
|
+
m_winrtBoundaries = ComputeBoundariesWithWinrt(text, length);
|
|
22
78
|
}
|
|
23
79
|
|
|
24
80
|
bool WordBreakIterator::IsValid() const noexcept {
|
|
25
|
-
return m_breakIterator != nullptr;
|
|
81
|
+
return m_breakIterator != nullptr || !m_winrtBoundaries.empty();
|
|
26
82
|
}
|
|
27
83
|
|
|
28
84
|
bool WordBreakIterator::GetWordBoundaries(int32_t position, int32_t &outStart, int32_t &outEnd) const noexcept {
|
|
29
|
-
if (
|
|
85
|
+
if (position < 0 || position >= m_length) {
|
|
30
86
|
return false;
|
|
31
87
|
}
|
|
32
88
|
|
|
33
|
-
|
|
89
|
+
if (m_breakIterator) {
|
|
90
|
+
auto *iter = static_cast<UBreakIterator *>(m_breakIterator.get());
|
|
34
91
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
92
|
+
int32_t start = ubrk_preceding(iter, position + 1);
|
|
93
|
+
if (start == UBRK_DONE) {
|
|
94
|
+
start = 0;
|
|
95
|
+
}
|
|
39
96
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
97
|
+
int32_t end = ubrk_following(iter, position);
|
|
98
|
+
if (end == UBRK_DONE) {
|
|
99
|
+
end = m_length;
|
|
100
|
+
}
|
|
44
101
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
102
|
+
int32_t ruleStatus = ubrk_getRuleStatus(iter);
|
|
103
|
+
if (ruleStatus == UBRK_WORD_NONE) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
outStart = start;
|
|
108
|
+
outEnd = end;
|
|
109
|
+
return true;
|
|
48
110
|
}
|
|
49
111
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
112
|
+
for (const auto &[start, end] : m_winrtBoundaries) {
|
|
113
|
+
if (position >= start && position < end) {
|
|
114
|
+
outStart = start;
|
|
115
|
+
outEnd = end;
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return false;
|
|
53
120
|
}
|
|
54
121
|
|
|
55
122
|
bool IsAlphanumeric(UChar32 codePoint) noexcept {
|
|
56
|
-
|
|
123
|
+
if (IsIcuDllAvailable()) {
|
|
124
|
+
return u_isalnum(codePoint) != 0;
|
|
125
|
+
}
|
|
126
|
+
return IsAlphanumericFallback(codePoint);
|
|
57
127
|
}
|
|
58
128
|
|
|
59
129
|
UChar32 GetCodePointAt(const wchar_t *str, int32_t length, int32_t pos) noexcept {
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
#include <cstdint>
|
|
7
7
|
#include <memory>
|
|
8
|
+
#include <utility>
|
|
9
|
+
#include <vector>
|
|
8
10
|
|
|
9
11
|
// ICU utilities wrapped in a namespace to avoid UChar naming conflicts with Folly's FBString.
|
|
10
12
|
// Folly has a template parameter named 'UChar' which conflicts with ICU's global UChar typedef.
|
|
@@ -31,6 +33,9 @@ class WordBreakIterator {
|
|
|
31
33
|
|
|
32
34
|
private:
|
|
33
35
|
std::unique_ptr<void, UBreakIteratorDeleter> m_breakIterator{nullptr};
|
|
36
|
+
// Populated when icu.dll is unavailable (Windows < 1903); produced by
|
|
37
|
+
// Windows.Data.Text.WordsSegmenter, sorted as [start, end) ranges.
|
|
38
|
+
std::vector<std::pair<int32_t, int32_t>> m_winrtBoundaries;
|
|
34
39
|
int32_t m_length = 0;
|
|
35
40
|
};
|
|
36
41
|
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.81.
|
|
13
|
+
<ReactNativeWindowsVersion>0.81.25</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>81</ReactNativeWindowsMinor>
|
|
16
|
-
<ReactNativeWindowsPatch>
|
|
16
|
+
<ReactNativeWindowsPatch>25</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>add8cef8a9c2f2487a2838e0f8660018435e59c2</ReactNativeWindowsCommitId>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
</Project>
|
|
@@ -1,34 +1,38 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
|
|
3
|
+
<!--
|
|
4
|
+
Hybrid CRT: Uses static C++ runtime with dynamic Universal CRT to avoid VCRUNTIME140[d].dll and MSVCP140[d].dll dependency.
|
|
5
|
+
See: https://github.com/microsoft/WindowsAppSDK/blob/main/docs/Coding-Guidelines/HybridCRT.md
|
|
6
|
+
-->
|
|
3
7
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
|
10
|
+
<ClCompile>
|
|
11
|
+
<!-- We use MultiThreadedDebug, rather than MultiThreadedDebugDLL, to avoid DLL dependencies on VCRUNTIME140d.dll and MSVCP140d.dll. -->
|
|
12
|
+
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
|
13
|
+
</ClCompile>
|
|
14
|
+
<Link>
|
|
15
|
+
<!-- Link statically against the runtime and STL, but link dynamically against the CRT by ignoring the static CRT
|
|
12
16
|
lib and instead linking against the Universal CRT DLL import library. This "hybrid" linking mechanism is
|
|
13
17
|
supported according to the CRT maintainer. Dynamic linking against the CRT makes the binaries a bit smaller
|
|
14
18
|
than they would otherwise be if the CRT, runtime, and STL were all statically linked in. -->
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries);libucrtd.lib</IgnoreSpecificDefaultLibraries>
|
|
20
|
+
<AdditionalOptions>%(AdditionalOptions) /defaultlib:ucrtd.lib</AdditionalOptions>
|
|
21
|
+
</Link>
|
|
22
|
+
</ItemDefinitionGroup>
|
|
23
|
+
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
|
24
|
+
<ClCompile>
|
|
25
|
+
<!-- We use MultiThreaded, rather than MultiThreadedDLL, to avoid DLL dependencies on VCRUNTIME140.dll and MSVCP140.dll. -->
|
|
26
|
+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
|
27
|
+
</ClCompile>
|
|
28
|
+
<Link>
|
|
29
|
+
<!-- Link statically against the runtime and STL, but link dynamically against the CRT by ignoring the static CRT
|
|
26
30
|
lib and instead linking against the Universal CRT DLL import library. This "hybrid" linking mechanism is
|
|
27
31
|
supported according to the CRT maintainer. Dynamic linking against the CRT makes the binaries a bit smaller
|
|
28
32
|
than they would otherwise be if the CRT, runtime, and STL were all statically linked in. -->
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries);libucrt.lib</IgnoreSpecificDefaultLibraries>
|
|
34
|
+
<AdditionalOptions>%(AdditionalOptions) /defaultlib:ucrt.lib</AdditionalOptions>
|
|
35
|
+
</Link>
|
|
36
|
+
</ItemDefinitionGroup>
|
|
33
37
|
|
|
34
38
|
</Project>
|
|
@@ -65,8 +65,11 @@
|
|
|
65
65
|
|
|
66
66
|
<ItemDefinitionGroup>
|
|
67
67
|
<ClCompile>
|
|
68
|
-
<!-- /permissive- by default to enforce standards conformance, unless ENABLEPermissive has been set
|
|
69
|
-
|
|
68
|
+
<!-- /permissive- by default to enforce standards conformance, unless ENABLEPermissive has been set.
|
|
69
|
+
Set via ConformanceMode rather than AdditionalOptions so MSBuild's cl task handles it
|
|
70
|
+
structurally; passing /permissive- through AdditionalOptions embeds the raw flag in .obj
|
|
71
|
+
metadata, which the LTCG p2 back-end in newer VS 2022 toolsets rejects with C1007. -->
|
|
72
|
+
<ConformanceMode Condition="'$(ENABLEPermissive)' == ''">true</ConformanceMode>
|
|
70
73
|
<DisableSpecificWarnings>$(OfficePreDisabledWarnings);$(ExtraWarningsToDisable);$(DisableSpecificWarnings)</DisableSpecificWarnings>
|
|
71
74
|
|
|
72
75
|
<!-- SDL REQUIREMENT: Treat warnings as errors -->
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
3
|
<PropertyGroup Label="Globals">
|
|
4
|
-
<ProjectGuid>{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}</ProjectGuid>
|
|
4
|
+
<ProjectGuid Condition="'$(ReactTargetWin32)' != 'true'">{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}</ProjectGuid>
|
|
5
5
|
<Keyword>StaticLibrary</Keyword>
|
|
6
|
-
<ProjectName>ReactCommon</ProjectName>
|
|
6
|
+
<ProjectName Condition="'$(ReactTargetWin32)' != 'true'">ReactCommon</ProjectName>
|
|
7
7
|
<RootNamespace>ReactCommon</RootNamespace>
|
|
8
|
-
<AppContainerApplication>true</AppContainerApplication>
|
|
9
|
-
<ApplicationType>Windows Store</ApplicationType>
|
|
10
|
-
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
|
8
|
+
<AppContainerApplication Condition="'$(ReactTargetWin32)' != 'true'">true</AppContainerApplication>
|
|
9
|
+
<ApplicationType Condition="'$(ReactTargetWin32)' != 'true'">Windows Store</ApplicationType>
|
|
10
|
+
<ApplicationTypeRevision Condition="'$(ReactTargetWin32)' != 'true'">10.0</ApplicationTypeRevision>
|
|
11
11
|
</PropertyGroup>
|
|
12
12
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
13
13
|
<Import Project="$(ReactNativeWindowsDir)PropertySheets\React.Cpp.props" />
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
</ImportGroup>
|
|
58
58
|
<ImportGroup Label="PropertySheets">
|
|
59
59
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
60
|
+
<Import Project="$(ReactNativeWindowsDir)PropertySheets\HybridCRT.props" Condition="'$(ReactTargetWin32)' == 'true'" />
|
|
60
61
|
</ImportGroup>
|
|
61
62
|
<PropertyGroup Label="UserMacros" />
|
|
62
63
|
<PropertyGroup>
|
|
@@ -66,6 +67,7 @@
|
|
|
66
67
|
<ItemDefinitionGroup>
|
|
67
68
|
<ClCompile>
|
|
68
69
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
|
70
|
+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
|
69
71
|
<CompileAsWinRT>false</CompileAsWinRT>
|
|
70
72
|
<SDLCheck>true</SDLCheck>
|
|
71
73
|
<AdditionalIncludeDirectories>
|
|
@@ -243,11 +245,16 @@
|
|
|
243
245
|
<ClCompile Include="$(ReactNativeDir)\ReactCommon\react\nativemodule\core\ReactCommon\TurboModuleUtils.cpp" />
|
|
244
246
|
<ClCompile Include="$(ReactNativeDir)\ReactCommon\react\nativemodule\core\ReactCommon\TurboModuleWithJSIBindings.cpp" />
|
|
245
247
|
</ItemGroup>
|
|
246
|
-
<ItemGroup>
|
|
248
|
+
<ItemGroup Condition="'$(ReactTargetWin32)' != 'true'">
|
|
247
249
|
<ProjectReference Include="..\Folly\Folly.vcxproj">
|
|
248
250
|
<Project>{A990658C-CE31-4BCC-976F-0FC6B1AF693D}</Project>
|
|
249
251
|
</ProjectReference>
|
|
250
252
|
</ItemGroup>
|
|
253
|
+
<ItemGroup Condition="'$(ReactTargetWin32)' == 'true'">
|
|
254
|
+
<ProjectReference Include="..\Folly\Folly.win32.vcxproj">
|
|
255
|
+
<Project>{BFF1EAC8-4C70-4A55-9A88-3810052E8FBA}</Project>
|
|
256
|
+
</ProjectReference>
|
|
257
|
+
</ItemGroup>
|
|
251
258
|
<ItemGroup>
|
|
252
259
|
<PackageReference Include="boost" Version="1.84.0.0" />
|
|
253
260
|
<PackageReference Include="Microsoft.Windows.CppWinRT" Version="$(CppWinRTVersion)" PrivateAssets="all" />
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
+
<PropertyGroup Label="Globals">
|
|
4
|
+
<ProjectGuid>{5CB3C038-4A3C-4F09-A36B-66DB8EC650F5}</ProjectGuid>
|
|
5
|
+
<ProjectName>ReactCommon.win32</ProjectName>
|
|
6
|
+
<Keyword>StaticLibrary</Keyword>
|
|
7
|
+
<ReactTargetWin32>true</ReactTargetWin32>
|
|
8
|
+
</PropertyGroup>
|
|
9
|
+
<PropertyGroup>
|
|
10
|
+
<NuGetLockFilePath>.\packages.lock.win32.json</NuGetLockFilePath>
|
|
11
|
+
</PropertyGroup>
|
|
12
|
+
<Import Project="ReactCommon.vcxproj" />
|
|
13
|
+
</Project>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"dependencies": {
|
|
4
|
+
"native,Version=v0.0": {
|
|
5
|
+
"boost": {
|
|
6
|
+
"type": "Direct",
|
|
7
|
+
"requested": "[1.84.0, )",
|
|
8
|
+
"resolved": "1.84.0",
|
|
9
|
+
"contentHash": "4el2YP3cNJDVFPdzOso+LxGvdWP2rHxML4siq8VdonNypW2m4q503tHfCj6vK0L1UfxioE2hpFGb4ITEua73tg=="
|
|
10
|
+
},
|
|
11
|
+
"Microsoft.Windows.CppWinRT": {
|
|
12
|
+
"type": "Direct",
|
|
13
|
+
"requested": "[2.0.230706.1, )",
|
|
14
|
+
"resolved": "2.0.230706.1",
|
|
15
|
+
"contentHash": "l0D7oCw/5X+xIKHqZTi62TtV+1qeSz7KVluNFdrJ9hXsst4ghvqQ/Yhura7JqRdZWBXAuDS0G0KwALptdoxweQ=="
|
|
16
|
+
},
|
|
17
|
+
"fmt.win32": {
|
|
18
|
+
"type": "Project"
|
|
19
|
+
},
|
|
20
|
+
"folly.win32": {
|
|
21
|
+
"type": "Project",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"boost": "[1.84.0, )",
|
|
24
|
+
"fmt.win32": "[1.0.0, )"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"native,Version=v0.0/win": {},
|
|
29
|
+
"native,Version=v0.0/win-arm64": {},
|
|
30
|
+
"native,Version=v0.0/win-x64": {},
|
|
31
|
+
"native,Version=v0.0/win-x86": {}
|
|
32
|
+
}
|
|
33
|
+
}
|
package/fmt/fmt.vcxproj
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
3
|
<PropertyGroup Label="Globals">
|
|
4
|
-
<ProjectGuid>{14b93dc8-fd93-4a6d-81cb-8bc96644501c}</ProjectGuid>
|
|
4
|
+
<ProjectGuid Condition="'$(ReactTargetWin32)' != 'true'">{14b93dc8-fd93-4a6d-81cb-8bc96644501c}</ProjectGuid>
|
|
5
5
|
<Keyword>StaticLibrary</Keyword>
|
|
6
|
-
<ProjectName>fmt</ProjectName>
|
|
6
|
+
<ProjectName Condition="'$(ReactTargetWin32)' != 'true'">fmt</ProjectName>
|
|
7
7
|
<RootNamespace>fmt</RootNamespace>
|
|
8
8
|
<DefaultLanguage>en-US</DefaultLanguage>
|
|
9
|
-
<AppContainerApplication>true</AppContainerApplication>
|
|
10
|
-
<ApplicationType>Windows Store</ApplicationType>
|
|
11
|
-
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
|
9
|
+
<AppContainerApplication Condition="'$(ReactTargetWin32)' != 'true'">true</AppContainerApplication>
|
|
10
|
+
<ApplicationType Condition="'$(ReactTargetWin32)' != 'true'">Windows Store</ApplicationType>
|
|
11
|
+
<ApplicationTypeRevision Condition="'$(ReactTargetWin32)' != 'true'">10.0</ApplicationTypeRevision>
|
|
12
12
|
</PropertyGroup>
|
|
13
13
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
14
14
|
<Import Project="$(ReactNativeWindowsDir)PropertySheets\React.Cpp.props" />
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
</ImportGroup>
|
|
81
81
|
<ImportGroup Label="PropertySheets">
|
|
82
82
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
83
|
+
<Import Project="$(ReactNativeWindowsDir)PropertySheets\HybridCRT.props" Condition="'$(ReactTargetWin32)' == 'true'" />
|
|
83
84
|
</ImportGroup>
|
|
84
85
|
<PropertyGroup Label="UserMacros" />
|
|
85
86
|
<PropertyGroup>
|
|
@@ -89,6 +90,7 @@
|
|
|
89
90
|
<ItemDefinitionGroup>
|
|
90
91
|
<ClCompile>
|
|
91
92
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
|
93
|
+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
|
92
94
|
<CompileAsWinRT>false</CompileAsWinRT>
|
|
93
95
|
<SDLCheck>true</SDLCheck>
|
|
94
96
|
<AdditionalIncludeDirectories>$(FmtDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
+
<PropertyGroup Label="Globals">
|
|
4
|
+
<ProjectGuid>{4A98E8E8-F0B2-4F45-8A0E-9F4C7A81A239}</ProjectGuid>
|
|
5
|
+
<ProjectName>fmt.win32</ProjectName>
|
|
6
|
+
<Keyword>StaticLibrary</Keyword>
|
|
7
|
+
<ReactTargetWin32>true</ReactTargetWin32>
|
|
8
|
+
</PropertyGroup>
|
|
9
|
+
<Import Project="fmt.vcxproj" />
|
|
10
|
+
</Project>
|
package/package.json
CHANGED
|
@@ -40,18 +40,21 @@ _Use_decl_annotations_ int CALLBACK WinMain(HINSTANCE instance, HINSTANCE, PSTR
|
|
|
40
40
|
// Register any native modules defined within this app project
|
|
41
41
|
settings.PackageProviders().Append(winrt::make<CompReactPackageProvider>());
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
// Load the JS bundle from a file (not Metro):
|
|
43
|
+
// When loading the JS bundle from a file (not Metro):
|
|
45
44
|
// Set the path (on disk) where the .bundle file is located
|
|
46
45
|
settings.BundleRootPath(std::wstring(L"file://").append(appDirectory).append(L"\\Bundle\\").c_str());
|
|
46
|
+
|
|
47
47
|
// Set the name of the bundle file (without the .bundle extension)
|
|
48
48
|
settings.JavaScriptBundleFile(L"index.windows");
|
|
49
|
-
|
|
49
|
+
|
|
50
|
+
// JS Entry file to use when loading from Metro:
|
|
51
|
+
settings.DebugBundlePath(L"index");
|
|
52
|
+
|
|
53
|
+
#if BUNDLE
|
|
54
|
+
// Disable hot reload - bundle will be loaded from prebuilt bundle file.
|
|
50
55
|
settings.UseFastRefresh(false);
|
|
51
56
|
#else
|
|
52
|
-
//
|
|
53
|
-
settings.JavaScriptBundleFile(L"index");
|
|
54
|
-
// Enable hot reload
|
|
57
|
+
// Enable hot reload - load the JS bundle from Metro
|
|
55
58
|
settings.UseFastRefresh(true);
|
|
56
59
|
#endif
|
|
57
60
|
#if _DEBUG
|