Files
react-native/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputState.h
T
Joshua Gross da5ea0215a AndroidTextInput: keep track of mostRecentEventCount in C++ State
Summary:
Keep track of AndroidTextInput's mostRecentEventCount in C++ State.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18672368

fbshipit-source-id: ea7a635629050a6d4957cbcef6ec0bda5faaad9a
2019-11-27 12:55:47 -08:00

69 lines
1.8 KiB
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <react/attributedstring/AttributedString.h>
#include <react/attributedstring/ParagraphAttributes.h>
#include <react/textlayoutmanager/TextLayoutManager.h>
#ifdef ANDROID
#include <folly/dynamic.h>
#endif
namespace facebook {
namespace react {
/*
* State for <Paragraph> component.
* Represents what to render and how to render.
*/
class AndroidTextInputState final {
public:
int64_t mostRecentEventCount{0};
/*
* All content of <Paragraph> component represented as an `AttributedString`.
*/
AttributedString attributedString;
/*
* Represents all visual attributes of a paragraph of text represented as
* a ParagraphAttributes.
*/
ParagraphAttributes paragraphAttributes;
/*
* `TextLayoutManager` provides a connection to platform-specific
* text rendering infrastructure which is capable to render the
* `AttributedString`.
*/
SharedTextLayoutManager layoutManager;
#ifdef ANDROID
AndroidTextInputState(
int64_t mostRecentEventCount,
AttributedString const &attributedString,
ParagraphAttributes const &paragraphAttributes,
SharedTextLayoutManager const &layoutManager)
: mostRecentEventCount(mostRecentEventCount),
attributedString(attributedString),
paragraphAttributes(paragraphAttributes),
layoutManager(layoutManager) {}
AndroidTextInputState() = default;
AndroidTextInputState(
AndroidTextInputState const &previousState,
folly::dynamic const &data) {
assert(false && "Not supported");
};
folly::dynamic getDynamic() const;
#endif
};
} // namespace react
} // namespace facebook