-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ReactRootViewTagGenerator (#43882)
Summary: Pull Request resolved: #43882 Changelog: [Added] Add ReactRootViewTagGenerator This copies over a modified version of the [react-native-windows](https://github.com/microsoft/react-native-windows/blob/main/vnext/Microsoft.ReactNative/Modules/ReactRootViewTagGenerator.h) implementation so it can be shared with other C based platforms This also updates the outdated comment about the non existing ReactIOSTagHandles JS module. Differential Revision: D55772580
- Loading branch information
1 parent
fd3ef7b
commit 49da52e
Showing
4 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/react-native/ReactCommon/react/renderer/core/ReactRootViewTagGenerator.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#include "ReactRootViewTagGenerator.h" | ||
|
||
#include <atomic> | ||
|
||
namespace facebook::react { | ||
|
||
constexpr SurfaceId ROOT_VIEW_TAG_INCREMENT = 10; | ||
|
||
SurfaceId getNextRootViewTag() noexcept { | ||
// Numbering of these tags goes from 11, 21, 31, ..., 100501, ... | ||
static std::atomic<SurfaceId> nextRootViewTag = 1; | ||
return nextRootViewTag += ROOT_VIEW_TAG_INCREMENT; | ||
} | ||
|
||
} // namespace facebook::react |
16 changes: 16 additions & 0 deletions
16
packages/react-native/ReactCommon/react/renderer/core/ReactRootViewTagGenerator.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <react/renderer/core/ReactPrimitives.h> | ||
|
||
namespace facebook::react { | ||
|
||
SurfaceId getNextRootViewTag() noexcept; | ||
|
||
} // namespace facebook::react |