Fabric: Unification of ShadowView's default constructor

Summary:
The previous version of a set of default values of `ShadowView`'s fields has a bug:
```
  ComponentName componentName = "";
```

Initalizing `char const *` with a string literal in .h file makes the default constructor of the object produces different values across binary units (because a pointer to empty string can be defined differently). Now it's just a null pointer.

Reviewed By: sammy-SC

Differential Revision: D15911452

fbshipit-source-id: 16bcfb5f78ea802c0833135c486e3fbb8b7acaa6
This commit is contained in:
Valentin Shergin 2019-06-23 21:30:00 -07:00 коммит произвёл Facebook Github Bot
Родитель bca4e4c8a4
Коммит 27b672993d
1 изменённых файлов: 13 добавлений и 15 удалений

Просмотреть файл

@ -22,30 +22,28 @@ namespace react {
*/
struct ShadowView final {
ShadowView() = default;
ShadowView(const ShadowView &shadowView) = default;
ShadowView(ShadowView const &shadowView) = default;
ShadowView(ShadowView &&shadowView) noexcept = default;
~ShadowView(){};
/*
* Constructs a `ShadowView` from given `ShadowNode`.
*/
explicit ShadowView(const ShadowNode &shadowNode);
explicit ShadowView(ShadowNode const &shadowNode);
ShadowView &operator=(const ShadowView &other) = default;
ShadowView &operator=(ShadowView const &other) = default;
ShadowView &operator=(ShadowView &&other) = default;
bool operator==(const ShadowView &rhs) const;
bool operator!=(const ShadowView &rhs) const;
bool operator==(ShadowView const &rhs) const;
bool operator!=(ShadowView const &rhs) const;
ComponentName componentName = "";
ComponentHandle componentHandle = 0;
Tag tag = -1; // Tag does not change during the lifetime of a shadow view.
SharedProps props = {};
SharedEventEmitter eventEmitter = {};
LayoutMetrics layoutMetrics = EmptyLayoutMetrics;
SharedLocalData localData = {};
State::Shared state = {};
ComponentName componentName{};
ComponentHandle componentHandle{};
Tag tag{};
Props::Shared props{};
EventEmitter::Shared eventEmitter{};
LayoutMetrics layoutMetrics{EmptyLayoutMetrics};
LocalData::Shared localData{};
State::Shared state{};
};
#if RN_DEBUG_STRING_CONVERTIBLE