mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Expose "unreserved" trait constants that can be mapped per-component
Summary: Fabric core uses a lot of traits - I am reserving a few more for core usage, and also exposing a few "unreserved" traits. It is recommended that all custom components that do use traits rely on these constants instead of hard-coding any trait values. That way, in the unlikely event that these values change in the future, it will not break components. Changelog: [Internal] Reviewed By: cortinico, RSNara Differential Revision: D30401743 fbshipit-source-id: fb2e8f5cf33c94e31a0c25a89055acfc4eccf066
This commit is contained in:
committed by
Facebook GitHub Bot
parent
22f81b203f
commit
4804e68238
@@ -240,5 +240,9 @@ ShadowNodeReferenceT traitCast(ShadowNode const &shadowNode);
|
||||
template <typename ShadowNodePointerT>
|
||||
ShadowNodePointerT traitCast(ShadowNode const *shadowNode);
|
||||
|
||||
template <typename ShadowNodePointerT>
|
||||
std::shared_ptr<ShadowNodePointerT const> traitCast(
|
||||
std::shared_ptr<ShadowNode const> shadowNode);
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
|
||||
@@ -21,7 +21,7 @@ class ShadowNodeTraits {
|
||||
public:
|
||||
/*
|
||||
* Underlying type for the traits.
|
||||
* The first 18 bits are reserved for Core.
|
||||
* The first 23 bits are reserved for Core.
|
||||
*/
|
||||
enum Trait : int32_t {
|
||||
None = 0,
|
||||
@@ -88,6 +88,16 @@ class ShadowNodeTraits {
|
||||
|
||||
// Inherits 'TextShadowNode'
|
||||
Text = 1 << 17,
|
||||
|
||||
// Reserved
|
||||
ReservedTrait1 = 1 << 18,
|
||||
ReservedTrait2 = 1 << 19,
|
||||
ReservedTrait3 = 1 << 20,
|
||||
ReservedTrait4 = 1 << 21,
|
||||
ReservedTrait5 = 1 << 22,
|
||||
|
||||
// Unserved - alias these for local usage
|
||||
UnreservedTrait1 = 1 << 23
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user