react-native-windows 0.74.4 → 0.74.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/Libraries/Components/TextInput/TextInput.windows.js +6 -2
- package/Libraries/Components/View/View.windows.js +3 -0
- package/Microsoft.ReactNative/ComponentView.idl +26 -0
- package/Microsoft.ReactNative/CompositionComponentView.idl +19 -7
- package/Microsoft.ReactNative/CompositionRootView.idl +1 -0
- package/Microsoft.ReactNative/CompositionUIService.idl +4 -0
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.cpp +2 -1
- package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +106 -19
- package/Microsoft.ReactNative/Fabric/AbiViewProps.h +45 -13
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +83 -12
- package/Microsoft.ReactNative/Fabric/ComponentView.h +33 -2
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +28 -64
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.h +7 -11
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView.cpp +30 -11
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView.h +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView_emptyimpl.cpp +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService.cpp +12 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService.h +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService_emptyimpl.cpp +6 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +60 -39
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +19 -6
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.cpp +152 -0
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.h +85 -0
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +49 -95
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +11 -15
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +16 -31
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +5 -8
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +24 -81
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +4 -13
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +41 -40
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +5 -1
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +53 -68
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +5 -7
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +38 -84
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.h +6 -10
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +59 -109
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +9 -15
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +1 -0
- package/Microsoft.ReactNative/FocusManager.idl +22 -0
- package/Microsoft.ReactNative/ViewProps.idl +37 -3
- package/Microsoft.ReactNative.Cxx/JSValueComposition.h +4 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/Shared/Shared.vcxitems +6 -0
- package/package.json +1 -1
package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp
CHANGED
|
@@ -164,7 +164,7 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
164
164
|
|
|
165
165
|
//@cmember Show the caret
|
|
166
166
|
BOOL TxShowCaret(BOOL fShow) override {
|
|
167
|
-
m_outer->ShowCaret(m_outer->
|
|
167
|
+
m_outer->ShowCaret(m_outer->windowsTextInputProps().caretHidden ? false : fShow);
|
|
168
168
|
return true;
|
|
169
169
|
}
|
|
170
170
|
|
|
@@ -224,7 +224,7 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
224
224
|
winrt::Microsoft::ReactNative::ComponentView view{nullptr};
|
|
225
225
|
winrt::check_hresult(
|
|
226
226
|
m_outer->QueryInterface(winrt::guid_of<winrt::Microsoft::ReactNative::ComponentView>(), winrt::put_abi(view)));
|
|
227
|
-
m_outer->rootComponentView()->
|
|
227
|
+
m_outer->rootComponentView()->TrySetFocusedComponent(view);
|
|
228
228
|
// assert(false);
|
|
229
229
|
// TODO focus
|
|
230
230
|
}
|
|
@@ -304,14 +304,14 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
304
304
|
|
|
305
305
|
switch (nIndex) {
|
|
306
306
|
case COLOR_WINDOWTEXT:
|
|
307
|
-
if (m_outer->
|
|
308
|
-
return (*m_outer->
|
|
307
|
+
if (m_outer->windowsTextInputProps().textAttributes.foregroundColor)
|
|
308
|
+
return (*m_outer->windowsTextInputProps().textAttributes.foregroundColor).AsColorRefNoAlpha();
|
|
309
309
|
// cr = 0x000000FF;
|
|
310
310
|
break;
|
|
311
311
|
|
|
312
312
|
case COLOR_WINDOW:
|
|
313
|
-
if (m_outer->
|
|
314
|
-
return (*m_outer->
|
|
313
|
+
if (m_outer->viewProps()->backgroundColor)
|
|
314
|
+
return (*m_outer->viewProps()->backgroundColor).AsColorRefNoAlpha();
|
|
315
315
|
break;
|
|
316
316
|
// case COLOR_HIGHLIGHT:
|
|
317
317
|
// cr = RGB(0, 0, 255);
|
|
@@ -356,8 +356,8 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
356
356
|
|
|
357
357
|
//@cmember Get the maximum length for the text
|
|
358
358
|
HRESULT TxGetMaxLength(DWORD *plength) override {
|
|
359
|
-
auto length = m_outer->
|
|
360
|
-
if (length > static_cast<decltype(m_outer->
|
|
359
|
+
auto length = m_outer->windowsTextInputProps().maxLength;
|
|
360
|
+
if (length > static_cast<decltype(m_outer->windowsTextInputProps().maxLength)>(std::numeric_limits<DWORD>::max())) {
|
|
361
361
|
length = std::numeric_limits<DWORD>::max();
|
|
362
362
|
}
|
|
363
363
|
*plength = static_cast<DWORD>(length);
|
|
@@ -454,7 +454,7 @@ facebook::react::AttributedString WindowsTextInputComponentView::getAttributedSt
|
|
|
454
454
|
|
|
455
455
|
auto childTextAttributes = facebook::react::TextAttributes::defaultTextAttributes();
|
|
456
456
|
|
|
457
|
-
childTextAttributes.apply(
|
|
457
|
+
childTextAttributes.apply(windowsTextInputProps().textAttributes);
|
|
458
458
|
|
|
459
459
|
auto attributedString = facebook::react::AttributedString{};
|
|
460
460
|
// auto attachments = facebook::react::BaseTextShadowNode::Attachments{};
|
|
@@ -465,7 +465,7 @@ facebook::react::AttributedString WindowsTextInputComponentView::getAttributedSt
|
|
|
465
465
|
// if (!m_props->text.empty()) {
|
|
466
466
|
if (!text.empty()) {
|
|
467
467
|
auto textAttributes = facebook::react::TextAttributes::defaultTextAttributes();
|
|
468
|
-
textAttributes.apply(
|
|
468
|
+
textAttributes.apply(windowsTextInputProps().textAttributes);
|
|
469
469
|
auto fragment = facebook::react::AttributedString::Fragment{};
|
|
470
470
|
fragment.string = text;
|
|
471
471
|
// fragment.string = m_props->text;
|
|
@@ -486,14 +486,12 @@ WindowsTextInputComponentView::WindowsTextInputComponentView(
|
|
|
486
486
|
facebook::react::Tag tag,
|
|
487
487
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext)
|
|
488
488
|
: Super(
|
|
489
|
+
WindowsTextInputComponentView::defaultProps(),
|
|
489
490
|
compContext,
|
|
490
491
|
tag,
|
|
491
492
|
reactContext,
|
|
492
493
|
ComponentViewFeatures::Default & ~ComponentViewFeatures::Background,
|
|
493
494
|
false) {
|
|
494
|
-
static auto const defaultProps = std::make_shared<facebook::react::WindowsTextInputProps const>();
|
|
495
|
-
m_props = defaultProps;
|
|
496
|
-
|
|
497
495
|
/*
|
|
498
496
|
m_textChangedRevoker =
|
|
499
497
|
m_element.TextChanged(winrt::auto_revoke, [this](auto sender, xaml::Controls::TextChangedEventArgs args) {
|
|
@@ -931,8 +929,9 @@ void WindowsTextInputComponentView::UnmountChildComponentView(
|
|
|
931
929
|
base_type::UnmountChildComponentView(childComponentView, index);
|
|
932
930
|
}
|
|
933
931
|
|
|
934
|
-
void WindowsTextInputComponentView::
|
|
935
|
-
|
|
932
|
+
void WindowsTextInputComponentView::onLostFocus(
|
|
933
|
+
const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs &args) noexcept {
|
|
934
|
+
Super::onLostFocus(args);
|
|
936
935
|
if (m_textServices) {
|
|
937
936
|
LRESULT lresult;
|
|
938
937
|
DrawBlock db(*this);
|
|
@@ -941,8 +940,9 @@ void WindowsTextInputComponentView::onFocusLost() noexcept {
|
|
|
941
940
|
m_caretVisual.IsVisible(false);
|
|
942
941
|
}
|
|
943
942
|
|
|
944
|
-
void WindowsTextInputComponentView::
|
|
945
|
-
|
|
943
|
+
void WindowsTextInputComponentView::onGotFocus(
|
|
944
|
+
const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs &args) noexcept {
|
|
945
|
+
Super::onGotFocus(args);
|
|
946
946
|
if (m_textServices) {
|
|
947
947
|
LRESULT lresult;
|
|
948
948
|
DrawBlock db(*this);
|
|
@@ -950,20 +950,16 @@ void WindowsTextInputComponentView::onFocusGained() noexcept {
|
|
|
950
950
|
}
|
|
951
951
|
}
|
|
952
952
|
|
|
953
|
-
bool WindowsTextInputComponentView::focusable() const noexcept {
|
|
954
|
-
return m_props->focusable;
|
|
955
|
-
}
|
|
956
|
-
|
|
957
953
|
std::string WindowsTextInputComponentView::DefaultControlType() const noexcept {
|
|
958
954
|
return "textinput";
|
|
959
955
|
}
|
|
960
956
|
|
|
961
957
|
std::string WindowsTextInputComponentView::DefaultAccessibleName() const noexcept {
|
|
962
|
-
return
|
|
958
|
+
return windowsTextInputProps().placeholder;
|
|
963
959
|
}
|
|
964
960
|
|
|
965
961
|
std::string WindowsTextInputComponentView::DefaultHelpText() const noexcept {
|
|
966
|
-
return
|
|
962
|
+
return windowsTextInputProps().placeholder;
|
|
967
963
|
}
|
|
968
964
|
|
|
969
965
|
void WindowsTextInputComponentView::updateCursorColor(
|
|
@@ -981,19 +977,13 @@ void WindowsTextInputComponentView::updateCursorColor(
|
|
|
981
977
|
void WindowsTextInputComponentView::updateProps(
|
|
982
978
|
facebook::react::Props::Shared const &props,
|
|
983
979
|
facebook::react::Props::Shared const &oldProps) noexcept {
|
|
984
|
-
const auto &oldTextInputProps =
|
|
980
|
+
const auto &oldTextInputProps =
|
|
981
|
+
*std::static_pointer_cast<const facebook::react::WindowsTextInputProps>(oldProps ? oldProps : viewProps());
|
|
985
982
|
const auto &newTextInputProps = *std::static_pointer_cast<const facebook::react::WindowsTextInputProps>(props);
|
|
986
983
|
|
|
987
984
|
DWORD propBitsMask = 0;
|
|
988
985
|
DWORD propBits = 0;
|
|
989
986
|
|
|
990
|
-
ensureVisual();
|
|
991
|
-
|
|
992
|
-
if (oldTextInputProps.testId != newTextInputProps.testId) {
|
|
993
|
-
m_visual.Comment(winrt::to_hstring(newTextInputProps.testId));
|
|
994
|
-
}
|
|
995
|
-
// update BaseComponentView props
|
|
996
|
-
updateTransformProps(oldTextInputProps, newTextInputProps, m_visual);
|
|
997
987
|
Super::updateProps(props, oldProps);
|
|
998
988
|
|
|
999
989
|
if (!facebook::react::floatEquality(
|
|
@@ -1105,8 +1095,6 @@ void WindowsTextInputComponentView::updateProps(
|
|
|
1105
1095
|
}
|
|
1106
1096
|
*/
|
|
1107
1097
|
|
|
1108
|
-
m_props = std::static_pointer_cast<facebook::react::WindowsTextInputProps const>(props);
|
|
1109
|
-
|
|
1110
1098
|
if (propBitsMask != 0) {
|
|
1111
1099
|
DrawBlock db(*this);
|
|
1112
1100
|
winrt::check_hresult(m_textServices->OnTxPropertyBitsChange(propBitsMask, propBits));
|
|
@@ -1177,10 +1165,6 @@ void WindowsTextInputComponentView::updateLayoutMetrics(
|
|
|
1177
1165
|
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept {
|
|
1178
1166
|
// Set Position & Size Properties
|
|
1179
1167
|
|
|
1180
|
-
if ((layoutMetrics.displayType != m_layoutMetrics.displayType)) {
|
|
1181
|
-
OuterVisual().IsVisible(layoutMetrics.displayType != facebook::react::DisplayType::None);
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
1168
|
if ((layoutMetrics.pointScaleFactor != m_layoutMetrics.pointScaleFactor)) {
|
|
1185
1169
|
LRESULT res;
|
|
1186
1170
|
winrt::check_hresult(m_textServices->TxSendMessage(
|
|
@@ -1202,10 +1186,6 @@ void WindowsTextInputComponentView::updateLayoutMetrics(
|
|
|
1202
1186
|
|
|
1203
1187
|
m_imgWidth = newWidth;
|
|
1204
1188
|
m_imgHeight = newHeight;
|
|
1205
|
-
|
|
1206
|
-
m_visual.Size(
|
|
1207
|
-
{layoutMetrics.frame.size.width * layoutMetrics.pointScaleFactor,
|
|
1208
|
-
layoutMetrics.frame.size.height * layoutMetrics.pointScaleFactor});
|
|
1209
1189
|
}
|
|
1210
1190
|
|
|
1211
1191
|
// When we are notified by RichEdit that the text changed, we need to notify JS
|
|
@@ -1282,13 +1262,16 @@ void WindowsTextInputComponentView::setAcccessiblityValue(std::string &&value) n
|
|
|
1282
1262
|
}
|
|
1283
1263
|
|
|
1284
1264
|
bool WindowsTextInputComponentView::getAcccessiblityIsReadOnly() noexcept {
|
|
1285
|
-
return !
|
|
1265
|
+
return !windowsTextInputProps().editable;
|
|
1286
1266
|
}
|
|
1287
1267
|
|
|
1288
|
-
|
|
1268
|
+
facebook::react::SharedViewProps WindowsTextInputComponentView::defaultProps() noexcept {
|
|
1269
|
+
static auto const defaultProps = std::make_shared<facebook::react::WindowsTextInputProps const>();
|
|
1270
|
+
return defaultProps;
|
|
1271
|
+
}
|
|
1289
1272
|
|
|
1290
|
-
facebook::react::
|
|
1291
|
-
return
|
|
1273
|
+
const facebook::react::WindowsTextInputProps &WindowsTextInputComponentView::windowsTextInputProps() const noexcept {
|
|
1274
|
+
return *std::static_pointer_cast<const facebook::react::WindowsTextInputProps>(viewProps());
|
|
1292
1275
|
}
|
|
1293
1276
|
|
|
1294
1277
|
void WindowsTextInputComponentView::UpdateCharFormat() noexcept {
|
|
@@ -1311,17 +1294,18 @@ void WindowsTextInputComponentView::UpdateCharFormat() noexcept {
|
|
|
1311
1294
|
// cfNew.bPitchAndFamily = FF_DONTCARE;
|
|
1312
1295
|
|
|
1313
1296
|
// set font size -- 15 to convert twips to pt
|
|
1314
|
-
|
|
1297
|
+
const auto &props = windowsTextInputProps();
|
|
1298
|
+
float fontSize = props.textAttributes.fontSize;
|
|
1315
1299
|
if (std::isnan(fontSize))
|
|
1316
1300
|
fontSize = facebook::react::TextAttributes::defaultTextAttributes().fontSize;
|
|
1317
|
-
// TODO get fontSize from
|
|
1301
|
+
// TODO get fontSize from props.textAttributes, or defaultTextAttributes, or fragment?
|
|
1318
1302
|
cfNew.dwMask |= CFM_SIZE;
|
|
1319
1303
|
cfNew.yHeight = static_cast<LONG>(fontSize * 15);
|
|
1320
1304
|
|
|
1321
1305
|
// set bold
|
|
1322
1306
|
cfNew.dwMask |= CFM_WEIGHT;
|
|
1323
|
-
cfNew.wWeight =
|
|
1324
|
-
|
|
1307
|
+
cfNew.wWeight =
|
|
1308
|
+
props.textAttributes.fontWeight ? static_cast<WORD>(*props.textAttributes.fontWeight) : DWRITE_FONT_WEIGHT_NORMAL;
|
|
1325
1309
|
|
|
1326
1310
|
// set font style
|
|
1327
1311
|
// cfNew.dwMask |= (CFM_ITALIC | CFM_STRIKEOUT | CFM_UNDERLINE);
|
|
@@ -1392,7 +1376,7 @@ void WindowsTextInputComponentView::ensureDrawingSurface() noexcept {
|
|
|
1392
1376
|
m_drawingSurface.HorizontalAlignmentRatio(0.f);
|
|
1393
1377
|
m_drawingSurface.VerticalAlignmentRatio(0.f);
|
|
1394
1378
|
m_drawingSurface.Stretch(winrt::Microsoft::ReactNative::Composition::Experimental::CompositionStretch::None);
|
|
1395
|
-
|
|
1379
|
+
Visual().as<Experimental::ISpriteVisual>().Brush(m_drawingSurface);
|
|
1396
1380
|
}
|
|
1397
1381
|
}
|
|
1398
1382
|
|
|
@@ -1406,11 +1390,12 @@ winrt::com_ptr<::IDWriteTextLayout> WindowsTextInputComponentView::CreatePlaceho
|
|
|
1406
1390
|
winrt::com_ptr<::IDWriteTextLayout> textLayout = nullptr;
|
|
1407
1391
|
facebook::react::AttributedString attributedString;
|
|
1408
1392
|
facebook::react::AttributedString::Fragment fragment1;
|
|
1409
|
-
|
|
1410
|
-
|
|
1393
|
+
const auto &props = windowsTextInputProps();
|
|
1394
|
+
facebook::react::TextAttributes textAttributes = props.textAttributes;
|
|
1395
|
+
if (std::isnan(props.textAttributes.fontSize)) {
|
|
1411
1396
|
textAttributes.fontSize = 12.0f;
|
|
1412
1397
|
}
|
|
1413
|
-
fragment1.string =
|
|
1398
|
+
fragment1.string = props.placeholder;
|
|
1414
1399
|
fragment1.textAttributes = textAttributes;
|
|
1415
1400
|
attributedString.appendFragment(fragment1);
|
|
1416
1401
|
|
|
@@ -1461,8 +1446,9 @@ void WindowsTextInputComponentView::DrawText() noexcept {
|
|
|
1461
1446
|
|
|
1462
1447
|
winrt::check_hresult(m_textServices->OnTxInPlaceActivate(&rcClient));
|
|
1463
1448
|
|
|
1464
|
-
|
|
1465
|
-
|
|
1449
|
+
const auto &props = windowsTextInputProps();
|
|
1450
|
+
if (facebook::react::isColorMeaningful(props.backgroundColor)) {
|
|
1451
|
+
auto backgroundColor = theme()->D2DColor(*props.backgroundColor);
|
|
1466
1452
|
winrt::com_ptr<ID2D1SolidColorBrush> backgroundBrush;
|
|
1467
1453
|
winrt::check_hresult(d2dDeviceContext->CreateSolidColorBrush(backgroundColor, backgroundBrush.put()));
|
|
1468
1454
|
const D2D1_RECT_F fillRect = {
|
|
@@ -1478,11 +1464,11 @@ void WindowsTextInputComponentView::DrawText() noexcept {
|
|
|
1478
1464
|
winrt::check_hresult(hrDraw);
|
|
1479
1465
|
|
|
1480
1466
|
// draw placeholder text if needed
|
|
1481
|
-
if (!
|
|
1467
|
+
if (!props.placeholder.empty() && GetTextFromRichEdit().empty()) {
|
|
1482
1468
|
// set brush color
|
|
1483
1469
|
winrt::com_ptr<ID2D1SolidColorBrush> brush;
|
|
1484
|
-
if (
|
|
1485
|
-
auto color = theme()->D2DColor(*
|
|
1470
|
+
if (props.placeholderTextColor) {
|
|
1471
|
+
auto color = theme()->D2DColor(*props.placeholderTextColor);
|
|
1486
1472
|
winrt::check_hresult(d2dDeviceContext->CreateSolidColorBrush(color, brush.put()));
|
|
1487
1473
|
} else {
|
|
1488
1474
|
winrt::check_hresult(
|
|
@@ -1507,65 +1493,29 @@ void WindowsTextInputComponentView::DrawText() noexcept {
|
|
|
1507
1493
|
m_needsRedraw = false;
|
|
1508
1494
|
}
|
|
1509
1495
|
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
ComponentView
|
|
1523
|
-
*>(child)->hitTest(ptLocal, localPt); return targetTag != -1;
|
|
1524
|
-
}))
|
|
1525
|
-
return targetTag;
|
|
1526
|
-
*/
|
|
1527
|
-
|
|
1528
|
-
if ((ignorePointerEvents || m_props->pointerEvents == facebook::react::PointerEventsMode::Auto ||
|
|
1529
|
-
m_props->pointerEvents == facebook::react::PointerEventsMode::BoxOnly) &&
|
|
1530
|
-
ptLocal.x >= 0 && ptLocal.x <= m_layoutMetrics.frame.size.width && ptLocal.y >= 0 &&
|
|
1531
|
-
ptLocal.y <= m_layoutMetrics.frame.size.height) {
|
|
1532
|
-
localPt = ptLocal;
|
|
1533
|
-
return Tag();
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
return -1;
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
void WindowsTextInputComponentView::ensureVisual() noexcept {
|
|
1540
|
-
if (!m_visual) {
|
|
1541
|
-
HrEnsureRichEd20Loaded();
|
|
1542
|
-
m_visual = m_compContext.CreateSpriteVisual();
|
|
1543
|
-
m_textHost = winrt::make<CompTextHost>(this);
|
|
1544
|
-
winrt::com_ptr<::IUnknown> spUnk;
|
|
1545
|
-
winrt::check_hresult(g_pfnCreateTextServices(nullptr, m_textHost.get(), spUnk.put()));
|
|
1546
|
-
spUnk.as(m_textServices);
|
|
1547
|
-
OuterVisual().InsertAt(m_visual, 0);
|
|
1548
|
-
}
|
|
1496
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual
|
|
1497
|
+
WindowsTextInputComponentView::createVisual() noexcept {
|
|
1498
|
+
HrEnsureRichEd20Loaded();
|
|
1499
|
+
auto visual = m_compContext.CreateSpriteVisual();
|
|
1500
|
+
m_textHost = winrt::make<CompTextHost>(this);
|
|
1501
|
+
winrt::com_ptr<::IUnknown> spUnk;
|
|
1502
|
+
winrt::check_hresult(g_pfnCreateTextServices(nullptr, m_textHost.get(), spUnk.put()));
|
|
1503
|
+
spUnk.as(m_textServices);
|
|
1504
|
+
|
|
1505
|
+
m_caretVisual = m_compContext.CreateCaretVisual();
|
|
1506
|
+
visual.InsertAt(m_caretVisual.InnerVisual(), 0);
|
|
1507
|
+
m_caretVisual.IsVisible(false);
|
|
1549
1508
|
|
|
1550
|
-
|
|
1551
|
-
m_caretVisual = m_compContext.CreateCaretVisual();
|
|
1552
|
-
m_visual.InsertAt(m_caretVisual.InnerVisual(), 0);
|
|
1553
|
-
m_caretVisual.IsVisible(false);
|
|
1554
|
-
}
|
|
1509
|
+
return visual;
|
|
1555
1510
|
}
|
|
1556
1511
|
|
|
1557
1512
|
void WindowsTextInputComponentView::onThemeChanged() noexcept {
|
|
1558
|
-
auto props =
|
|
1559
|
-
updateCursorColor(props
|
|
1513
|
+
const auto &props = windowsTextInputProps();
|
|
1514
|
+
updateCursorColor(props.cursorColor, props.textAttributes.foregroundColor);
|
|
1560
1515
|
DrawText();
|
|
1561
1516
|
base_type::onThemeChanged();
|
|
1562
1517
|
}
|
|
1563
1518
|
|
|
1564
|
-
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual WindowsTextInputComponentView::Visual()
|
|
1565
|
-
const noexcept {
|
|
1566
|
-
return m_visual;
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
1519
|
winrt::Microsoft::ReactNative::ComponentView WindowsTextInputComponentView::Create(
|
|
1570
1520
|
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
1571
1521
|
facebook::react::Tag tag,
|
|
@@ -20,10 +20,11 @@
|
|
|
20
20
|
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
21
21
|
struct CompTextHost;
|
|
22
22
|
|
|
23
|
-
struct WindowsTextInputComponentView
|
|
23
|
+
struct WindowsTextInputComponentView
|
|
24
|
+
: WindowsTextInputComponentViewT<WindowsTextInputComponentView, ViewComponentView> {
|
|
24
25
|
friend CompTextHost;
|
|
25
26
|
|
|
26
|
-
using Super = WindowsTextInputComponentViewT<WindowsTextInputComponentView,
|
|
27
|
+
using Super = WindowsTextInputComponentViewT<WindowsTextInputComponentView, ViewComponentView>;
|
|
27
28
|
[[nodiscard]] static winrt::Microsoft::ReactNative::ComponentView Create(
|
|
28
29
|
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
29
30
|
facebook::react::Tag tag,
|
|
@@ -43,19 +44,13 @@ struct WindowsTextInputComponentView : WindowsTextInputComponentViewT<WindowsTex
|
|
|
43
44
|
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
44
45
|
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept override;
|
|
45
46
|
void FinalizeUpdates(winrt::Microsoft::ReactNative::ComponentViewUpdateMask updateMask) noexcept override;
|
|
46
|
-
|
|
47
|
-
facebook::react::
|
|
47
|
+
static facebook::react::SharedViewProps defaultProps() noexcept;
|
|
48
|
+
const facebook::react::WindowsTextInputProps &windowsTextInputProps() const noexcept;
|
|
48
49
|
void HandleCommand(winrt::hstring commandName, const winrt::Microsoft::ReactNative::IJSValueReader &args) noexcept
|
|
49
50
|
override;
|
|
50
|
-
facebook::react::Tag hitTest(
|
|
51
|
-
facebook::react::Point pt,
|
|
52
|
-
facebook::react::Point &localPt,
|
|
53
|
-
bool ignorePointerEvents = false) const noexcept override;
|
|
54
51
|
void OnRenderingDeviceLost() noexcept override;
|
|
55
|
-
winrt::Microsoft::ReactNative::Composition::
|
|
56
|
-
void
|
|
57
|
-
void onFocusGained() noexcept override;
|
|
58
|
-
bool focusable() const noexcept override;
|
|
52
|
+
void onLostFocus(const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs &args) noexcept override;
|
|
53
|
+
void onGotFocus(const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs &args) noexcept override;
|
|
59
54
|
std::string DefaultControlType() const noexcept override;
|
|
60
55
|
std::string DefaultAccessibleName() const noexcept override;
|
|
61
56
|
std::string DefaultHelpText() const noexcept override;
|
|
@@ -87,6 +82,8 @@ struct WindowsTextInputComponentView : WindowsTextInputComponentViewT<WindowsTex
|
|
|
87
82
|
facebook::react::Tag tag,
|
|
88
83
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext);
|
|
89
84
|
|
|
85
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual createVisual() noexcept;
|
|
86
|
+
|
|
90
87
|
private:
|
|
91
88
|
struct DrawBlock {
|
|
92
89
|
DrawBlock(WindowsTextInputComponentView &view);
|
|
@@ -95,7 +92,6 @@ struct WindowsTextInputComponentView : WindowsTextInputComponentViewT<WindowsTex
|
|
|
95
92
|
};
|
|
96
93
|
|
|
97
94
|
facebook::react::AttributedString getAttributedString() const;
|
|
98
|
-
void ensureVisual() noexcept;
|
|
99
95
|
void ensureDrawingSurface() noexcept;
|
|
100
96
|
void DrawText() noexcept;
|
|
101
97
|
void ShowCaret(bool show) noexcept;
|
|
@@ -114,7 +110,6 @@ struct WindowsTextInputComponentView : WindowsTextInputComponentViewT<WindowsTex
|
|
|
114
110
|
const winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs &args) noexcept;
|
|
115
111
|
|
|
116
112
|
winrt::Windows::UI::Composition::CompositionSurfaceBrush m_brush{nullptr};
|
|
117
|
-
winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual m_visual{nullptr};
|
|
118
113
|
winrt::Microsoft::ReactNative::Composition::Experimental::ICaretVisual m_caretVisual{nullptr};
|
|
119
114
|
winrt::Microsoft::ReactNative::Composition::Experimental::IDrawingSurfaceBrush m_drawingSurface{nullptr};
|
|
120
115
|
|
|
@@ -125,7 +120,6 @@ struct WindowsTextInputComponentView : WindowsTextInputComponentViewT<WindowsTex
|
|
|
125
120
|
winrt::com_ptr<ITextHost> m_textHost;
|
|
126
121
|
winrt::com_ptr<ITextServices2> m_textServices;
|
|
127
122
|
unsigned int m_imgWidth{0}, m_imgHeight{0};
|
|
128
|
-
std::shared_ptr<facebook::react::WindowsTextInputProps const> m_props;
|
|
129
123
|
std::shared_ptr<facebook::react::WindowsTextInputShadowNode::ConcreteState const> m_state;
|
|
130
124
|
RECT m_rcClient;
|
|
131
125
|
int64_t m_mostRecentEventCount{0};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import "ComponentView.idl";
|
|
5
|
+
#include "DocString.h"
|
|
6
|
+
|
|
7
|
+
namespace Microsoft.ReactNative.Composition
|
|
8
|
+
{
|
|
9
|
+
|
|
10
|
+
[default_interface]
|
|
11
|
+
[webhosthidden]
|
|
12
|
+
[experimental]
|
|
13
|
+
runtimeclass FocusManager
|
|
14
|
+
{
|
|
15
|
+
DOC_STRING("Retrieves the first component that can receive focus based on the specified scope.")
|
|
16
|
+
static Microsoft.ReactNative.ComponentView FindFirstFocusableElement(Microsoft.ReactNative.ComponentView searchScope);
|
|
17
|
+
|
|
18
|
+
DOC_STRING("Retrieves the last component that can receive focus based on the specified scope.")
|
|
19
|
+
static Microsoft.ReactNative.ComponentView FindLastFocusableElement(Microsoft.ReactNative.ComponentView searchScope);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace Microsoft.ReactNative.Composition
|
|
@@ -45,13 +45,47 @@ namespace Microsoft.ReactNative {
|
|
|
45
45
|
[webhosthidden]
|
|
46
46
|
[experimental]
|
|
47
47
|
DOC_STRING("Provides access to the properties on standard ViewProps.")
|
|
48
|
-
runtimeclass ViewProps
|
|
48
|
+
unsealed runtimeclass ViewProps
|
|
49
49
|
{
|
|
50
50
|
Single Opacity { get; };
|
|
51
|
-
|
|
52
51
|
Color BackgroundColor { get; };
|
|
53
|
-
|
|
52
|
+
String TestId { get; };
|
|
53
|
+
String AccessibilityLabel { get; };
|
|
54
|
+
|
|
54
55
|
// TODO add accessors to all the properties on ViewProps
|
|
55
56
|
};
|
|
56
57
|
|
|
58
|
+
[webhosthidden]
|
|
59
|
+
[experimental]
|
|
60
|
+
enum ImageSourceType
|
|
61
|
+
{
|
|
62
|
+
Invalid = 0,
|
|
63
|
+
Remote = 1,
|
|
64
|
+
Local = 2,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
[default_interface]
|
|
68
|
+
[webhosthidden]
|
|
69
|
+
[experimental]
|
|
70
|
+
runtimeclass ImageSource
|
|
71
|
+
{
|
|
72
|
+
ImageSourceType Type { get; };
|
|
73
|
+
String Uri { get; };
|
|
74
|
+
String Bundle { get; };
|
|
75
|
+
Single Scale { get; };
|
|
76
|
+
Windows.Foundation.Size Size { get; };
|
|
77
|
+
|
|
78
|
+
static ImageSource ReadValue(IJSValueReader reader);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
[default_interface]
|
|
82
|
+
[webhosthidden]
|
|
83
|
+
[experimental]
|
|
84
|
+
runtimeclass ImageProps : ViewProps
|
|
85
|
+
{
|
|
86
|
+
Windows.Foundation.Collections.IVectorView<ImageSource> Sources { get; };
|
|
87
|
+
// TODO add accessors to all the properties on ImageProps
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
57
91
|
} // namespace Microsoft. ReactNative
|
|
@@ -17,6 +17,10 @@ inline void WriteValue(IJSValueWriter const &writer, const Color &value) noexcep
|
|
|
17
17
|
winrt::Microsoft::ReactNative::Color::WriteValue(writer, value);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
inline void ReadValue(IJSValueReader const &reader, ImageSource &value) noexcept {
|
|
21
|
+
value = winrt::Microsoft::ReactNative::ImageSource::ReadValue(reader);
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
} // namespace winrt::Microsoft::ReactNative
|
|
21
25
|
|
|
22
26
|
#endif // MICROSOFT_REACTNATIVE_JSVALUECOMPOSITION
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.74.
|
|
13
|
+
<ReactNativeWindowsVersion>0.74.6</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>74</ReactNativeWindowsMinor>
|
|
16
|
-
<ReactNativeWindowsPatch>
|
|
16
|
+
<ReactNativeWindowsPatch>6</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>c93d7314ed1689c74689990641fbf3c1a54aa8cc</ReactNativeWindowsCommitId>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
</Project>
|
package/Shared/Shared.vcxitems
CHANGED
|
@@ -84,6 +84,11 @@
|
|
|
84
84
|
<DependentUpon>$(ReactNativeWindowsDir)Microsoft.ReactNative\CompositionUIService.idl</DependentUpon>
|
|
85
85
|
<SubType>Code</SubType>
|
|
86
86
|
</ClCompile>
|
|
87
|
+
<ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\FocusManager.cpp">
|
|
88
|
+
<ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
|
|
89
|
+
<DependentUpon>$(ReactNativeWindowsDir)Microsoft.ReactNative\FocusManager.idl</DependentUpon>
|
|
90
|
+
<SubType>Code</SubType>
|
|
91
|
+
</ClCompile>
|
|
87
92
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\UriImageManager.cpp">
|
|
88
93
|
<ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
|
|
89
94
|
<DependentUpon>$(ReactNativeWindowsDir)Microsoft.ReactNative\UriImageManager.idl</DependentUpon>
|
|
@@ -635,6 +640,7 @@
|
|
|
635
640
|
<Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\ComponentView.idl" />
|
|
636
641
|
<Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Composition.Input.idl" />
|
|
637
642
|
<Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\CompositionComponentView.idl" />
|
|
643
|
+
<Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\FocusManager.idl" />
|
|
638
644
|
<Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\CompositionContext.idl" />
|
|
639
645
|
<Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\CompositionHwndHost.idl" />
|
|
640
646
|
<Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\CompositionRootView.idl" />
|