react-native-windows 0.70.10 → 0.70.12

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.
@@ -67,7 +67,7 @@
67
67
 
68
68
  <PropertyGroup Label="NuGet" Condition="'$(MSBuildProjectExtension)' == '.vcxproj'">
69
69
  <!--See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target-->
70
- <RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</RestoreUseStaticGraphEvaluation>
70
+ <RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(DisableRestoreUseStaticGraphEvaluation)' != 'true'">true</RestoreUseStaticGraphEvaluation>
71
71
  </PropertyGroup>
72
72
 
73
73
  </Project>
@@ -82,16 +82,14 @@ bool ControlViewManager::UpdateProperty(
82
82
  }
83
83
  } else if (propertyName == "focusable") {
84
84
  if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Boolean) {
85
- IsFocusable(propertyValue.AsBoolean());
86
- control.IsTabStop(propertyValue.AsBoolean());
85
+ nodeToUpdate->IsFocusable(propertyValue.AsBoolean());
87
86
  } else if (propertyValue.IsNull()) {
88
- control.ClearValue(TAB_STOP_PROPERTY());
89
- IsFocusable(false);
87
+ nodeToUpdate->IsFocusable(false);
90
88
  }
91
89
  } else {
92
90
  if (propertyName == "accessible") {
93
91
  if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Boolean) {
94
- IsAccessible(propertyValue.AsBoolean());
92
+ nodeToUpdate->IsAccessible(propertyValue.AsBoolean());
95
93
  }
96
94
  }
97
95
  ret = Super::UpdateProperty(nodeToUpdate, propertyName, propertyValue);
@@ -108,11 +106,13 @@ bool ControlViewManager::UpdateProperty(
108
106
  void ControlViewManager::OnPropertiesUpdated(ShadowNodeBase *node) {
109
107
  auto control(node->GetView().as<xaml::Controls::Control>());
110
108
 
111
- if (IsAccessible() != IsFocusable()) {
112
- control.IsTabStop(false);
113
- xaml::Automation::AutomationProperties::SetAccessibilityView(
114
- control, xaml::Automation::Peers::AccessibilityView::Raw);
115
- }
109
+ // If developer specifies either the accessible and focusable prop to be false
110
+ // remove accessibility and keyboard focus for component.
111
+ const auto isTabStop = (node->IsAccessible() && node->IsFocusable());
112
+ const auto accessibilityView =
113
+ isTabStop ? xaml::Automation::Peers::AccessibilityView::Content : xaml::Automation::Peers::AccessibilityView::Raw;
114
+ control.IsTabStop(isTabStop);
115
+ xaml::Automation::AutomationProperties::SetAccessibilityView(control, accessibilityView);
116
116
  }
117
117
 
118
118
  void ControlViewManager::OnViewCreated(XamlView view) {
@@ -123,17 +123,4 @@ void ControlViewManager::OnViewCreated(XamlView view) {
123
123
  }
124
124
  }
125
125
 
126
- void ControlViewManager::IsAccessible(bool accessible) {
127
- m_isAccessible = accessible;
128
- }
129
- bool ControlViewManager::IsAccessible() {
130
- return m_isAccessible;
131
- }
132
- void ControlViewManager::IsFocusable(bool focusable) {
133
- m_isFocusable = focusable;
134
- }
135
- bool ControlViewManager::IsFocusable() {
136
- return m_isFocusable;
137
- }
138
-
139
126
  } // namespace Microsoft::ReactNative
@@ -26,15 +26,6 @@ class REACTWINDOWS_EXPORT ControlViewManager : public FrameworkElementViewManage
26
26
  void OnViewCreated(XamlView view) override;
27
27
 
28
28
  void OnPropertiesUpdated(ShadowNodeBase *node) override;
29
-
30
- private:
31
- void IsAccessible(bool accessible);
32
- bool IsAccessible();
33
- void IsFocusable(bool focusable);
34
- bool IsFocusable();
35
-
36
- bool m_isAccessible = true;
37
- bool m_isFocusable = true;
38
29
  };
