react-native-windows 0.84.0-preview.5 → 0.84.0-preview.7
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/Libraries/Modal/Modal.windows.js +1 -7
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +58 -20
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +238 -57
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +18 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +14 -9
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +0 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +98 -44
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +4 -2
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +3 -3
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.h +3 -1
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +0 -1
- package/Microsoft.ReactNative/Modules/Animated/AnimatedNode.cpp +3 -3
- package/Microsoft.ReactNative/Modules/Animated/AnimatedNode.h +3 -2
- package/Microsoft.ReactNative/Modules/Timing.h +2 -1
- package/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/PropertySheets/JSEngine.props +1 -1
- package/package.json +1 -1
package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
#include <winrt/Microsoft.UI.Input.h>
|
|
19
19
|
#include <winrt/Windows.System.h>
|
|
20
20
|
#include <winrt/Windows.UI.h>
|
|
21
|
+
#include <mutex>
|
|
21
22
|
#include "../Composition.Input.h"
|
|
22
23
|
#include "../CompositionHelpers.h"
|
|
23
24
|
#include "../RootComponentView.h"
|
|
@@ -75,37 +76,38 @@ WindowsTextInputComponentView::DrawBlock::~DrawBlock() {
|
|
|
75
76
|
|
|
76
77
|
// Msftedit.dll vs "Riched20.dll"?
|
|
77
78
|
|
|
79
|
+
static std::once_flag g_richEditLoadedFlag;
|
|
78
80
|
static HINSTANCE g_hInstRichEdit = nullptr;
|
|
79
81
|
static PCreateTextServices g_pfnCreateTextServices;
|
|
80
82
|
|
|
81
83
|
HRESULT HrEnsureRichEd20Loaded() noexcept {
|
|
82
|
-
|
|
84
|
+
HRESULT hr = S_OK;
|
|
85
|
+
std::call_once(g_richEditLoadedFlag, [&hr]() {
|
|
83
86
|
g_hInstRichEdit = LoadLibrary(L"Msftedit.dll");
|
|
84
|
-
if (!g_hInstRichEdit)
|
|
85
|
-
|
|
87
|
+
if (!g_hInstRichEdit) {
|
|
88
|
+
hr = E_FAIL;
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
86
91
|
|
|
87
92
|
// Create the windowless control (text services object)
|
|
88
93
|
g_pfnCreateTextServices = (PCreateTextServices)GetProcAddress(g_hInstRichEdit, "CreateTextServices");
|
|
89
|
-
if (!g_pfnCreateTextServices)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
pfnRegister();
|
|
98
|
-
return S_OK;
|
|
99
|
-
} else
|
|
100
|
-
return E_FAIL;
|
|
101
|
-
*/
|
|
102
|
-
}
|
|
103
|
-
return NOERROR;
|
|
94
|
+
if (!g_pfnCreateTextServices) {
|
|
95
|
+
hr = E_FAIL;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
if (!g_hInstRichEdit || !g_pfnCreateTextServices)
|
|
100
|
+
return E_FAIL;
|
|
101
|
+
return hr;
|
|
104
102
|
}
|
|
105
103
|
|
|
106
104
|
struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
107
105
|
CompTextHost(WindowsTextInputComponentView *outer) : m_outer(outer) {}
|
|
108
106
|
|
|
107
|
+
void Detach() {
|
|
108
|
+
m_outer = nullptr;
|
|
109
|
+
}
|
|
110
|
+
|
|
109
111
|
//@cmember Get the DC for the host
|
|
110
112
|
HDC TxGetDC() override {
|
|
111
113
|
assert(false);
|
|
@@ -144,6 +146,8 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
144
146
|
|
|
145
147
|
//@cmember InvalidateRect
|
|
146
148
|
void TxInvalidateRect(LPCRECT prc, BOOL fMode) override {
|
|
149
|
+
if (!m_outer)
|
|
150
|
+
return;
|
|
147
151
|
if (m_outer->m_drawing)
|
|
148
152
|
return;
|
|
149
153
|
m_outer->DrawText();
|
|
@@ -151,6 +155,8 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
151
155
|
|
|
152
156
|
//@cmember Send a WM_PAINT to the window
|
|
153
157
|
void TxViewChange(BOOL fUpdate) override {
|
|
158
|
+
if (!m_outer)
|
|
159
|
+
return;
|
|
154
160
|
// When keyboard scrolling without scrollbar, TxInvalidateRect is not called.
|
|
155
161
|
// Instead TxViewChange is called with fUpdate = true
|
|
156
162
|
// if (fUpdate && !OnInnerViewerExtentChanged())
|
|
@@ -163,12 +169,16 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
163
169
|
|
|
164
170
|
//@cmember Create the caret
|
|
165
171
|
BOOL TxCreateCaret(HBITMAP hbmp, INT xWidth, INT yHeight) override {
|
|
172
|
+
if (!m_outer)
|
|
173
|
+
return false;
|
|
166
174
|
m_outer->m_caretVisual.Size({static_cast<float>(xWidth), static_cast<float>(yHeight)});
|
|
167
175
|
return true;
|
|
168
176
|
}
|
|
169
177
|
|
|
170
178
|
//@cmember Show the caret
|
|
171
179
|
BOOL TxShowCaret(BOOL fShow) override {
|
|
180
|
+
if (!m_outer)
|
|
181
|
+
return false;
|
|
172
182
|
// Only show the caret if we have focus
|
|
173
183
|
if (fShow && !m_outer->m_hasFocus) {
|
|
174
184
|
return false;
|
|
@@ -179,6 +189,8 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
179
189
|
|
|
180
190
|
//@cmember Set the caret position
|
|
181
191
|
BOOL TxSetCaretPos(INT x, INT y) override {
|
|
192
|
+
if (!m_outer)
|
|
193
|
+
return false;
|
|
182
194
|
if (x < 0 && y < 0) {
|
|
183
195
|
// RichEdit sends (-32000,-32000) when the caret is not currently visible.
|
|
184
196
|
return false;
|
|
@@ -217,6 +229,8 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
217
229
|
|
|
218
230
|
//@cmember Get mouse capture
|
|
219
231
|
void TxSetCapture(BOOL fCapture) override {
|
|
232
|
+
if (!m_outer)
|
|
233
|
+
return;
|
|
220
234
|
auto mousePointer = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::Pointer>(
|
|
221
235
|
winrt::Microsoft::ReactNative::Composition::Input::PointerDeviceType::Mouse, 1 /* 1 is Mouse PointerId*/);
|
|
222
236
|
|
|
@@ -229,6 +243,8 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
229
243
|
|
|
230
244
|
//@cmember Set the focus to the text window
|
|
231
245
|
void TxSetFocus() override {
|
|
246
|
+
if (!m_outer)
|
|
247
|
+
return;
|
|
232
248
|
winrt::Microsoft::ReactNative::ComponentView view{nullptr};
|
|
233
249
|
winrt::check_hresult(
|
|
234
250
|
m_outer->QueryInterface(winrt::guid_of<winrt::Microsoft::ReactNative::ComponentView>(), winrt::put_abi(view)));
|
|
@@ -242,11 +258,15 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
242
258
|
|
|
243
259
|
//@cmember Establish a new cursor shape
|
|
244
260
|
void TxSetCursor(HCURSOR hcur, BOOL fText) override {
|
|
261
|
+
if (!m_outer)
|
|
262
|
+
return;
|
|
245
263
|
m_outer->m_hcursor = hcur;
|
|
246
264
|
}
|
|
247
265
|
|
|
248
266
|
//@cmember Converts screen coordinates of a specified point to the client coordinates
|
|
249
267
|
BOOL TxScreenToClient(LPPOINT lppt) override {
|
|
268
|
+
if (!m_outer)
|
|
269
|
+
return false;
|
|
250
270
|
winrt::Windows::Foundation::Point pt{static_cast<float>(lppt->x), static_cast<float>(lppt->y)};
|
|
251
271
|
pt.X -= m_outer->m_contentOffsetPx.x;
|
|
252
272
|
pt.Y -= m_outer->m_contentOffsetPx.y;
|
|
@@ -258,6 +278,8 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
258
278
|
|
|
259
279
|
//@cmember Converts the client coordinates of a specified point to screen coordinates
|
|
260
280
|
BOOL TxClientToScreen(LPPOINT lppt) override {
|
|
281
|
+
if (!m_outer)
|
|
282
|
+
return false;
|
|
261
283
|
winrt::Windows::Foundation::Point pt{static_cast<float>(lppt->x), static_cast<float>(lppt->y)};
|
|
262
284
|
|
|
263
285
|
if (!m_outer->m_parent) {
|
|
@@ -284,6 +306,8 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
284
306
|
|
|
285
307
|
//@cmember Retrieves the coordinates of a window's client area
|
|
286
308
|
HRESULT TxGetClientRect(LPRECT prc) override {
|
|
309
|
+
if (!m_outer)
|
|
310
|
+
return E_FAIL;
|
|
287
311
|
*prc = m_outer->getClientRect();
|
|
288
312
|
|
|
289
313
|
prc->top += m_outer->m_contentOffsetPx.y;
|
|
@@ -310,6 +334,8 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
310
334
|
|
|
311
335
|
//@cmember Get the default character format for the text
|
|
312
336
|
HRESULT TxGetCharFormat(const CHARFORMATW **ppCF) override {
|
|
337
|
+
if (!m_outer)
|
|
338
|
+
return E_FAIL;
|
|
313
339
|
m_outer->UpdateCharFormat();
|
|
314
340
|
|
|
315
341
|
*ppCF = &(m_outer->m_cf);
|
|
@@ -318,6 +344,8 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
318
344
|
|
|
319
345
|
//@cmember Get the default paragraph format for the text
|
|
320
346
|
HRESULT TxGetParaFormat(const PARAFORMAT **ppPF) override {
|
|
347
|
+
if (!m_outer)
|
|
348
|
+
return E_FAIL;
|
|
321
349
|
m_outer->UpdateParaFormat();
|
|
322
350
|
|
|
323
351
|
*ppPF = &(m_outer->m_pf);
|
|
@@ -326,6 +354,8 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
326
354
|
|
|
327
355
|
//@cmember Get the background color for the window
|
|
328
356
|
COLORREF TxGetSysColor(int nIndex) override {
|
|
357
|
+
if (!m_outer)
|
|
358
|
+
return GetSysColor(nIndex);
|
|
329
359
|
// if (/* !m_isDisabled || */ nIndex != COLOR_WINDOW && nIndex != COLOR_WINDOWTEXT && nIndex != COLOR_GRAYTEXT) {
|
|
330
360
|
// This window is either not disabled or the color isn't interesting
|
|
331
361
|
// in the disabled case.
|
|
@@ -400,6 +430,10 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
400
430
|
|
|
401
431
|
//@cmember Get the maximum length for the text
|
|
402
432
|
HRESULT TxGetMaxLength(DWORD *plength) override {
|
|
433
|
+
if (!m_outer) {
|
|
434
|
+
*plength = std::numeric_limits<DWORD>::max();
|
|
435
|
+
return S_OK;
|
|
436
|
+
}
|
|
403
437
|
auto length = m_outer->windowsTextInputProps().maxLength;
|
|
404
438
|
if (length > static_cast<decltype(m_outer->windowsTextInputProps().maxLength)>(std::numeric_limits<DWORD>::max())) {
|
|
405
439
|
length = std::numeric_limits<DWORD>::max();
|
|
@@ -410,6 +444,10 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
410
444
|
|
|
411
445
|
//@cmember Get the bits representing requested scroll bars for the window
|
|
412
446
|
HRESULT TxGetScrollBars(DWORD *pdwScrollBar) override {
|
|
447
|
+
if (!m_outer) {
|
|
448
|
+
*pdwScrollBar = WS_HSCROLL | ES_AUTOHSCROLL;
|
|
449
|
+
return S_OK;
|
|
450
|
+
}
|
|
413
451
|
if (m_outer->m_multiline) {
|
|
414
452
|
*pdwScrollBar = WS_VSCROLL | WS_HSCROLL | ES_AUTOVSCROLL | ES_AUTOHSCROLL;
|
|
415
453
|
} else {
|
|
@@ -457,7 +495,8 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
457
495
|
|
|
458
496
|
//@cmember Notify host of events
|
|
459
497
|
HRESULT TxNotify(DWORD iNotify, void *pv) override {
|
|
460
|
-
|
|
498
|
+
if (!m_outer)
|
|
499
|
+
return S_OK;
|
|
461
500
|
|
|
462
501
|
switch (iNotify) {
|
|
463
502
|
case EN_UPDATE:
|
|
@@ -542,6 +581,16 @@ WindowsTextInputComponentView::WindowsTextInputComponentView(
|
|
|
542
581
|
reactContext,
|
|
543
582
|
ComponentViewFeatures::Default & ~ComponentViewFeatures::Background) {}
|
|
544
583
|
|
|
584
|
+
WindowsTextInputComponentView::~WindowsTextInputComponentView() {
|
|
585
|
+
// Release text services first to prevent further callbacks into CompTextHost.
|
|
586
|
+
m_textServices = nullptr;
|
|
587
|
+
|
|
588
|
+
// Detach the CompTextHost so any lingering references cannot use a dangling pointer.
|
|
589
|
+
if (m_textHost) {
|
|
590
|
+
winrt::get_self<CompTextHost>(m_textHost)->Detach();
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
545
594
|
void WindowsTextInputComponentView::HandleCommand(
|
|
546
595
|
const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept {
|
|
547
596
|
Super::HandleCommand(args);
|
|
@@ -649,17 +698,22 @@ WPARAM PointerRoutedEventArgsToMouseWParam(
|
|
|
649
698
|
return wParam;
|
|
650
699
|
}
|
|
651
700
|
|
|
652
|
-
bool WindowsTextInputComponentView::IsDoubleClick() {
|
|
701
|
+
bool WindowsTextInputComponentView::IsDoubleClick(uint32_t pointerId) {
|
|
653
702
|
using namespace std::chrono;
|
|
654
703
|
|
|
655
704
|
auto now = steady_clock::now();
|
|
656
|
-
auto
|
|
705
|
+
auto it = m_lastClickTimeByPointer.find(pointerId);
|
|
706
|
+
bool isDouble = false;
|
|
657
707
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
708
|
+
if (it != m_lastClickTimeByPointer.end()) {
|
|
709
|
+
auto duration = duration_cast<milliseconds>(now - it->second).count();
|
|
710
|
+
isDouble = (duration < ::GetDoubleClickTime());
|
|
711
|
+
it->second = now;
|
|
712
|
+
} else {
|
|
713
|
+
m_lastClickTimeByPointer[pointerId] = now;
|
|
714
|
+
}
|
|
661
715
|
|
|
662
|
-
return
|
|
716
|
+
return isDouble;
|
|
663
717
|
}
|
|
664
718
|
|
|
665
719
|
void WindowsTextInputComponentView::OnPointerPressed(
|
|
@@ -678,7 +732,7 @@ void WindowsTextInputComponentView::OnPointerPressed(
|
|
|
678
732
|
if (pp.PointerDeviceType() == winrt::Microsoft::ReactNative::Composition::Input::PointerDeviceType::Mouse) {
|
|
679
733
|
switch (pp.Properties().PointerUpdateKind()) {
|
|
680
734
|
case winrt::Microsoft::ReactNative::Composition::Input::PointerUpdateKind::LeftButtonPressed:
|
|
681
|
-
if (IsDoubleClick()) {
|
|
735
|
+
if (IsDoubleClick(pp.PointerId())) {
|
|
682
736
|
msg = WM_LBUTTONDBLCLK;
|
|
683
737
|
} else {
|
|
684
738
|
msg = WM_LBUTTONDOWN;
|
|
@@ -699,10 +753,14 @@ void WindowsTextInputComponentView::OnPointerPressed(
|
|
|
699
753
|
wParam |= (XBUTTON2 << 16);
|
|
700
754
|
break;
|
|
701
755
|
}
|
|
702
|
-
wParam
|
|
756
|
+
wParam |= PointerRoutedEventArgsToMouseWParam(args);
|
|
703
757
|
} else {
|
|
704
|
-
|
|
705
|
-
|
|
758
|
+
if (IsDoubleClick(pp.PointerId())) {
|
|
759
|
+
msg = WM_LBUTTONDBLCLK;
|
|
760
|
+
} else {
|
|
761
|
+
msg = WM_LBUTTONDOWN;
|
|
762
|
+
}
|
|
763
|
+
wParam = PointerRoutedEventArgsToMouseWParam(args);
|
|
706
764
|
}
|
|
707
765
|
|
|
708
766
|
if (m_textServices && msg) {
|
|
@@ -764,10 +822,10 @@ void WindowsTextInputComponentView::OnPointerReleased(
|
|
|
764
822
|
wParam |= (XBUTTON2 << 16);
|
|
765
823
|
break;
|
|
766
824
|
}
|
|
767
|
-
wParam
|
|
825
|
+
wParam |= PointerRoutedEventArgsToMouseWParam(args);
|
|
768
826
|
} else {
|
|
769
|
-
msg =
|
|
770
|
-
wParam =
|
|
827
|
+
msg = WM_LBUTTONUP;
|
|
828
|
+
wParam = PointerRoutedEventArgsToMouseWParam(args);
|
|
771
829
|
}
|
|
772
830
|
|
|
773
831
|
if (m_textServices && msg) {
|
|
@@ -817,23 +875,18 @@ void WindowsTextInputComponentView::OnPointerMoved(
|
|
|
817
875
|
static_cast<LONG>(position.Y * m_layoutMetrics.pointScaleFactor)};
|
|
818
876
|
lParam = static_cast<LPARAM>(POINTTOPOINTS(ptContainer));
|
|
819
877
|
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
wParam = PointerRoutedEventArgsToMouseWParam(args);
|
|
823
|
-
} else {
|
|
824
|
-
msg = WM_POINTERUPDATE;
|
|
825
|
-
wParam = PointerPointToPointerWParam(pp);
|
|
826
|
-
}
|
|
878
|
+
msg = WM_MOUSEMOVE;
|
|
879
|
+
wParam = PointerRoutedEventArgsToMouseWParam(args);
|
|
827
880
|
|
|
828
881
|
if (m_textServices) {
|
|
829
882
|
LRESULT lresult;
|
|
830
883
|
DrawBlock db(*this);
|
|
831
884
|
auto hr = m_textServices->TxSendMessage(msg, static_cast<WPARAM>(wParam), static_cast<LPARAM>(lParam), &lresult);
|
|
832
885
|
args.Handled(hr != S_FALSE);
|
|
833
|
-
}
|
|
834
886
|
|
|
835
|
-
|
|
836
|
-
|
|
887
|
+
m_textServices->OnTxSetCursor(
|
|
888
|
+
DVASPECT_CONTENT, -1, nullptr, nullptr, nullptr, nullptr, nullptr, ptContainer.x, ptContainer.y);
|
|
889
|
+
}
|
|
837
890
|
}
|
|
838
891
|
|
|
839
892
|
void WindowsTextInputComponentView::OnPointerWheelChanged(
|
|
@@ -935,7 +988,7 @@ bool WindowsTextInputComponentView::ShouldSubmit(
|
|
|
935
988
|
bool ctrlDown = (args.KeyboardSource().GetKeyState(winrt::Windows::System::VirtualKey::Control) &
|
|
936
989
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ==
|
|
937
990
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
938
|
-
bool altDown = (args.KeyboardSource().GetKeyState(winrt::Windows::System::VirtualKey::
|
|
991
|
+
bool altDown = (args.KeyboardSource().GetKeyState(winrt::Windows::System::VirtualKey::Menu) &
|
|
939
992
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ==
|
|
940
993
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
941
994
|
bool metaDown = (args.KeyboardSource().GetKeyState(winrt::Windows::System::VirtualKey::LeftWindows) &
|
|
@@ -946,7 +999,7 @@ bool WindowsTextInputComponentView::ShouldSubmit(
|
|
|
946
999
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
947
1000
|
return (submitKeyEvent.shiftKey && shiftDown) || (submitKeyEvent.ctrlKey && ctrlDown) ||
|
|
948
1001
|
(submitKeyEvent.altKey && altDown) || (submitKeyEvent.metaKey && metaDown) ||
|
|
949
|
-
(!submitKeyEvent.shiftKey && !submitKeyEvent.
|
|
1002
|
+
(!submitKeyEvent.shiftKey && !submitKeyEvent.ctrlKey && !submitKeyEvent.altKey && !submitKeyEvent.metaKey &&
|
|
950
1003
|
!shiftDown && !ctrlDown && !altDown && !metaDown);
|
|
951
1004
|
} else {
|
|
952
1005
|
shouldSubmit = false;
|
|
@@ -1836,6 +1889,7 @@ WindowsTextInputComponentView::createVisual() noexcept {
|
|
|
1836
1889
|
winrt::com_ptr<::IUnknown> spUnk;
|
|
1837
1890
|
winrt::check_hresult(g_pfnCreateTextServices(nullptr, m_textHost.get(), spUnk.put()));
|
|
1838
1891
|
spUnk.as(m_textServices);
|
|
1892
|
+
winrt::check_bool(m_textServices != nullptr);
|
|
1839
1893
|
|
|
1840
1894
|
LRESULT res;
|
|
1841
1895
|
winrt::check_hresult(m_textServices->TxSendMessage(EM_SETTEXTMODE, TM_PLAINTEXT, 0, &res));
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
#include <textserv.h>
|
|
12
12
|
#include <windows.ui.composition.interop.h>
|
|
13
13
|
#include <winrt/Windows.UI.Composition.h>
|
|
14
|
+
#include <unordered_map>
|
|
14
15
|
#include "../ComponentView.h"
|
|
15
16
|
#include "../CompositionHelpers.h"
|
|
16
17
|
#include "../CompositionViewComponentView.h"
|
|
@@ -74,12 +75,13 @@ struct WindowsTextInputComponentView
|
|
|
74
75
|
std::optional<std::string> getAccessiblityValue() noexcept override;
|
|
75
76
|
void setAcccessiblityValue(std::string &&value) noexcept override;
|
|
76
77
|
bool getAcccessiblityIsReadOnly() noexcept override;
|
|
77
|
-
bool IsDoubleClick();
|
|
78
|
+
bool IsDoubleClick(uint32_t pointerId);
|
|
78
79
|
|
|
79
80
|
WindowsTextInputComponentView(
|
|
80
81
|
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
81
82
|
facebook::react::Tag tag,
|
|
82
83
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext);
|
|
84
|
+
~WindowsTextInputComponentView();
|
|
83
85
|
|
|
84
86
|
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual createVisual() noexcept;
|
|
85
87
|
|
|
@@ -152,7 +154,7 @@ struct WindowsTextInputComponentView
|
|
|
152
154
|
DWORD m_propBits{0};
|
|
153
155
|
HCURSOR m_hcursor{nullptr};
|
|
154
156
|
POINT m_caretPosition{0, 0};
|
|
155
|
-
std::chrono::steady_clock::time_point
|
|
157
|
+
std::unordered_map<uint32_t, std::chrono::steady_clock::time_point> m_lastClickTimeByPointer;
|
|
156
158
|
std::vector<facebook::react::CompWindowsTextInputSubmitKeyEventsStruct> m_submitKeyEvents;
|
|
157
159
|
};
|
|
158
160
|
|
|
@@ -46,12 +46,12 @@ WindowsComponentDescriptorRegistry::WindowsComponentDescriptorRegistry()
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
void WindowsComponentDescriptorRegistry::add(const facebook::react::ComponentDescriptorProvider &provider) noexcept {
|
|
49
|
-
m_componentNames.
|
|
49
|
+
m_componentNames.insert(provider.name);
|
|
50
50
|
m_componentDescriptorRegistry->add(provider);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
bool WindowsComponentDescriptorRegistry::hasComponentProvider(const std::string &name) noexcept {
|
|
54
|
-
return
|
|
54
|
+
return m_componentNames.count(name) != 0;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
bool WindowsComponentDescriptorRegistry::isXamlSupportRequired() const noexcept {
|
|
@@ -68,7 +68,7 @@ void WindowsComponentDescriptorRegistry::Add(
|
|
|
68
68
|
auto builder = winrt::make<winrt::Microsoft::ReactNative::Composition::ReactCompositionViewComponentBuilder>();
|
|
69
69
|
provider(builder);
|
|
70
70
|
|
|
71
|
-
m_componentNames.
|
|
71
|
+
m_componentNames.insert(winrt::to_string(componentName));
|
|
72
72
|
m_descriptorFlavors.emplace_back(std::make_shared<std::string>(winrt::to_string(componentName)));
|
|
73
73
|
auto handle = reinterpret_cast<facebook::react::ComponentHandle>(
|
|
74
74
|
facebook::react::ComponentName(m_descriptorFlavors.back()->c_str()));
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
#include <ReactPropertyBag.h>
|
|
11
11
|
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
12
12
|
|
|
13
|
+
#include <unordered_set>
|
|
14
|
+
|
|
13
15
|
namespace Microsoft::ReactNative {
|
|
14
16
|
|
|
15
17
|
struct WindowsComponentDescriptorRegistry {
|
|
@@ -41,7 +43,7 @@ struct WindowsComponentDescriptorRegistry {
|
|
|
41
43
|
void add(const facebook::react::ComponentDescriptorProvider &provider) noexcept;
|
|
42
44
|
|
|
43
45
|
std::vector<std::shared_ptr<const std::string>> m_descriptorFlavors;
|
|
44
|
-
std::
|
|
46
|
+
std::unordered_set<std::string> m_componentNames;
|
|
45
47
|
std::shared_ptr<facebook::react::ComponentDescriptorProviderRegistry> m_componentDescriptorRegistry;
|
|
46
48
|
|
|
47
49
|
std::map<std::shared_ptr<const std::string>, winrt::Microsoft::ReactNative::IReactViewComponentBuilder const>
|
|
@@ -72,7 +72,6 @@ wicBitmapSourceFromStream(const winrt::Windows::Storage::Streams::IRandomAccessS
|
|
|
72
72
|
return {decodedFrame, imagingFactory, nullptr};
|
|
73
73
|
} catch (winrt::hresult_error const &ex) {
|
|
74
74
|
auto errorInfo = std::make_shared<facebook::react::ImageErrorInfo>();
|
|
75
|
-
errorInfo = std::make_shared<facebook::react::ImageErrorInfo>();
|
|
76
75
|
errorInfo->error = ::Microsoft::ReactNative::FormatHResultError(winrt::hresult_error(ex));
|
|
77
76
|
return {nullptr, nullptr, errorInfo};
|
|
78
77
|
}
|
|
@@ -22,19 +22,19 @@ int64_t AnimatedNode::Tag() {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
void AnimatedNode::AddChild(const int64_t animatedNodeTag) {
|
|
25
|
-
m_children.
|
|
25
|
+
m_children.insert(animatedNodeTag);
|
|
26
26
|
GetChildNode(animatedNodeTag)->OnAttachToNode(m_tag);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
void AnimatedNode::RemoveChild(const int64_t tag) {
|
|
30
30
|
if (const auto childNode = GetChildNode(tag)) {
|
|
31
31
|
childNode->OnDetachedFromNode(m_tag);
|
|
32
|
-
m_children.erase(
|
|
32
|
+
m_children.erase(tag);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
AnimatedNode *AnimatedNode::GetChildNode(int64_t tag) {
|
|
37
|
-
if (
|
|
37
|
+
if (m_children.count(tag)) {
|
|
38
38
|
if (const auto manager = m_manager.lock()) {
|
|
39
39
|
return manager->GetAnimatedNode(tag);
|
|
40
40
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
#include <JSValue.h>
|
|
7
7
|
#include <cstdint>
|
|
8
8
|
#include <memory>
|
|
9
|
+
#include <unordered_set>
|
|
9
10
|
#include <vector>
|
|
10
11
|
|
|
11
12
|
namespace Microsoft::ReactNative {
|
|
@@ -20,7 +21,7 @@ class AnimatedNode {
|
|
|
20
21
|
void AddChild(int64_t animatedNode);
|
|
21
22
|
void RemoveChild(int64_t animatedNode);
|
|
22
23
|
|
|
23
|
-
std::
|
|
24
|
+
std::unordered_set<int64_t> &Children() {
|
|
24
25
|
return m_children;
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -37,7 +38,7 @@ class AnimatedNode {
|
|
|
37
38
|
AnimatedNode *GetChildNode(int64_t tag);
|
|
38
39
|
int64_t m_tag{0};
|
|
39
40
|
const std::weak_ptr<NativeAnimatedNodeManager> m_manager;
|
|
40
|
-
std::
|
|
41
|
+
std::unordered_set<int64_t> m_children{};
|
|
41
42
|
bool m_useComposition{false};
|
|
42
43
|
|
|
43
44
|
bool HasCompatibleAnimationDriver(int64_t tag);
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
#include <ReactCoreInjection.h>
|
|
10
10
|
#include <react/runtime/PlatformTimerRegistry.h>
|
|
11
11
|
#include <react/runtime/TimerManager.h>
|
|
12
|
+
#include <atomic>
|
|
12
13
|
|
|
13
14
|
namespace Microsoft::ReactNative {
|
|
14
15
|
|
|
@@ -114,7 +115,7 @@ struct Timing : public std::enable_shared_from_this<Timing> {
|
|
|
114
115
|
xaml::Media::CompositionTarget::Rendering_revoker m_rendering;
|
|
115
116
|
winrt::Microsoft::ReactNative::ITimer m_dispatcherQueueTimer{nullptr};
|
|
116
117
|
winrt::weak_ref<winrt::Microsoft::ReactNative::IReactDispatcher> m_uiDispatcher;
|
|
117
|
-
bool m_usingRendering{false};
|
|
118
|
+
std::atomic<bool> m_usingRendering{false};
|
|
118
119
|
bool m_usePostForRendering{false};
|
|
119
120
|
};
|
|
120
121
|
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.84.0-preview.
|
|
13
|
+
<ReactNativeWindowsVersion>0.84.0-preview.7</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>84</ReactNativeWindowsMinor>
|
|
16
16
|
<ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>4c8074d47d675aee1d2110c5b92e9e349bfa1abb</ReactNativeWindowsCommitId>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
</Project>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<!-- Enabling this will (1) Include hermes glues in the Microsoft.ReactNative binaries AND (2) Make hermes the default engine -->
|
|
7
7
|
<UseHermes Condition="'$(UseHermes)' == ''">true</UseHermes>
|
|
8
8
|
<!-- This will be true if (1) the client want to use hermes by setting UseHermes to true OR (2) We are building for UWP where dynamic switching is enabled -->
|
|
9
|
-
<HermesVersion Condition="'$(HermesVersion)' == ''">0.0.0-
|
|
9
|
+
<HermesVersion Condition="'$(HermesVersion)' == ''">0.0.0-2604.21001-94aa5e1d</HermesVersion>
|
|
10
10
|
<HermesPackageName Condition="'$(HermesPackageName)' == ''">Microsoft.JavaScript.Hermes</HermesPackageName>
|
|
11
11
|
<HermesPackage Condition="'$(HermesPackage)' == '' And Exists('$(PkgMicrosoft_JavaScript_Hermes)')">$(PkgMicrosoft_JavaScript_Hermes)</HermesPackage>
|
|
12
12
|
<HermesPackage Condition="'$(HermesPackage)' == ''">$(NuGetPackageRoot)\$(HermesPackageName)\$(HermesVersion)</HermesPackage>
|