mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Make iOS Color default constructor constexpr (#59060)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/59060 `UndefinedColor` in the iOS `HostPlatformColor.h` is a namespace-scope `static const Color` built with a non-`constexpr` `Color()`, so every Objective-C++ file that includes the header runs a static initializer before `main`. Make `Color()` `constexpr` (and zero-initialize `uiColorHashValue_`) so it is constant-initialized instead. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D125189249 fbshipit-source-id: 4a2e13df252da37646073bca69b98cb975cbb019
This commit is contained in:
1 parent
892ea5e45d
commit
a443ea471c
5 files changed
+5
-5
No files matched your search
+1
-1
@@ -26,7 +26,7 @@ struct Color {
|
||||
Color(int32_t color);
|
||||
Color(const DynamicColor &dynamicColor);
|
||||
Color(const ColorComponents &components);
|
||||
Color() : uiColor_(nullptr) {};
|
||||
constexpr Color() : uiColor_(nullptr), uiColorHashValue_(0) {};
|
||||
int32_t getColor() const;
|
||||
std::size_t getUIColorHash() const;
|
||||
|
||||
|
||||
@@ -5325,12 +5325,12 @@ struct facebook::react::Bridging<void> {
|
||||
}
|
||||
|
||||
struct facebook::react::Color {
|
||||
public Color();
|
||||
public Color(const facebook::react::ColorComponents& components);
|
||||
public Color(const facebook::react::DynamicColor& dynamicColor);
|
||||
public Color(int32_t color);
|
||||
public bool operator!=(const facebook::react::Color& other) const;
|
||||
public bool operator==(const facebook::react::Color& other) const;
|
||||
public constexpr Color();
|
||||
public facebook::react::ColorComponents getColorComponents() const;
|
||||
public float getChannel(int channelId) const;
|
||||
public int32_t getColor() const;
|
||||
|
||||
@@ -8155,12 +8155,12 @@ struct facebook::react::CallbackWithId {
|
||||
}
|
||||
|
||||
struct facebook::react::Color {
|
||||
public Color();
|
||||
public Color(const facebook::react::ColorComponents& components);
|
||||
public Color(const facebook::react::DynamicColor& dynamicColor);
|
||||
public Color(int32_t color);
|
||||
public bool operator!=(const facebook::react::Color& other) const;
|
||||
public bool operator==(const facebook::react::Color& other) const;
|
||||
public constexpr Color();
|
||||
public facebook::react::ColorComponents getColorComponents() const;
|
||||
public float getChannel(int channelId) const;
|
||||
public int32_t getColor() const;
|
||||
|
||||
@@ -5310,12 +5310,12 @@ struct facebook::react::Bridging<void> {
|
||||
}
|
||||
|
||||
struct facebook::react::Color {
|
||||
public Color();
|
||||
public Color(const facebook::react::ColorComponents& components);
|
||||
public Color(const facebook::react::DynamicColor& dynamicColor);
|
||||
public Color(int32_t color);
|
||||
public bool operator!=(const facebook::react::Color& other) const;
|
||||
public bool operator==(const facebook::react::Color& other) const;
|
||||
public constexpr Color();
|
||||
public facebook::react::ColorComponents getColorComponents() const;
|
||||
public float getChannel(int channelId) const;
|
||||
public int32_t getColor() const;
|
||||
|
||||
@@ -5318,12 +5318,12 @@ struct facebook::react::Bridging<void> {
|
||||
}
|
||||
|
||||
struct facebook::react::Color {
|
||||
public Color();
|
||||
public Color(const facebook::react::ColorComponents& components);
|
||||
public Color(const facebook::react::DynamicColor& dynamicColor);
|
||||
public Color(int32_t color);
|
||||
public bool operator!=(const facebook::react::Color& other) const;
|
||||
public bool operator==(const facebook::react::Color& other) const;
|
||||
public constexpr Color();
|
||||
public facebook::react::ColorComponents getColorComponents() const;
|
||||
public float getChannel(int channelId) const;
|
||||
public int32_t getColor() const;
|
||||
|
||||
Reference in new issue
Block a user