react-native-windows 0.0.0-canary.658 → 0.0.0-canary.660

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.
Files changed (32) hide show
  1. package/.flowconfig +1 -1
  2. package/Directory.Build.props +3 -2
  3. package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
  4. package/Libraries/Components/View/ReactNativeViewAttributes.windows.js +1 -0
  5. package/Libraries/Core/ReactNativeVersion.js +2 -2
  6. package/Libraries/Lists/FlatList.d.ts +2 -1
  7. package/Libraries/Lists/FlatList.js +2 -2
  8. package/Libraries/Lists/SectionList.js +4 -0
  9. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +24 -31
  10. package/Libraries/NativeComponent/BaseViewConfig.android.js +1 -0
  11. package/Libraries/NativeComponent/BaseViewConfig.ios.js +1 -0
  12. package/Libraries/NativeComponent/BaseViewConfig.windows.js +1 -0
  13. package/Libraries/ReactNative/AppRegistry.js +65 -52
  14. package/Libraries/Renderer/shims/ReactFabric.js +4 -4
  15. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +2 -1
  16. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -20
  17. package/Libraries/Utilities/createPerformanceLogger.js +0 -4
  18. package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper_emptyimpl.cpp +46 -0
  19. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView_emptyimpl.cpp +125 -0
  20. package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService_emptyimpl.cpp +18 -0
  21. package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +3 -2
  22. package/Microsoft.ReactNative/Views/ViewPanel.cpp +20 -189
  23. package/Microsoft.ReactNative/Views/ViewPanel.h +0 -22
  24. package/Microsoft.ReactNative/Views/ViewViewManager.cpp +17 -148
  25. package/Microsoft.ReactNative/Views/cppwinrt/ViewPanel.idl +1 -7
  26. package/PropertySheets/Generated/PackageVersion.g.props +2 -2
  27. package/PropertySheets/NuGet.Cpp.props +3 -2
  28. package/ReactCommon/ReactCommon.vcxproj +2 -0
  29. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/ParagraphLayoutManager.cpp +95 -0
  30. package/ReactCommon/Yoga.cpp +29 -21
  31. package/Shared/Shared.vcxitems +25 -10
  32. package/package.json +12 -12
