react-native-windows 0.0.0-canary.577 → 0.0.0-canary.578

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.
@@ -29,7 +29,6 @@ struct INativeUIManagerHost {
29
29
  virtual std::unordered_set<int64_t> &GetAllRootTags() = 0;
30
30
  virtual ShadowNode &GetShadowNodeForTag(int64_t tag) = 0;
31
31
  virtual ShadowNode *FindShadowNodeForTag(int64_t tag) = 0;
32
- virtual ShadowNode *FindParentRootShadowNode(int64_t tag) = 0;
33
32
  };
34
33
 
35
34
  struct INativeUIManager {
@@ -1155,8 +1155,8 @@ void NativeUIManager::blur(int64_t reactTag) {
1155
1155
  // m_tagsToXamlReactControl to get the IXamlReactControl
1156
1156
  winrt::weak_ref<winrt::Microsoft::ReactNative::ReactRootView> NativeUIManager::GetParentXamlReactControl(
1157
1157
  int64_t tag) const {
1158
- if (auto shadowNode = static_cast<ShadowNodeBase *>(m_host->FindParentRootShadowNode(tag))) {
1159
- auto it = m_tagsToXamlReactControl.find(shadowNode->m_tag);
1158
+ if (auto shadowNode = m_host->FindShadowNodeForTag(tag)) {
1159
+ auto it = m_tagsToXamlReactControl.find(shadowNode->m_rootTag);
1160
1160
  if (it != m_tagsToXamlReactControl.end()) {
1161
1161
  return it->second;
1162
1162
  }
@@ -205,20 +205,7 @@ class UIManagerModule : public std::enable_shared_from_this<UIManagerModule>, pu
205
205
  std::function<void(double left, double top, double width, double height, double pageX, double pageY)>
206
206
  &&callback) noexcept {
207
207
  if (auto node = m_nodeRegistry.findNode(reactTag)) {
208
- int64_t rootTag = reactTag;
209
- while (true) {
210
- if (auto currNode = m_nodeRegistry.findNode(rootTag)) {
211
- if (currNode->m_parent == -1) {
212
- break;
213
- }
214
- rootTag = currNode->m_parent;
215
- } else {
216
- callback(0, 0, 0, 0, 0, 0);
217
- return;
218
- }
219
- }
220
- auto &rootNode = m_nodeRegistry.getNode(rootTag);
221
-
208
+ auto &rootNode = m_nodeRegistry.getNode(node->m_rootTag);
222
209
  m_nativeUIManager->measure(*node, rootNode, std::move(callback));
223
210
  }
224
211
  }
@@ -384,10 +371,6 @@ class UIManagerModule : public std::enable_shared_from_this<UIManagerModule>, pu
384
371
  return m_nodeRegistry.findNode(tag);
385
372
  }
386
373
 
387
- ShadowNode *FindParentRootShadowNode(int64_t tag) {
388
- return m_nodeRegistry.getParentRootShadowNode(tag);
389
- }
390
-
391
374
  ShadowNode &GetShadowNodeForTag(int64_t tag) {
392
375
  return m_nodeRegistry.getNode(tag);
393
376
  }
@@ -55,18 +55,6 @@ std::unordered_set<int64_t> &ShadowNodeRegistry::getAllRoots() {
55
55
  return m_roots;
56
56
  }
57
57
 
58
- // iterate its parent to get the root shadow node
59
- ShadowNode *ShadowNodeRegistry::getParentRootShadowNode(int64_t nodeTag) {
60
- auto node = findNode(nodeTag);
61
- while (node) {
62
- if (m_roots.find(node->m_tag) != m_roots.end()) {
63
- return node;
64
- }
65
- node = findNode(node->m_parent);
66
- }
67
- return nullptr;
68
- }
69
-
70
58
  void ShadowNodeRegistry::ForAllNodes(const Mso::FunctorRef<void(int64_t, shadow_ptr const &) noexcept> &fnDo) noexcept {
71
59
  for (auto &kvp : m_allNodes) {
72
60
  fnDo(kvp.first, kvp.second);
@@ -30,8 +30,6 @@ struct ShadowNodeRegistry {
30
30
 
31
31
  std::unordered_set<int64_t> &getAllRoots();
32
32
 
33
- ShadowNode *getParentRootShadowNode(int64_t nodeTag);
34
-
35
33
  void ForAllNodes(const Mso::FunctorRef<void(int64_t, shadow_ptr const &) noexcept> &fnDo) noexcept;
36
34
 
37
35
  private:
@@ -54,13 +54,13 @@ winrt::Microsoft::ReactNative::ReactRootView XamlUIService::GetReactRootView(
54
54
  xaml::FrameworkElement const &view) noexcept {
55
55
  if (auto uiManager = ::Microsoft::ReactNative::GetNativeUIManager(*m_context).lock()) {
56
56
  const auto reactTag = ::Microsoft::ReactNative::GetTag(view);
57
- auto shadowNode = uiManager->getHost()->FindParentRootShadowNode(reactTag);
58
- if (!shadowNode)
59
- return nullptr;
60
-
61
- return static_cast<::Microsoft::ReactNative::ShadowNodeBase *>(shadowNode)
62
- ->GetView()
63
- .as<winrt::Microsoft::ReactNative::ReactRootView>();
57
+ if (auto shadowNode = static_cast<::Microsoft::ReactNative::ShadowNodeBase *>(
58
+ uiManager->getHost()->FindShadowNodeForTag(reactTag))) {
59
+ if (auto rootNode = static_cast<::Microsoft::ReactNative::ShadowNodeBase *>(
60
+ uiManager->getHost()->FindShadowNodeForTag(shadowNode->m_rootTag))) {
61
+ return rootNode->GetView().as<winrt::Microsoft::ReactNative::ReactRootView>();
62
+ }
63
+ }
64
64
  }
65
65
  return nullptr;
66
66
  }
@@ -10,7 +10,7 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.0.0-canary.577</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.0.0-canary.578</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>0</ReactNativeWindowsMinor>
16
16
  <ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.0.0-canary.577",
3
+ "version": "0.0.0-canary.578",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "@react-native-community/cli": "^9.0.0-alpha.11",
27
27
  "@react-native-community/cli-platform-android": "^9.0.0-alpha.10",
28
28
  "@react-native-community/cli-platform-ios": "^9.0.0-alpha.10",
29
- "@react-native-windows/cli": "0.0.0-canary.145",
29
+ "@react-native-windows/cli": "0.0.0-canary.146",
30
30
  "@react-native-windows/virtualized-list": "0.0.0-canary.54",
31
31
  "@react-native/assets": "1.0.0",
32
32
  "@react-native/normalize-color": "2.0.0",