mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Clarify meaning of State constructor args (#39307)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39307 Make it explicit that the second arg for the State update constructor is the old State object, which we use to increment the revision. Changelog: [Internal] Reviewed By: rshest Differential Revision: D49008431 fbshipit-source-id: 649bdd136a4a6eb25858d8bfb7c41b725e593685
This commit is contained in:
committed by
Facebook GitHub Bot
parent
fb30fcaa2f
commit
7ac58772b1
@@ -32,8 +32,8 @@ class ConcreteState : public State {
|
||||
/*
|
||||
* Creates an updated `State` object with given previous one and `data`.
|
||||
*/
|
||||
explicit ConcreteState(const SharedData& data, const State& state)
|
||||
: State(data, state) {}
|
||||
explicit ConcreteState(const SharedData& data, const State& previousState)
|
||||
: State(data, previousState) {}
|
||||
|
||||
/*
|
||||
* Creates a first-of-its-family `State` object with given `family` and
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
State::State(StateData::Shared data, const State& state)
|
||||
: family_(state.family_),
|
||||
State::State(StateData::Shared data, const State& previousState)
|
||||
: family_(previousState.family_),
|
||||
data_(std::move(data)),
|
||||
revision_(state.revision_ + 1){};
|
||||
revision_(previousState.revision_ + 1){};
|
||||
|
||||
State::State(StateData::Shared data, const ShadowNodeFamily::Shared& family)
|
||||
: family_(family),
|
||||
|
||||
@@ -33,7 +33,7 @@ class State {
|
||||
* Constructors are protected to make calling them directly with
|
||||
* type-erasured arguments impossible.
|
||||
*/
|
||||
explicit State(StateData::Shared data, const State& state);
|
||||
explicit State(StateData::Shared data, const State& previousState);
|
||||
explicit State(
|
||||
StateData::Shared data,
|
||||
const ShadowNodeFamily::Shared& family);
|
||||
|
||||
Reference in New Issue
Block a user