@@ -0,0 +1,125 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ #include "pch.h"
4
+
5
+ #include "CompositionRootView.h"
6
+
7
+ #include "CompositionRootView.g.cpp"
8
+ #include "FocusNavigationRequest.g.cpp"
9
+
10
+ namespace winrt::Microsoft::ReactNative::implementation {
11
+
12
+ //! This class ensures that we access ReactRootView from UI thread.
13
+ struct CompositionReactViewInstance
14
+ : public winrt::implements<CompositionReactViewInstance, winrt::Microsoft::ReactNative::IReactViewInstance> {
15
+ CompositionReactViewInstance(
16
+ winrt::weak_ref<winrt::Microsoft::ReactNative::implementation::CompositionRootView> &&) noexcept {}
17
+
18
+ void InitRootView(
19
+ winrt::Microsoft::ReactNative::IReactContext,
20
+ winrt::Microsoft::ReactNative::ReactViewOptions) noexcept {}
21
+
22
+ void UpdateRootView() noexcept {}
23
+ void UninitRootView() noexcept {}
24
+ };
25
+
26
+ //===========================================================================
27
+ // ReactViewInstance inline implementation
28
+ //===========================================================================
29
+
30
+ CompositionRootView::CompositionRootView() noexcept {}
31
+
32
+ ReactNative::IReactViewHost CompositionRootView::ReactViewHost() noexcept {
33
+ return nullptr;
34
+ }
35
+
36
+ void CompositionRootView::ReactViewHost(winrt::Microsoft::ReactNative::IReactViewHost const &) noexcept {}
37
+
38
+ winrt::Microsoft::ReactNative::Composition::IVisual CompositionRootView::RootVisual() noexcept {
39
+ return nullptr;
40
+ }
41
+
42
+ void CompositionRootView::RootVisual(winrt::Microsoft::ReactNative::Composition::IVisual const &) noexcept {}
43
+
44
+ winrt::Windows::Foundation::Size CompositionRootView::Size() noexcept {
45
+ return {};
46
+ }
47
+
48
+ void CompositionRootView::Size(winrt::Windows::Foundation::Size) noexcept {}
49
+
50
+ double CompositionRootView::ScaleFactor() noexcept {
51
+ return 0;
52
+ }
53
+
54
+ void CompositionRootView::ScaleFactor(double) noexcept {}
55
+
56
+ winrt::IInspectable CompositionRootView::GetUiaProvider() noexcept {
57
+ return nullptr;
58
+ }
59
+
60
+ winrt::Microsoft::ReactNative::Composition::IVisual CompositionRootView::GetVisual() const noexcept {
61
+ return nullptr;
62
+ }
63
+
64
+ std::string CompositionRootView::JSComponentName() const noexcept {
65
+ return {};
66
+ }
67
+
68
+ int64_t CompositionRootView::GetActualHeight() const noexcept {
69
+ return 0;
70
+ }
71
+
72
+ int64_t CompositionRootView::GetActualWidth() const noexcept {
73
+ return 0;
74
+ }
75
+
76
+ int64_t CompositionRootView::GetTag() const noexcept {
77
+ return 0;
78
+ }
79
+
80
+ void CompositionRootView::SetTag(int64_t) noexcept {}
81
+
82
+ int64_t CompositionRootView::SendMessage(uint32_t, uint64_t, int64_t) noexcept {
83
+ return 0;
84
+ }
85
+
86
+ void CompositionRootView::OnScrollWheel(Windows::Foundation::Point, int32_t) noexcept {}
87
+
88
+ void CompositionRootView::InitRootView(
89
+ winrt::Microsoft::ReactNative::IReactContext &&,
90
+ winrt::Microsoft::ReactNative::ReactViewOptions &&) noexcept {}
91
+
92
+ void CompositionRootView::UpdateRootView() noexcept {}
93
+
94
+ void CompositionRootView::UpdateRootViewInternal() noexcept {}
95
+
96
+ void CompositionRootView::UninitRootView() noexcept {}
97
+
98
+ void CompositionRootView::ClearLoadingUI() noexcept {}
99
+
100
+ void CompositionRootView::EnsureLoadingUI() noexcept {}
101
+
102
+ void CompositionRootView::ShowInstanceLoaded() noexcept {}
103
+
104
+ void CompositionRootView::ShowInstanceError() noexcept {}
105
+
106
+ void CompositionRootView::ShowInstanceLoading() noexcept {}
107
+
108
+ Windows::Foundation::Size CompositionRootView::Measure(Windows::Foundation::Size const &) const {
109
+ return {};
110
+ }
111
+
112
+ Windows::Foundation::Size CompositionRootView::Arrange(Windows::Foundation::Size) const {
113
+ return {};
114
+ }
115
+
116
+ ::Microsoft::ReactNative::RootComponentView *CompositionRootView::GetComponentView() noexcept {
117
+ return nullptr;
118
+ }
119
+
120
+ winrt::Microsoft::ReactNative::FocusNavigationResult CompositionRootView::NavigateFocus(
121
+ const winrt::Microsoft::ReactNative::FocusNavigationRequest &) noexcept {
122
+ return nullptr;
123
+ }
124
+
125
+ } // namespace winrt::Microsoft::ReactNative::implementation
@@ -0,0 +1,18 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #include "pch.h"
5
+
6
+ #include "CompositionUIService.h"
7
+
8
+ #include "Composition.CompositionUIService.g.cpp"
9
+
10
+ namespace winrt::Microsoft::ReactNative::Composition::implementation {
11
+
12
+ void CompositionUIService::SetCompositionContext(IReactPropertyBag const &, ICompositionContext const &) noexcept {}
13
+
14
+ ICompositionContext CompositionUIService::GetCompositionContext(const IReactPropertyBag &) noexcept {
15
+ return nullptr;
16
+ }
17
+
18
+ } // namespace winrt::Microsoft::ReactNative::Composition::implementation
@@ -153,9 +153,10 @@ NativeUIManager::NativeUIManager(winrt::Microsoft::ReactNative::ReactContext con
153
153
  m_yogaConfig = YGConfigNew();
154
154
  if (React::implementation::QuirkSettings::GetUseWebFlexBasisBehavior(m_context.Properties()))
155
155
  YGConfigSetExperimentalFeatureEnabled(m_yogaConfig, YGExperimentalFeatureWebFlexBasis, true);
156
+ auto errata = YGErrataAll;
156
157
  if (React::implementation::QuirkSettings::GetMatchAndroidAndIOSStretchBehavior(m_context.Properties()))
157
- YGConfigSetErrata(m_yogaConfig, YGErrataStretchFlexBasis);
158
-
158
+ errata &= ~YGErrataStretchFlexBasis;
159
+ YGConfigSetErrata(m_yogaConfig, errata);
159
160
  #if defined(_DEBUG)
160
161
  YGConfigSetLogger(m_yogaConfig, &YogaLog);
161
162
 
@@ -51,43 +51,19 @@ winrt::AutomationPeer ViewPanel::OnCreateAutomationPeer() {
51
51
  }
52
52
 
53
53
  /*static*/ xaml::DependencyProperty ViewPanel::ViewBackgroundProperty() {
54
- static xaml::DependencyProperty s_viewBackgroundProperty = xaml::DependencyProperty::Register(
55
- L"ViewBackground",
56
- winrt::xaml_typename<winrt::Brush>(),
57
- viewPanelTypeName,
58
- winrt::PropertyMetadata(xaml::Media::SolidColorBrush(), ViewPanel::VisualPropertyChanged));
59
-
60
- return s_viewBackgroundProperty;
54
+ return xaml::Controls::Panel::BackgroundProperty();
61
55
  }
62
56
 
63
57
  /*static*/ xaml::DependencyProperty ViewPanel::BorderThicknessProperty() {
64
- static xaml::DependencyProperty s_borderThicknessProperty = xaml::DependencyProperty::Register(
65
- L"BorderThickness",
66
- winrt::xaml_typename<winrt::Thickness>(),
67
- viewPanelTypeName,
68
- winrt::PropertyMetadata(winrt::box_value(winrt::Thickness()), ViewPanel::VisualPropertyChanged));
69
-
70
- return s_borderThicknessProperty;
58
+ return xaml::Controls::Grid::BorderThicknessProperty();
71
59
  }
72
60
 
73
61
  /*static*/ xaml::DependencyProperty ViewPanel::BorderBrushProperty() {
74
- static xaml::DependencyProperty s_borderBrushProperty = xaml::DependencyProperty::Register(
75
- L"BorderBrush",
76
- winrt::xaml_typename<winrt::Brush>(),
77
- viewPanelTypeName,
78
- winrt::PropertyMetadata(xaml::Media::SolidColorBrush(), ViewPanel::VisualPropertyChanged));
79
-
80
- return s_borderBrushProperty;
62
+ return xaml::Controls::Grid::BorderBrushProperty();
81
63
  }
82
64
 
83
65
  /*static*/ xaml::DependencyProperty ViewPanel::CornerRadiusProperty() {
84
- static xaml::DependencyProperty s_cornerRadiusProperty = xaml::DependencyProperty::Register(
85
- L"CornerRadius",
86
- winrt::xaml_typename<xaml::CornerRadius>(),
87
- viewPanelTypeName,
88
- winrt::PropertyMetadata(winrt::box_value(xaml::CornerRadius()), ViewPanel::VisualPropertyChanged));
89
-
90
- return s_cornerRadiusProperty;
66
+ return xaml::Controls::Grid::CornerRadiusProperty();
91
67
  }
92
68
 
93
69
  /*static*/ xaml::DependencyProperty ViewPanel::TopProperty() {
@@ -131,48 +107,32 @@ winrt::Size ViewPanel::MeasureOverride(winrt::Size /*availableSize*/) {
131
107
  }
132
108
 
133
109
  winrt::Size ViewPanel::ArrangeOverride(winrt::Size finalSize) {
134
- // Sometimes we create outerBorder(i.e. when CornerRadius is true) instead of innerBorder,
135
- // Yoga has no notion of outerBorder when calculating the child's position, so we
136
- // need to make adjustment in arrange for outerborder's thickness.
137
- float outerBorderLeft = 0;
138
- float outerBorderTop = 0;
139
- if (auto outerBorder = GetOuterBorder()) {
140
- auto borderThickness = outerBorder.BorderThickness();
141
- outerBorderLeft = static_cast<float>(borderThickness.Left);
142
- outerBorderTop = static_cast<float>(borderThickness.Top);
143
- }
144
110
  for (xaml::UIElement child : Children()) {
145
111
  double childHeight = 0.0;
146
112
  double childWidth = 0.0;
147
113
 
148
- // A Border or inner ViewPanel should take up the same space as this panel
149
- if (child == m_border) {
150
- childWidth = finalSize.Width;
151
- childHeight = finalSize.Height;
152
- } else {
153
- // We expect elements to have been arranged by yoga which means their
154
- // Width & Height are set
155
- xaml::FrameworkElement fe = child.try_as<xaml::FrameworkElement>();
156
- if (fe != nullptr) {
157
- childWidth = fe.Width();
158
- childHeight = fe.Height();
159
- }
160
- // But we fall back to the measured size otherwise
161
- else {
162
- childWidth = child.DesiredSize().Width;
163
- childHeight = child.DesiredSize().Height;
164
- }
114
+ // We expect elements to have been arranged by yoga which means their
115
+ // Width & Height are set
116
+ xaml::FrameworkElement fe = child.try_as<xaml::FrameworkElement>();
117
+ if (fe != nullptr) {
118
+ childWidth = fe.Width();
119
+ childHeight = fe.Height();
120
+ }
121
+ // But we fall back to the measured size otherwise
122
+ else {
123
+ childWidth = child.DesiredSize().Width;
124
+ childHeight = child.DesiredSize().Height;
165
125
  }
166
126
 
167
127
  // Guard against negative values
168
128
  childWidth = std::max<double>(0.0f, childWidth);
169
129
  childHeight = std::max<double>(0.0f, childHeight);
170
130
 
171
- float adjustedLeft = static_cast<float>(ViewPanel::GetLeft(child)) - outerBorderLeft;
172
- float adjustedTop = static_cast<float>(ViewPanel::GetTop(child)) - outerBorderTop;
173
-
174
- child.Arrange(
175
- winrt::Rect(adjustedLeft, adjustedTop, static_cast<float>(childWidth), static_cast<float>(childHeight)));
131
+ child.Arrange(winrt::Rect(
132
+ static_cast<float>(ViewPanel::GetLeft(child)),
133
+ static_cast<float>(ViewPanel::GetTop(child)),
134
+ static_cast<float>(childWidth),
135
+ static_cast<float>(childHeight)));
176
136
  }
177
137
 
178
138
  return finalSize;
@@ -201,133 +161,4 @@ void ViewPanel::ViewBackground(winrt::Brush const &value) {
201
161
  SetValue(ViewBackgroundProperty(), winrt::box_value(value));
202
162
  }
203
163
 
204
- void ViewPanel::BorderThickness(winrt::Thickness const &value) {
205
- SetValue(BorderThicknessProperty(), winrt::box_value(value));
206
- }
207
-
208
- void ViewPanel::BorderBrush(winrt::Brush const &value) {
209
- SetValue(BorderBrushProperty(), winrt::box_value(value));
210
- }
211
-
212
- void ViewPanel::CornerRadius(xaml::CornerRadius const &value) {
213
- SetValue(CornerRadiusProperty(), winrt::box_value(value));
214
- }
215
-
216
- void ViewPanel::FinalizeProperties() {
217
- SystraceSection s("ViewPanel::FinalizeProperties");
218
- if (!m_propertiesChanged)
219
- return;
220
-
221
- // There are 3 different solutions
222
- //
223
- // A) No Border
224
- // -- No need for any border properties so just contain real children
225
- // >> Background applied to ViewPanel
226
- //
227
- // B) Inner Border (child of this panel along with real children)
228
- // -- Border created and made a child of this panel, alongside standard
229
- // children
230
- // >> Border* properties applied to Border, Background applied to
231
- // ViewPanel
232
- //
233
- // C) Outer Border
234
- // -- Border created but handed out to view manager to make parent of
235
- // this ViewPanel
236
- // >> Border* properties and Background applied to Border
237
-
238
- const auto unsetValue = xaml::DependencyProperty::UnsetValue();
239
- const Thickness emptyThickness = ThicknessHelper::FromUniformLength(0.0);
240
-
241
- bool hasBackground = ReadLocalValue(ViewBackgroundProperty()) != unsetValue;
242
- bool hasBorderBrush = ReadLocalValue(BorderBrushProperty()) != unsetValue;
243
- bool hasBorderThickness = BorderThickness() != emptyThickness;
244
- bool hasCornerRadius = ReadLocalValue(CornerRadiusProperty()) != unsetValue;
245
- bool displayBorder = hasBorderThickness;
246
-
247
- // Determine which scenario our current properties have put us into
248
- enum class Scenario { OuterBorder, InnerBorder, NoBorder } scenario;
249
- if (hasCornerRadius) {
250
- scenario = Scenario::OuterBorder;
251
- m_hasOuterBorder = true;
252
- } else if (!displayBorder) {
253
- scenario = Scenario::NoBorder;
254
- m_hasOuterBorder = false;
255
- } else {
256
- scenario = Scenario::InnerBorder;
257
- m_hasOuterBorder = false;
258
- }
259
-
260
- // Detach this Panel from the outer Border if needed
261
- if (scenario != Scenario::OuterBorder && m_border != nullptr) {
262
- m_border.Child(nullptr);
263
- }
264
-
265
- // Border element
266
- if (scenario != Scenario::NoBorder) {
267
- // Ensure Border is created
268
- if (m_border == nullptr) {
269
- m_border = xaml::Controls::Border();
270
-
271
- // Add border as the top child if using as inner border
272
- if (scenario == Scenario::InnerBorder)
273
- Children().Append(m_border);
274
- }
275
-
276
- // TODO: Can Binding be used here?
277
- if (hasBorderBrush)
278
- m_border.BorderBrush(BorderBrush());
279
- else if (!hasBorderThickness) {
280
- m_border.ClearValue(xaml::Controls::Border::BorderBrushProperty());
281
- }
282
-
283
- if (hasBorderThickness) {
284
- m_border.BorderThickness(BorderThickness());
285
- if (!hasBorderBrush) {
286
- // Borders with no brush draw something other than transparent on other platforms.
287
- // To match, we'll use a default border brush if one isn't already set.
288
- // Note: Keep this in sync with code in TryUpdateBorderProperties().
289
- m_border.BorderBrush(::Microsoft::ReactNative::DefaultBrushStore::Instance().GetDefaultBorderBrush());
290
- }
291
- } else
292
- m_border.ClearValue(xaml::Controls::Border::BorderThicknessProperty());
293
-
294
- if (hasCornerRadius)
295
- m_border.CornerRadius(CornerRadius());
296
- else
297
- m_border.ClearValue(xaml::Controls::Border::CornerRadiusProperty());
298
- } else if (m_border != nullptr) {
299
- // Clean up and remove the Border element
300
- m_border.Child(nullptr);
301
- Remove(m_border);
302
- m_border = nullptr;
303
- }
304
-
305
- if (scenario == Scenario::OuterBorder) {
306
- if (hasBackground)
307
- m_border.Background(ViewBackground());
308
- else
309
- m_border.ClearValue(xaml::Controls::Border::BackgroundProperty());
310
-
311
- ClearValue(winrt::Panel::BackgroundProperty());
312
-
313
- // Ensure the Border is not parented to this Panel
314
- Remove(m_border);
315
- } else {
316
- // Set any background on this Panel
317
- if (hasBackground)
318
- SetValue(winrt::Panel::BackgroundProperty(), ViewBackground());
319
- else
320
- ClearValue(winrt::Panel::BackgroundProperty());
321
- }
322
-
323
- m_propertiesChanged = false;
324
- }
325
-
326
- xaml::Controls::Border ViewPanel::GetOuterBorder() {
327
- if (m_hasOuterBorder && (m_border != nullptr))
328
- return m_border;
329
- else
330
- return xaml::Controls::Border(nullptr);
331
- }
332
-
333
164
  } // namespace winrt::Microsoft::ReactNative::implementation
@@ -28,30 +28,12 @@ struct ViewPanel : ViewPanelT<ViewPanel> {
28
28
  void RemoveAt(uint32_t const index) const;
29
29
  void Clear() const;
30
30
 
31
- void FinalizeProperties();
32
- xaml::Controls::Border GetOuterBorder();
33
-
34
31
  // Public Properties
35
32
  xaml::Media::Brush ViewBackground() {
36
33
  return GetValue(ViewBackgroundProperty()).as<xaml::Media::Brush>();
37
34
  }
38
35
  void ViewBackground(xaml::Media::Brush const &value);
39
36
 
40
- xaml::Thickness BorderThickness() {
41
- return winrt::unbox_value<xaml::Thickness>(GetValue(BorderThicknessProperty()));
42
- }
43
- void BorderThickness(xaml::Thickness const &value);
44
-
45
- xaml::Media::Brush BorderBrush() {
46
- return GetValue(BorderBrushProperty()).as<xaml::Media::Brush>();
47
- }
48
- void BorderBrush(xaml::Media::Brush const &value);
49
-
50
- xaml::CornerRadius CornerRadius() {
51
- return winrt::unbox_value<xaml::CornerRadius>(GetValue(CornerRadiusProperty()));
52
- }
53
- void CornerRadius(xaml::CornerRadius const &value);
54
-
55
37
  // ViewPanel Properties
56
38
  static xaml::DependencyProperty ViewBackgroundProperty();
57
39
  static xaml::DependencyProperty BorderThicknessProperty();
@@ -79,10 +61,6 @@ struct ViewPanel : ViewPanelT<ViewPanel> {
79
61
  private:
80
62
  bool m_propertiesChanged{false};
81
63
 
82
- // Child Elements
83
- xaml::Controls::Border m_border{nullptr};
84
- bool m_hasOuterBorder{false};
85
-
86
64
  private:
87
65
  static void VisualPropertyChanged(xaml::DependencyObject sender, xaml::DependencyPropertyChangedEventArgs e);
88
66
  };