mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Changelog: [Internal] Add support for dynamic font size. New class `ThreadStorage` is introduced, which is used to pass LayoutContext to `YogaLayoutableShadowNode::yogaNodeMeasureCallbackConnector`. ## Shortcoming This implementation doesn't cause re-render, if user changes font size and comes to the app without restarting it, it will show old font size. I believe this is fine for now as most people set their font size before they use the app and keep the same setting for a long time. Reviewed By: shergin Differential Revision: D22043728 fbshipit-source-id: 7453d165c280a2f4bcb73f4ee6daf9e64b637ded
71 lines
1.7 KiB
C++
71 lines
1.7 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/ParagraphAttributes.h>
|
|
#include <react/attributedstring/TextAttributes.h>
|
|
#include <react/components/iostextinput/conversions.h>
|
|
#include <react/components/iostextinput/primitives.h>
|
|
#include <react/components/text/BaseTextProps.h>
|
|
#include <react/components/view/ViewProps.h>
|
|
#include <react/core/Props.h>
|
|
#include <react/core/propsConversions.h>
|
|
#include <react/graphics/Color.h>
|
|
#include <react/imagemanager/primitives.h>
|
|
#include <vector>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
class TextInputProps final : public ViewProps, public BaseTextProps {
|
|
public:
|
|
TextInputProps() = default;
|
|
TextInputProps(TextInputProps const &sourceProps, RawProps const &rawProps);
|
|
|
|
#pragma mark - Props
|
|
|
|
TextInputTraits const traits{};
|
|
ParagraphAttributes const paragraphAttributes{};
|
|
|
|
std::string const defaultValue{};
|
|
|
|
std::string const placeholder{};
|
|
SharedColor const placeholderTextColor{};
|
|
|
|
int maxLength{};
|
|
|
|
/*
|
|
* Tint colors
|
|
*/
|
|
SharedColor const cursorColor{};
|
|
SharedColor const selectionColor{};
|
|
// TODO: Rename to `tintColor` and make universal.
|
|
SharedColor const underlineColorAndroid{};
|
|
|
|
/*
|
|
* "Private" (only used by TextInput.js) props
|
|
*/
|
|
std::string const text{};
|
|
int const mostRecentEventCount{0};
|
|
|
|
bool autoFocus{false};
|
|
|
|
/*
|
|
* Accessors
|
|
*/
|
|
TextAttributes getEffectiveTextAttributes(Float fontSizeMultiplier) const;
|
|
ParagraphAttributes getEffectiveParagraphAttributes() const;
|
|
|
|
#ifdef ANDROID
|
|
folly::dynamic getDynamic() const;
|
|
#endif
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|