Skip to content

Commit

Permalink
Fabric: Changing signature of ComponentDescriptor::createState
Browse files Browse the repository at this point in the history
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
  • Loading branch information
shergin authored and facebook-github-bot committed Mar 23, 2020
1 parent 3679929 commit 100bf90
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Expand Up @@ -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;

/*
Expand Down
Expand Up @@ -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`.
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/fabric/uimanager/UIManager.cpp
Expand Up @@ -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(),
Expand Down

0 comments on commit 100bf90

Please sign in to comment.