react-native-windows 0.82.0-preview.1 → 0.82.0-preview.3
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/Fabric/Composition/ParagraphComponentView.cpp +11 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +20 -12
- package/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/PropertySheets/Warnings.props +1 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/BaseParagraphProps.cpp +174 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/BaseParagraphProps.h +69 -0
- package/codegen/rnwcoreJSI-generated.cpp +422 -422
- package/package.json +4 -4
|
@@ -107,6 +107,10 @@ void ParagraphComponentView::updateProps(
|
|
|
107
107
|
m_requireRedraw = true;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
if (oldViewProps.selectionColor != newViewProps.selectionColor) {
|
|
111
|
+
m_requireRedraw = true;
|
|
112
|
+
}
|
|
113
|
+
|
|
110
114
|
Super::updateProps(props, oldProps);
|
|
111
115
|
}
|
|
112
116
|
|
|
@@ -454,9 +458,14 @@ void ParagraphComponentView::DrawSelectionHighlight(
|
|
|
454
458
|
return;
|
|
455
459
|
}
|
|
456
460
|
|
|
457
|
-
// TODO: use prop selectionColor if provided
|
|
458
461
|
winrt::com_ptr<ID2D1SolidColorBrush> selectionBrush;
|
|
459
|
-
|
|
462
|
+
D2D1_COLOR_F selectionColor;
|
|
463
|
+
const auto &props = paragraphProps();
|
|
464
|
+
if (props.selectionColor) {
|
|
465
|
+
selectionColor = theme()->D2DColor(**props.selectionColor);
|
|
466
|
+
} else {
|
|
467
|
+
selectionColor = theme()->D2DPlatformColor("Highlight@40");
|
|
468
|
+
}
|
|
460
469
|
hr = renderTarget.CreateSolidColorBrush(selectionColor, selectionBrush.put());
|
|
461
470
|
|
|
462
471
|
if (FAILED(hr)) {
|
package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp
CHANGED
|
@@ -1508,18 +1508,26 @@ void WindowsTextInputComponentView::UpdateCharFormat() noexcept {
|
|
|
1508
1508
|
cfNew.wWeight =
|
|
1509
1509
|
props.textAttributes.fontWeight ? static_cast<WORD>(*props.textAttributes.fontWeight) : DWRITE_FONT_WEIGHT_NORMAL;
|
|
1510
1510
|
|
|
1511
|
-
// set font style
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
//
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1511
|
+
// set font style (italic)
|
|
1512
|
+
cfNew.dwMask |= CFM_ITALIC;
|
|
1513
|
+
if (props.textAttributes.fontStyle == facebook::react::FontStyle::Italic ||
|
|
1514
|
+
props.textAttributes.fontStyle == facebook::react::FontStyle::Oblique) {
|
|
1515
|
+
cfNew.dwEffects |= CFE_ITALIC;
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
// set text decoration (underline and strikethrough)
|
|
1519
|
+
cfNew.dwMask |= (CFM_UNDERLINE | CFM_STRIKEOUT);
|
|
1520
|
+
if (props.textAttributes.textDecorationLineType.has_value()) {
|
|
1521
|
+
auto decorationType = *props.textAttributes.textDecorationLineType;
|
|
1522
|
+
if (decorationType == facebook::react::TextDecorationLineType::Underline ||
|
|
1523
|
+
decorationType == facebook::react::TextDecorationLineType::UnderlineStrikethrough) {
|
|
1524
|
+
cfNew.dwEffects |= CFE_UNDERLINE;
|
|
1525
|
+
}
|
|
1526
|
+
if (decorationType == facebook::react::TextDecorationLineType::Strikethrough ||
|
|
1527
|
+
decorationType == facebook::react::TextDecorationLineType::UnderlineStrikethrough) {
|
|
1528
|
+
cfNew.dwEffects |= CFE_STRIKEOUT;
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1523
1531
|
|
|
1524
1532
|
// set font family
|
|
1525
1533
|
if (!props.textAttributes.fontFamily.empty()) {
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.82.0-preview.
|
|
13
|
+
<ReactNativeWindowsVersion>0.82.0-preview.3</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>82</ReactNativeWindowsMinor>
|
|
16
16
|
<ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>7d9a26d50288e3829966de2eeaf36cd6bc83f462</ReactNativeWindowsCommitId>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
</Project>
|
|
@@ -24,8 +24,7 @@
|
|
|
24
24
|
4701; <!-- potentially uninitialized local variable used -->
|
|
25
25
|
4703; <!-- potentially uninitialized local pointer variable used -->
|
|
26
26
|
4789; <!-- destination of memory copy too small -->
|
|
27
|
-
4995
|
|
28
|
-
4996 <!-- deprecated function (including std::) -->
|
|
27
|
+
4995 <!-- function marked as pragma deprecated -->
|
|
29
28
|
</SDLMandatoryWarnings>
|
|
30
29
|
|
|
31
30
|
<!-- SDL RECOMMENDED WARNINGS (Strongly recommended to fix) -->
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#include "BaseParagraphProps.h"
|
|
9
|
+
|
|
10
|
+
#include <react/featureflags/ReactNativeFeatureFlags.h>
|
|
11
|
+
#include <react/renderer/attributedstring/conversions.h>
|
|
12
|
+
#include <react/renderer/attributedstring/primitives.h>
|
|
13
|
+
#include <react/renderer/core/propsConversions.h>
|
|
14
|
+
#include <react/renderer/debug/debugStringConvertibleUtils.h>
|
|
15
|
+
|
|
16
|
+
#include <glog/logging.h>
|
|
17
|
+
|
|
18
|
+
namespace facebook::react {
|
|
19
|
+
|
|
20
|
+
BaseParagraphProps::BaseParagraphProps(
|
|
21
|
+
const PropsParserContext& context,
|
|
22
|
+
const BaseParagraphProps& sourceProps,
|
|
23
|
+
const RawProps& rawProps)
|
|
24
|
+
: ViewProps(context, sourceProps, rawProps),
|
|
25
|
+
BaseTextProps(context, sourceProps, rawProps),
|
|
26
|
+
paragraphAttributes(
|
|
27
|
+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
28
|
+
? sourceProps.paragraphAttributes
|
|
29
|
+
: convertRawProp(
|
|
30
|
+
context,
|
|
31
|
+
rawProps,
|
|
32
|
+
sourceProps.paragraphAttributes,
|
|
33
|
+
{})),
|
|
34
|
+
isSelectable(
|
|
35
|
+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
36
|
+
? sourceProps.isSelectable
|
|
37
|
+
: convertRawProp(
|
|
38
|
+
context,
|
|
39
|
+
rawProps,
|
|
40
|
+
"selectable",
|
|
41
|
+
sourceProps.isSelectable,
|
|
42
|
+
false)),
|
|
43
|
+
onTextLayout(
|
|
44
|
+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
45
|
+
? sourceProps.onTextLayout
|
|
46
|
+
: convertRawProp(
|
|
47
|
+
context,
|
|
48
|
+
rawProps,
|
|
49
|
+
"onTextLayout",
|
|
50
|
+
sourceProps.onTextLayout,
|
|
51
|
+
{})),
|
|
52
|
+
// [Windows]
|
|
53
|
+
selectionColor(
|
|
54
|
+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
55
|
+
? sourceProps.selectionColor
|
|
56
|
+
: convertRawProp(
|
|
57
|
+
context,
|
|
58
|
+
rawProps,
|
|
59
|
+
"selectionColor",
|
|
60
|
+
sourceProps.selectionColor,
|
|
61
|
+
{})) {
|
|
62
|
+
/*
|
|
63
|
+
* These props are applied to `View`, therefore they must not be a part of
|
|
64
|
+
* base text attributes.
|
|
65
|
+
*/
|
|
66
|
+
textAttributes.opacity = std::numeric_limits<Float>::quiet_NaN();
|
|
67
|
+
textAttributes.backgroundColor = {};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
void BaseParagraphProps::setProp(
|
|
71
|
+
const PropsParserContext& context,
|
|
72
|
+
RawPropsPropNameHash hash,
|
|
73
|
+
const char* propName,
|
|
74
|
+
const RawValue& value) {
|
|
75
|
+
// All Props structs setProp methods must always, unconditionally,
|
|
76
|
+
// call all super::setProp methods, since multiple structs may
|
|
77
|
+
// reuse the same values.
|
|
78
|
+
ViewProps::setProp(context, hash, propName, value);
|
|
79
|
+
BaseTextProps::setProp(context, hash, propName, value);
|
|
80
|
+
|
|
81
|
+
static auto defaults = BaseParagraphProps{};
|
|
82
|
+
|
|
83
|
+
// ParagraphAttributes has its own switch statement - to keep all
|
|
84
|
+
// of these fields together, and because there are some collisions between
|
|
85
|
+
// propnames parsed here and outside of ParagraphAttributes.
|
|
86
|
+
// This code is also duplicated in AndroidTextInput.
|
|
87
|
+
static auto paDefaults = ParagraphAttributes{};
|
|
88
|
+
switch (hash) {
|
|
89
|
+
REBUILD_FIELD_SWITCH_CASE(
|
|
90
|
+
paDefaults,
|
|
91
|
+
value,
|
|
92
|
+
paragraphAttributes,
|
|
93
|
+
maximumNumberOfLines,
|
|
94
|
+
"numberOfLines");
|
|
95
|
+
REBUILD_FIELD_SWITCH_CASE(
|
|
96
|
+
paDefaults, value, paragraphAttributes, ellipsizeMode, "ellipsizeMode");
|
|
97
|
+
REBUILD_FIELD_SWITCH_CASE(
|
|
98
|
+
paDefaults,
|
|
99
|
+
value,
|
|
100
|
+
paragraphAttributes,
|
|
101
|
+
textBreakStrategy,
|
|
102
|
+
"textBreakStrategy");
|
|
103
|
+
REBUILD_FIELD_SWITCH_CASE(
|
|
104
|
+
paDefaults,
|
|
105
|
+
value,
|
|
106
|
+
paragraphAttributes,
|
|
107
|
+
adjustsFontSizeToFit,
|
|
108
|
+
"adjustsFontSizeToFit");
|
|
109
|
+
REBUILD_FIELD_SWITCH_CASE(
|
|
110
|
+
paDefaults,
|
|
111
|
+
value,
|
|
112
|
+
paragraphAttributes,
|
|
113
|
+
minimumFontScale,
|
|
114
|
+
"minimumFontScale");
|
|
115
|
+
REBUILD_FIELD_SWITCH_CASE(
|
|
116
|
+
paDefaults,
|
|
117
|
+
value,
|
|
118
|
+
paragraphAttributes,
|
|
119
|
+
minimumFontSize,
|
|
120
|
+
"minimumFontSize");
|
|
121
|
+
REBUILD_FIELD_SWITCH_CASE(
|
|
122
|
+
paDefaults,
|
|
123
|
+
value,
|
|
124
|
+
paragraphAttributes,
|
|
125
|
+
maximumFontSize,
|
|
126
|
+
"maximumFontSize");
|
|
127
|
+
REBUILD_FIELD_SWITCH_CASE(
|
|
128
|
+
paDefaults,
|
|
129
|
+
value,
|
|
130
|
+
paragraphAttributes,
|
|
131
|
+
includeFontPadding,
|
|
132
|
+
"includeFontPadding");
|
|
133
|
+
REBUILD_FIELD_SWITCH_CASE(
|
|
134
|
+
paDefaults,
|
|
135
|
+
value,
|
|
136
|
+
paragraphAttributes,
|
|
137
|
+
android_hyphenationFrequency,
|
|
138
|
+
"android_hyphenationFrequency");
|
|
139
|
+
REBUILD_FIELD_SWITCH_CASE(
|
|
140
|
+
paDefaults,
|
|
141
|
+
value,
|
|
142
|
+
paragraphAttributes,
|
|
143
|
+
textAlignVertical,
|
|
144
|
+
"textAlignVertical");
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
switch (hash) {
|
|
148
|
+
RAW_SET_PROP_SWITCH_CASE(isSelectable, "selectable");
|
|
149
|
+
RAW_SET_PROP_SWITCH_CASE_BASIC(onTextLayout);
|
|
150
|
+
// [Windows]
|
|
151
|
+
RAW_SET_PROP_SWITCH_CASE_BASIC(selectionColor);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/*
|
|
155
|
+
* These props are applied to `View`, therefore they must not be a part of
|
|
156
|
+
* base text attributes.
|
|
157
|
+
*/
|
|
158
|
+
textAttributes.opacity = std::numeric_limits<Float>::quiet_NaN();
|
|
159
|
+
textAttributes.backgroundColor = {};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
#pragma mark - DebugStringConvertible
|
|
163
|
+
|
|
164
|
+
#if RN_DEBUG_STRING_CONVERTIBLE
|
|
165
|
+
SharedDebugStringConvertibleList BaseParagraphProps::getDebugProps() const {
|
|
166
|
+
return ViewProps::getDebugProps() + BaseTextProps::getDebugProps() +
|
|
167
|
+
paragraphAttributes.getDebugProps() +
|
|
168
|
+
SharedDebugStringConvertibleList{
|
|
169
|
+
debugStringConvertibleItem("selectable", isSelectable),
|
|
170
|
+
// [Windows]
|
|
171
|
+
debugStringConvertibleItem("selectionColor", selectionColor)};
|
|
172
|
+
}
|
|
173
|
+
#endif
|
|
174
|
+
} // namespace facebook::react
|
package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/BaseParagraphProps.h
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <limits>
|
|
11
|
+
#include <memory>
|
|
12
|
+
// [Windows]
|
|
13
|
+
#include <optional>
|
|
14
|
+
|
|
15
|
+
#include <react/renderer/attributedstring/ParagraphAttributes.h>
|
|
16
|
+
#include <react/renderer/components/text/BaseTextProps.h>
|
|
17
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
18
|
+
#include <react/renderer/core/Props.h>
|
|
19
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
20
|
+
// [Windows]
|
|
21
|
+
#include <react/renderer/graphics/Color.h>
|
|
22
|
+
|
|
23
|
+
namespace facebook::react {
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* Props of <Paragraph> component.
|
|
27
|
+
* Most of the props are directly stored in composed `ParagraphAttributes`
|
|
28
|
+
* object.
|
|
29
|
+
*/
|
|
30
|
+
class BaseParagraphProps : public ViewProps, public BaseTextProps {
|
|
31
|
+
public:
|
|
32
|
+
BaseParagraphProps() = default;
|
|
33
|
+
BaseParagraphProps(
|
|
34
|
+
const PropsParserContext &context,
|
|
35
|
+
const BaseParagraphProps &sourceProps,
|
|
36
|
+
const RawProps &rawProps);
|
|
37
|
+
|
|
38
|
+
void
|
|
39
|
+
setProp(const PropsParserContext &context, RawPropsPropNameHash hash, const char *propName, const RawValue &value);
|
|
40
|
+
|
|
41
|
+
#pragma mark - Props
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
* Contains all prop values that affect visual representation of the
|
|
45
|
+
* paragraph.
|
|
46
|
+
*/
|
|
47
|
+
ParagraphAttributes paragraphAttributes{};
|
|
48
|
+
|
|
49
|
+
/*
|
|
50
|
+
* Defines can the text be selected (and copied) or not.
|
|
51
|
+
*/
|
|
52
|
+
bool isSelectable{};
|
|
53
|
+
|
|
54
|
+
bool onTextLayout{};
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
* Defines the color of the selection highlight.
|
|
58
|
+
* [Windows]
|
|
59
|
+
*/
|
|
60
|
+
std::optional<SharedColor> selectionColor{};
|
|
61
|
+
|
|
62
|
+
#pragma mark - DebugStringConvertible
|
|
63
|
+
|
|
64
|
+
#if RN_DEBUG_STRING_CONVERTIBLE
|
|
65
|
+
SharedDebugStringConvertibleList getDebugProps() const override;
|
|
66
|
+
#endif
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
} // namespace facebook::react
|