Fabric: Changing signature of ComponentDescriptor::createState

Summary:
This is pure syntactic change. Often we don't have a shared pointer to ShadowNodeFamily and only have just a reference. At the same time, `ComponentDescriptor::createState` does not have to accept a shared pointer. So, it's better to accept just a reference.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20578787

fbshipit-source-id: 905277001e096d41e75007575b59ea2ea15fbf4b
This commit is contained in:
Valentin Shergin
2020-03-23 13:33:21 -07:00
committed by Facebook GitHub Bot
parent 3679929830
commit 100bf9076a
3 changed files with 4 additions and 4 deletions
@@ -116,7 +116,7 @@ class ComponentDescriptor {
* State's data.
*/
virtual State::Shared createState(
ShadowNodeFamily::Shared const &family,
ShadowNodeFamily const &family,
const StateData::Shared &data) const = 0;
/*
@@ -133,7 +133,7 @@ class ConcreteComponentDescriptor : public ComponentDescriptor {
}
virtual State::Shared createState(
ShadowNodeFamily::Shared const &family,
ShadowNodeFamily const &family,
StateData::Shared const &data) const override {
if (std::is_same<ConcreteStateData, StateData>::value) {
// Default case: Returning `null` for nodes that don't use `State`.
@@ -144,7 +144,7 @@ class ConcreteComponentDescriptor : public ComponentDescriptor {
return std::make_shared<ConcreteState const>(
std::static_pointer_cast<ConcreteStateData const>(data),
*family->getMostRecentState());
*family.getMostRecentState());
}
virtual ShadowNodeFamily::Shared createFamily(
+1 -1
View File
@@ -234,7 +234,7 @@ void UIManager::updateState(StateUpdate const &stateUpdate) const {
auto newData =
callback(oldShadowNode.getState()->getDataPointer());
auto newState =
componentDescriptor.createState(family, newData);
componentDescriptor.createState(*family, newData);
return oldShadowNode.clone({
/* .props = */ ShadowNodeFragment::propsPlaceholder(),