Fix ignored initial value of TextInput
Summary: Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D19922731 fbshipit-source-id: b06f1d98d97a4ea46c60e07a89452ee77acded8d
This commit is contained in:
Родитель
0e4bcaa296
Коммит
145151ef0f
|
@ -19,7 +19,8 @@ namespace react {
|
|||
extern char const TextInputComponentName[] = "TextInput";
|
||||
|
||||
AttributedStringBox TextInputShadowNode::attributedStringBoxToMeasure() const {
|
||||
bool hasMeaningfulState = getState() && getState()->getRevision() != 0;
|
||||
bool hasMeaningfulState =
|
||||
getState() && getState()->getRevision() != State::initialRevisionValue;
|
||||
|
||||
if (hasMeaningfulState) {
|
||||
auto attributedStringBox = getStateData().attributedStringBox;
|
||||
|
@ -66,7 +67,7 @@ void TextInputShadowNode::setTextLayoutManager(
|
|||
void TextInputShadowNode::updateStateIfNeeded() {
|
||||
ensureUnsealed();
|
||||
|
||||
if (!getState() || getState()->getRevision() == 0) {
|
||||
if (!getState() || getState()->getRevision() == State::initialRevisionValue) {
|
||||
auto state = TextInputState{};
|
||||
state.attributedStringBox = AttributedStringBox{getAttributedString()};
|
||||
state.paragraphAttributes = getConcreteProps().paragraphAttributes;
|
||||
|
|
|
@ -21,7 +21,7 @@ State::State(StateData::Shared const &data, State const &state)
|
|||
State::State(
|
||||
StateData::Shared const &data,
|
||||
ShadowNodeFamily::Shared const &family)
|
||||
: family_(family), data_(data), revision_{1} {};
|
||||
: family_(family), data_(data), revision_{State::initialRevisionValue} {};
|
||||
|
||||
State::Shared State::getMostRecentState() const {
|
||||
auto family = family_.lock();
|
||||
|
|
|
@ -25,6 +25,8 @@ class State {
|
|||
public:
|
||||
using Shared = std::shared_ptr<const State>;
|
||||
|
||||
static size_t constexpr initialRevisionValue = 1;
|
||||
|
||||
protected:
|
||||
/*
|
||||
* Constructors are protected to make calling them directly with
|
||||
|
|
Загрузка…
Ссылка в новой задаче