39
30
 
40
31
  } // namespace Microsoft::ReactNative
@@ -166,4 +166,17 @@ void ShadowNodeBase::RedBox(const std::string &message) const noexcept {
166
166
  GetViewManager()->GetReactContext().CallJSFunction("RCTLog", "logToConsole", folly::dynamic::array("error", message));
167
167
  }
168
168
 
169
+ void ShadowNodeBase::IsAccessible(bool accessible) {
170
+ m_isAccessible = accessible;
171
+ }
172
+ bool ShadowNodeBase::IsAccessible() {
173
+ return m_isAccessible;
174
+ }
175
+ void ShadowNodeBase::IsFocusable(bool focusable) {
176
+ m_isFocusable = focusable;
177
+ }
178
+ bool ShadowNodeBase::IsFocusable() {
179
+ return m_isFocusable;
180
+ }
181
+
169
182
  } // namespace Microsoft::ReactNative
@@ -115,9 +115,16 @@ struct REACTWINDOWS_EXPORT ShadowNodeBase : public ShadowNode {
115
115
  return m_onMouseEnterRegistered || m_onMouseLeaveRegistered;
116
116
  }
117
117
 
118
+ void IsAccessible(bool accessible);
119
+ bool IsAccessible();
120
+ void IsFocusable(bool focusable);
121
+ bool IsFocusable();
122
+
118
123
  protected:
119
124
  XamlView m_view;
120
125
  bool m_updating = false;
126
+ bool m_isFocusable = true;
127
+ bool m_isAccessible = true;
121
128
  comp::CompositionPropertySet m_transformPS{nullptr};
122
129
 
123
130
  public:
@@ -47,6 +47,8 @@ class ViewShadowNode : public ShadowNodeBase {
47
47
  Super::createView(props);
48
48
 
49
49
  auto panel = GetViewPanel();
50
+ IsAccessible(false);
51
+ IsFocusable(false);
50
52
 
51
53
  DynamicAutomationProperties::SetAccessibilityInvokeEventHandler(panel, [=]() {
52
54
  if (OnClick())
@@ -121,24 +123,6 @@ class ViewShadowNode : public ShadowNodeBase {
121
123
  m_onClick = isSet;
122
124
  }
123
125
 
124
- bool IsFocusable() const {
125
- return m_isFocusable;
126
- }
127
- void IsFocusable(bool isFocusable) {
128
- m_isFocusable = isFocusable;
129
-
130
- if (IsControl())
131
- GetControl().IsTabStop(m_isFocusable);
132
- }
133
-
134
- bool IsAccessible() const {
135
- return m_isAccessible;
136
- }
137
-
138
- void IsAccessible(bool isAccessible) {
139
- m_isAccessible = isAccessible;
140
- }
141
-
142
126
  bool IsHitTestBrushRequired() const {
143
127
  return IsRegisteredForMouseEvents();
144
128
  }
@@ -262,8 +246,6 @@ class ViewShadowNode : public ShadowNodeBase {
262
246
 
263
247
  bool m_enableFocusRing = true;
264
248
  bool m_onClick = false;
265
- bool m_isFocusable = false;
266
- bool m_isAccessible = false;
267
249
  int32_t m_tabIndex = std::numeric_limits<std::int32_t>::max();
268
250
 
269
251
  xaml::Controls::ContentControl::GotFocus_revoker m_contentControlGotFocusRevoker{};
@@ -411,20 +393,16 @@ bool ViewViewManager::UpdateProperty(
411
393
  UpdateCornerRadiusOnElement(nodeToUpdate, pPanel);
412
394
  } else if (TryUpdateMouseEvents(nodeToUpdate, propertyName, propertyValue)) {
413
395
  } else if (propertyName == "onClick") {
414
- pViewShadowNode->OnClick(!propertyValue.IsNull() && propertyValue.AsBoolean());
396
+ pViewShadowNode->OnClick(propertyValue.AsBoolean());
415
397
  } else if (propertyName == "overflow") {
416
398
  if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::String) {
417
399
  bool clipChildren = propertyValue.AsString() == "hidden";
418
400
  pPanel.ClipChildren(clipChildren);
419
401
  }
420
402
  } else if (propertyName == "focusable") {
421
- if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Boolean)
422
- pViewShadowNode->IsFocusable(propertyValue.AsBoolean());
403
+ pViewShadowNode->IsFocusable(propertyValue.AsBoolean());
423
404
  } else if (propertyName == "enableFocusRing") {
424
- if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Boolean)
425
- pViewShadowNode->EnableFocusRing(propertyValue.AsBoolean());
426
- else if (propertyValue.IsNull())
427
- pViewShadowNode->EnableFocusRing(false);
405
+ pViewShadowNode->EnableFocusRing(propertyValue.AsBoolean());
428
406
  } else if (propertyName == "tabIndex") {
429
407
  auto tabIndex = propertyValue.AsInt64();
430
408
  if (tabIndex == static_cast<int32_t>(tabIndex)) {
@@ -434,9 +412,7 @@ bool ViewViewManager::UpdateProperty(
434
412
  }
435
413
  } else {
436
414
  if (propertyName == "accessible") {
437
- if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Boolean) {
438
- pViewShadowNode->IsAccessible(propertyValue.AsBoolean());
439
- }
415
+ pViewShadowNode->IsAccessible(propertyValue.AsBoolean());
440
416
  }
441
417
  ret = Super::UpdateProperty(nodeToUpdate, propertyName, propertyValue);
442
418
  }
@@ -461,7 +437,10 @@ void ViewViewManager::OnPropertiesUpdated(ShadowNodeBase *node) {
461
437
  // keep it around, so not adding that code (yet).
462
438
  }
463
439
 
464
- bool shouldBeControl = viewShadowNode->IsFocusable();
440
+ // If component is focusable, it should be a ViewControl.
441
+ // If component is a View with accessible set to true, the component should be focusable, thus we need a ViewControl.
442
+ bool shouldBeControl =
443
+ (viewShadowNode->IsFocusable() || (viewShadowNode->IsAccessible() && !viewShadowNode->OnClick()));
465
444
  if (auto view = viewShadowNode->GetView().try_as<xaml::UIElement>()) {
466
445
  // If we have DynamicAutomationProperties, we need a ViewControl with a
467
446
  // DynamicAutomationPeer
@@ -471,6 +450,7 @@ void ViewViewManager::OnPropertiesUpdated(ShadowNodeBase *node) {
471
450
  panel.FinalizeProperties();
472
451
 
473
452
  TryUpdateView(viewShadowNode, panel, shouldBeControl);
453
+ SyncFocusableAndAccessible(viewShadowNode, shouldBeControl);
474
454
  }
475
455
 
476
456
  void ViewViewManager::TryUpdateView(
@@ -583,11 +563,23 @@ void ViewViewManager::TryUpdateView(
583
563
 
584
564
  if (useControl)
585
565
  pViewShadowNode->GetControl().Content(visualRoot);
566
+ }
586
567
 
587
- if (useControl && pViewShadowNode->IsAccessible() != pViewShadowNode->IsFocusable()) {
588
- pViewShadowNode->GetControl().IsTabStop(false);
589
- xaml::Automation::AutomationProperties::SetAccessibilityView(
590
- pViewShadowNode->GetControl(), xaml::Automation::Peers::AccessibilityView::Raw);
568
+ void ViewViewManager::SyncFocusableAndAccessible(ViewShadowNode *pViewShadowNode, bool useControl) {
569
+ // If developer specifies either the accessible and focusable prop to be false
570
+ // remove accessibility and keyboard focus for component. Exception is made
571
+ // for case where a View with undefined onPress is specified, where
572
+ // component gains accessibility focus when either the accessible and focusable prop are true.
573
+ if (useControl) {
574
+ const auto isFocusable = pViewShadowNode->IsFocusable();
575
+ const auto isAccessible = pViewShadowNode->IsAccessible();
576
+ const auto isPressable = pViewShadowNode->OnClick();
577
+ const auto isTabStop =
578
+ (isPressable && isFocusable && isAccessible) || (!isPressable && (isFocusable || isAccessible));
579
+ const auto accessibilityView = isTabStop ? xaml::Automation::Peers::AccessibilityView::Content
580
+ : xaml::Automation::Peers::AccessibilityView::Raw;
581
+ pViewShadowNode->GetControl().IsTabStop(isTabStop);
582
+ xaml::Automation::AutomationProperties::SetAccessibilityView(pViewShadowNode->GetControl(), accessibilityView);
591
583
  }
592
584
  }
593
585
 
@@ -41,6 +41,7 @@ class ViewViewManager : public FrameworkElementViewManager {
41
41
 
42
42
  XamlView CreateViewCore(int64_t tag, const winrt::Microsoft::ReactNative::JSValueObject &) override;
43
43
  void TryUpdateView(ViewShadowNode *viewShadowNode, winrt::Microsoft::ReactNative::ViewPanel &pPanel, bool useControl);
44
+ void SyncFocusableAndAccessible(ViewShadowNode *viewShadowNode, bool useControl);
44
45
 
45
46
  xaml::Media::SolidColorBrush EnsureTransparentBrush();
46
47
 
@@ -10,10 +10,10 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.70.10</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.70.12</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>70</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>10</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>12</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
18
  </PropertyGroup>
19
19
  </Project>
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
- <!--
2
+ <!--
3
3
  Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  Licensed under the MIT License.
5
5
 
@@ -10,7 +10,7 @@
10
10
  <PropertyGroup Label="NuGet">
11
11
  <!-- Should match entry in $(ReactNativeWindowsDir)vnext\Directory.Build.props -->
12
12
  <!--See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target-->
13
- <RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</RestoreUseStaticGraphEvaluation>
13
+ <RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(DisableRestoreUseStaticGraphEvaluation)' != 'true'">true</RestoreUseStaticGraphEvaluation>
14
14
 
15
15
  <!-- Ensure PackageReference compatibility for any consuming projects/apps -->
16
16
  <ResolveNuGetPackages>false</ResolveNuGetPackages>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.70.10",
3
+ "version": "0.70.12",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,8 +26,8 @@
26
26
  "@react-native-community/cli": "^9.0.0",
27
27
  "@react-native-community/cli-platform-android": "^9.0.0",
28
28
  "@react-native-community/cli-platform-ios": "^9.0.0",
29
- "@react-native-windows/cli": "0.70.2",
30
- "@react-native-windows/virtualized-list": "0.70.0",
29
+ "@react-native-windows/cli": "0.70.3",
30
+ "@react-native-windows/virtualized-list": "0.70.1",
31
31
  "@react-native/assets": "1.0.0",
32
32
  "@react-native/normalize-color": "2.0.0",
33
33
  "@react-native/polyfills": "2.0.0",
@@ -59,7 +59,7 @@
59
59
  "ws": "^6.1.4"
60
60
  },
61
61
  "devDependencies": {
62
- "@react-native-windows/codegen": "0.70.0",
62
+ "@react-native-windows/codegen": "0.70.1",
63
63
  "@rnw-scripts/eslint-config": "1.1.13",
64
64
  "@rnw-scripts/jest-out-of-tree-snapshot-resolver": "^1.0.7",
65
65
  "@rnw-scripts/just-task": "2.2.5",
@@ -87,7 +87,7 @@
87
87
  "react-native": "^0.70.0"
88
88
  },
89
89
  "beachball": {
90
- "defaultNpmTag": "latest",
90
+ "defaultNpmTag": "v0.70-stable",
91
91
  "disallowedChangeTypes": [
92
92
  "major",
93
93
  "minor",