From 2a73a33205ce54f8b10c27ac9992115940db28db Mon Sep 17 00:00:00 2001 From: Ruslan Shestopalyuk Date: Tue, 12 Mar 2024 04:06:02 -0700 Subject: [PATCH] Factor out common parts of TextInputProps between Android/iOS Summary: ## Changelog: [Internal] - This takes all the common props for TextInput between Android and iOS and factors them out into a single, platform independent props data structure, `BaseTextInputProps`. This way it's both easier to manage the corresponding props, but also making this easier to be used on other platforms. Differential Revision: D54764898 --- .../textinput/BaseTextInputProps.cpp | 179 ++++++++++++++++++ .../components/textinput/BaseTextInputProps.h | 66 +++++++ .../AndroidTextInputProps.cpp | 107 +---------- .../androidtextinput/AndroidTextInputProps.h | 22 +-- .../iostextinput/TextInputProps.cpp | 78 +------- .../components/iostextinput/TextInputProps.h | 34 +--- 6 files changed, 252 insertions(+), 234 deletions(-) create mode 100644 packages/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.cpp create mode 100644 packages/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.h diff --git a/packages/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.cpp new file mode 100644 index 00000000000000..28dc7d87cbdad4 --- /dev/null +++ b/packages/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.cpp @@ -0,0 +1,179 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include "BaseTextInputProps.h" + +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace facebook::react { + +BaseTextInputProps::BaseTextInputProps( + const PropsParserContext& context, + const BaseTextInputProps& sourceProps, + const RawProps& rawProps) + : ViewProps(context, sourceProps, rawProps), + BaseTextProps(context, sourceProps, rawProps), + paragraphAttributes(convertRawProp( + context, + rawProps, + sourceProps.paragraphAttributes, + {})), + defaultValue(convertRawProp( + context, + rawProps, + "defaultValue", + sourceProps.defaultValue, + {})), + placeholder(convertRawProp( + context, + rawProps, + "placeholder", + sourceProps.placeholder, + {})), + placeholderTextColor(convertRawProp( + context, + rawProps, + "placeholderTextColor", + sourceProps.placeholderTextColor, + {})), + cursorColor(convertRawProp( + context, + rawProps, + "cursorColor", + sourceProps.cursorColor, + {})), + selectionColor(convertRawProp( + context, + rawProps, + "selectionColor", + sourceProps.selectionColor, + {})), + selectionHandleColor(convertRawProp( + context, + rawProps, + "selectionHandleColor", + sourceProps.selectionHandleColor, + {})), + underlineColorAndroid(convertRawProp( + context, + rawProps, + "underlineColorAndroid", + sourceProps.underlineColorAndroid, + {})), + maxLength(convertRawProp( + context, + rawProps, + "maxLength", + sourceProps.maxLength, + {})), + text(convertRawProp(context, rawProps, "text", sourceProps.text, {})), + mostRecentEventCount(convertRawProp( + context, + rawProps, + "mostRecentEventCount", + sourceProps.mostRecentEventCount, + {})), + autoFocus(convertRawProp( + context, + rawProps, + "autoFocus", + sourceProps.autoFocus, + {})){}; + +void BaseTextInputProps::setProp( + const PropsParserContext& context, + RawPropsPropNameHash hash, + const char* propName, + const RawValue& value) { + ViewProps::setProp(context, hash, propName, value); + BaseTextProps::setProp(context, hash, propName, value); + + static auto defaults = BaseTextInputProps{}; + + // ParagraphAttributes has its own switch statement - to keep all + // of these fields together, and because there are some collisions between + // propnames parsed here and outside of ParagraphAttributes. For example, + // textBreakStrategy is duplicated. + // This code is also duplicated in ParagraphProps. + static auto paDefaults = ParagraphAttributes{}; + switch (hash) { + REBUILD_FIELD_SWITCH_CASE( + paDefaults, + value, + paragraphAttributes, + maximumNumberOfLines, + "numberOfLines"); + REBUILD_FIELD_SWITCH_CASE( + paDefaults, value, paragraphAttributes, ellipsizeMode, "ellipsizeMode"); + REBUILD_FIELD_SWITCH_CASE( + paDefaults, + value, + paragraphAttributes, + textBreakStrategy, + "textBreakStrategy"); + REBUILD_FIELD_SWITCH_CASE( + paDefaults, + value, + paragraphAttributes, + adjustsFontSizeToFit, + "adjustsFontSizeToFit"); + REBUILD_FIELD_SWITCH_CASE( + paDefaults, + value, + paragraphAttributes, + minimumFontSize, + "minimumFontSize"); + REBUILD_FIELD_SWITCH_CASE( + paDefaults, + value, + paragraphAttributes, + maximumFontSize, + "maximumFontSize"); + REBUILD_FIELD_SWITCH_CASE( + paDefaults, + value, + paragraphAttributes, + includeFontPadding, + "includeFontPadding"); + REBUILD_FIELD_SWITCH_CASE( + paDefaults, + value, + paragraphAttributes, + android_hyphenationFrequency, + "android_hyphenationFrequency"); + } + + switch (hash) { + RAW_SET_PROP_SWITCH_CASE_BASIC(underlineColorAndroid); + RAW_SET_PROP_SWITCH_CASE_BASIC(autoFocus); + RAW_SET_PROP_SWITCH_CASE_BASIC(maxLength); + RAW_SET_PROP_SWITCH_CASE_BASIC(placeholder); + RAW_SET_PROP_SWITCH_CASE_BASIC(placeholderTextColor); + RAW_SET_PROP_SWITCH_CASE_BASIC(selectionColor); + RAW_SET_PROP_SWITCH_CASE_BASIC(selectionHandleColor); + RAW_SET_PROP_SWITCH_CASE_BASIC(defaultValue); + RAW_SET_PROP_SWITCH_CASE_BASIC(cursorColor); + RAW_SET_PROP_SWITCH_CASE_BASIC(text); + RAW_SET_PROP_SWITCH_CASE_BASIC(mostRecentEventCount); + } +} + +} // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.h b/packages/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.h new file mode 100644 index 00000000000000..c1a3ef1e202e5b --- /dev/null +++ b/packages/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) Meta Platforms, Inc. and 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 +#include +#include +#include +#include +#include + +namespace facebook::react { + +class BaseTextInputProps : public ViewProps, public BaseTextProps { + public: + BaseTextInputProps() = default; + BaseTextInputProps( + const PropsParserContext& context, + const BaseTextInputProps& sourceProps, + const RawProps& rawProps); + + void setProp( + const PropsParserContext& context, + RawPropsPropNameHash hash, + const char* propName, + const RawValue& value); + +#pragma mark - Props + + /* + * Contains all prop values that affect visual representation of the + * paragraph. + */ + ParagraphAttributes paragraphAttributes{}; + + std::string defaultValue{}; + + std::string placeholder{}; + SharedColor placeholderTextColor{}; + + /* + * Tint colors + */ + SharedColor cursorColor{}; + SharedColor selectionColor{}; + SharedColor selectionHandleColor{}; + // TODO: Rename to `tintColor` and make universal. + SharedColor underlineColorAndroid{}; + + int maxLength{}; + + /* + * "Private" (only used by TextInput.js) props + */ + std::string text{}; + int mostRecentEventCount{0}; + + bool autoFocus{false}; +}; + +} // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp index ea0fb6a1674e3d..38f3474ac350e1 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp @@ -36,8 +36,7 @@ AndroidTextInputProps::AndroidTextInputProps( const PropsParserContext &context, const AndroidTextInputProps &sourceProps, const RawProps &rawProps) - : ViewProps(context, sourceProps, rawProps), - BaseTextProps(context, sourceProps, rawProps), + : BaseTextInputProps(context, sourceProps, rawProps), autoComplete(CoreFeatures::enablePropIteratorSetter? sourceProps.autoComplete : convertRawProp( context, rawProps, @@ -60,10 +59,6 @@ AndroidTextInputProps::AndroidTextInputProps( "textBreakStrategy", sourceProps.textBreakStrategy, {})), - underlineColorAndroid(CoreFeatures::enablePropIteratorSetter? sourceProps.underlineColorAndroid : convertRawProp(context, rawProps, - "underlineColorAndroid", - sourceProps.underlineColorAndroid, - {})), inlineImageLeft(CoreFeatures::enablePropIteratorSetter? sourceProps.inlineImageLeft : convertRawProp(context, rawProps, "inlineImageLeft", sourceProps.inlineImageLeft, @@ -88,10 +83,6 @@ AndroidTextInputProps::AndroidTextInputProps( "autoCorrect", sourceProps.autoCorrect, {false})), - autoFocus(CoreFeatures::enablePropIteratorSetter? sourceProps.autoFocus : convertRawProp(context, rawProps, - "autoFocus", - sourceProps.autoFocus, - {false})), allowFontScaling(CoreFeatures::enablePropIteratorSetter? sourceProps.allowFontScaling : convertRawProp(context, rawProps, "allowFontScaling", sourceProps.allowFontScaling, @@ -110,35 +101,15 @@ AndroidTextInputProps::AndroidTextInputProps( "returnKeyType", sourceProps.returnKeyType, {})), - maxLength(CoreFeatures::enablePropIteratorSetter? sourceProps.maxLength : - convertRawProp(context, rawProps, "maxLength", sourceProps.maxLength, {0})), multiline(CoreFeatures::enablePropIteratorSetter? sourceProps.multiline : convertRawProp(context, rawProps, "multiline", sourceProps.multiline, {false})), - placeholder(CoreFeatures::enablePropIteratorSetter? sourceProps.placeholder : - convertRawProp(context, rawProps, "placeholder", sourceProps.placeholder, {})), - placeholderTextColor(CoreFeatures::enablePropIteratorSetter? sourceProps.placeholderTextColor : convertRawProp(context, rawProps, - "placeholderTextColor", - sourceProps.placeholderTextColor, - {})), secureTextEntry(CoreFeatures::enablePropIteratorSetter? sourceProps.secureTextEntry : convertRawProp(context, rawProps, "secureTextEntry", sourceProps.secureTextEntry, {false})), - selectionColor(CoreFeatures::enablePropIteratorSetter? sourceProps.selectionColor : convertRawProp(context, rawProps, - "selectionColor", - sourceProps.selectionColor, - {})), - selectionHandleColor(CoreFeatures::enablePropIteratorSetter? sourceProps.selectionHandleColor : convertRawProp(context, rawProps, - "selectionHandleColor", - sourceProps.selectionHandleColor, - {})), value(CoreFeatures::enablePropIteratorSetter? sourceProps.value : convertRawProp(context, rawProps, "value", sourceProps.value, {})), - defaultValue(CoreFeatures::enablePropIteratorSetter? sourceProps.defaultValue : convertRawProp(context, rawProps, - "defaultValue", - sourceProps.defaultValue, - {})), selectTextOnFocus(CoreFeatures::enablePropIteratorSetter? sourceProps.selectTextOnFocus : convertRawProp(context, rawProps, "selectTextOnFocus", sourceProps.selectTextOnFocus, @@ -202,15 +173,6 @@ AndroidTextInputProps::AndroidTextInputProps( "textAlignVertical", sourceProps.textAlignVertical, {})), - cursorColor(CoreFeatures::enablePropIteratorSetter? sourceProps.cursorColor : - convertRawProp(context, rawProps, "cursorColor", sourceProps.cursorColor, {})), - mostRecentEventCount(CoreFeatures::enablePropIteratorSetter? sourceProps.mostRecentEventCount : convertRawProp(context, rawProps, - "mostRecentEventCount", - sourceProps.mostRecentEventCount, - {0})), - text(CoreFeatures::enablePropIteratorSetter? sourceProps.text : convertRawProp(context, rawProps, "text", sourceProps.text, {})), - paragraphAttributes(CoreFeatures::enablePropIteratorSetter? sourceProps.paragraphAttributes : - convertRawProp(context, rawProps, sourceProps.paragraphAttributes, {})), // See AndroidTextInputComponentDescriptor for usage // TODO T63008435: can these, and this feature, be removed entirely? hasPadding(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPadding : hasValue(rawProps, sourceProps.hasPadding, "padding")), @@ -252,91 +214,29 @@ void AndroidTextInputProps::setProp( // All Props structs setProp methods must always, unconditionally, // call all super::setProp methods, since multiple structs may // reuse the same values. - ViewProps::setProp(context, hash, propName, value); - BaseTextProps::setProp(context, hash, propName, value); + BaseTextInputProps::setProp(context, hash, propName, value); static auto defaults = AndroidTextInputProps{}; - // ParagraphAttributes has its own switch statement - to keep all - // of these fields together, and because there are some collisions between - // propnames parsed here and outside of ParagraphAttributes. For example, - // textBreakStrategy is duplicated. - // This code is also duplicated in ParagraphProps. - static auto paDefaults = ParagraphAttributes{}; - switch (hash) { - REBUILD_FIELD_SWITCH_CASE( - paDefaults, - value, - paragraphAttributes, - maximumNumberOfLines, - "numberOfLines"); - REBUILD_FIELD_SWITCH_CASE( - paDefaults, value, paragraphAttributes, ellipsizeMode, "ellipsizeMode"); - REBUILD_FIELD_SWITCH_CASE( - paDefaults, - value, - paragraphAttributes, - textBreakStrategy, - "textBreakStrategy"); - REBUILD_FIELD_SWITCH_CASE( - paDefaults, - value, - paragraphAttributes, - adjustsFontSizeToFit, - "adjustsFontSizeToFit"); - REBUILD_FIELD_SWITCH_CASE( - paDefaults, - value, - paragraphAttributes, - minimumFontSize, - "minimumFontSize"); - REBUILD_FIELD_SWITCH_CASE( - paDefaults, - value, - paragraphAttributes, - maximumFontSize, - "maximumFontSize"); - REBUILD_FIELD_SWITCH_CASE( - paDefaults, - value, - paragraphAttributes, - includeFontPadding, - "includeFontPadding"); - REBUILD_FIELD_SWITCH_CASE( - paDefaults, - value, - paragraphAttributes, - android_hyphenationFrequency, - "android_hyphenationFrequency"); - } - switch (hash) { RAW_SET_PROP_SWITCH_CASE_BASIC(autoComplete); RAW_SET_PROP_SWITCH_CASE_BASIC(returnKeyLabel); RAW_SET_PROP_SWITCH_CASE_BASIC(numberOfLines); RAW_SET_PROP_SWITCH_CASE_BASIC(disableFullscreenUI); RAW_SET_PROP_SWITCH_CASE_BASIC(textBreakStrategy); - RAW_SET_PROP_SWITCH_CASE_BASIC(underlineColorAndroid); RAW_SET_PROP_SWITCH_CASE_BASIC(inlineImageLeft); RAW_SET_PROP_SWITCH_CASE_BASIC(inlineImagePadding); RAW_SET_PROP_SWITCH_CASE_BASIC(importantForAutofill); RAW_SET_PROP_SWITCH_CASE_BASIC(showSoftInputOnFocus); RAW_SET_PROP_SWITCH_CASE_BASIC(autoCapitalize); RAW_SET_PROP_SWITCH_CASE_BASIC(autoCorrect); - RAW_SET_PROP_SWITCH_CASE_BASIC(autoFocus); RAW_SET_PROP_SWITCH_CASE_BASIC(allowFontScaling); RAW_SET_PROP_SWITCH_CASE_BASIC(maxFontSizeMultiplier); RAW_SET_PROP_SWITCH_CASE_BASIC(editable); RAW_SET_PROP_SWITCH_CASE_BASIC(keyboardType); RAW_SET_PROP_SWITCH_CASE_BASIC(returnKeyType); - RAW_SET_PROP_SWITCH_CASE_BASIC(maxLength); RAW_SET_PROP_SWITCH_CASE_BASIC(multiline); - RAW_SET_PROP_SWITCH_CASE_BASIC(placeholder); - RAW_SET_PROP_SWITCH_CASE_BASIC(placeholderTextColor); RAW_SET_PROP_SWITCH_CASE_BASIC(secureTextEntry); - RAW_SET_PROP_SWITCH_CASE_BASIC(selectionColor); - RAW_SET_PROP_SWITCH_CASE_BASIC(selectionHandleColor); - RAW_SET_PROP_SWITCH_CASE_BASIC(defaultValue); RAW_SET_PROP_SWITCH_CASE_BASIC(selectTextOnFocus); RAW_SET_PROP_SWITCH_CASE_BASIC(submitBehavior); RAW_SET_PROP_SWITCH_CASE_BASIC(caretHidden); @@ -356,9 +256,6 @@ void AndroidTextInputProps::setProp( RAW_SET_PROP_SWITCH_CASE_BASIC(fontWeight); RAW_SET_PROP_SWITCH_CASE_BASIC(fontFamily); RAW_SET_PROP_SWITCH_CASE_BASIC(textAlignVertical); - RAW_SET_PROP_SWITCH_CASE_BASIC(cursorColor); - RAW_SET_PROP_SWITCH_CASE_BASIC(mostRecentEventCount); - RAW_SET_PROP_SWITCH_CASE_BASIC(text); case CONSTEXPR_RAW_PROPS_KEY_HASH("value"): { fromRawValue(context, value, this->value, {}); diff --git a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.h b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.h index 82fb75ea1028e4..28e5df5976be84 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.h +++ b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.h @@ -12,8 +12,7 @@ #include #include -#include -#include +#include #include #include #include @@ -58,7 +57,7 @@ inline folly::dynamic toDynamic( return dynamicValue; } -class AndroidTextInputProps final : public ViewProps, public BaseTextProps { +class AndroidTextInputProps final : public BaseTextInputProps { public: AndroidTextInputProps() = default; AndroidTextInputProps( @@ -81,28 +80,20 @@ class AndroidTextInputProps final : public ViewProps, public BaseTextProps { int numberOfLines{0}; bool disableFullscreenUI{false}; std::string textBreakStrategy{}; - SharedColor underlineColorAndroid{}; std::string inlineImageLeft{}; int inlineImagePadding{0}; std::string importantForAutofill{}; bool showSoftInputOnFocus{false}; std::string autoCapitalize{}; bool autoCorrect{false}; - bool autoFocus{false}; bool allowFontScaling{false}; Float maxFontSizeMultiplier{0.0}; bool editable{false}; std::string keyboardType{}; std::string returnKeyType{}; - int maxLength{0}; bool multiline{false}; - std::string placeholder{}; - SharedColor placeholderTextColor{}; bool secureTextEntry{false}; - SharedColor selectionColor{}; - SharedColor selectionHandleColor{}; std::string value{}; - std::string defaultValue{}; bool selectTextOnFocus{false}; std::string submitBehavior{}; bool caretHidden{false}; @@ -122,15 +113,6 @@ class AndroidTextInputProps final : public ViewProps, public BaseTextProps { std::string fontWeight{}; std::string fontFamily{}; std::string textAlignVertical{}; - SharedColor cursorColor{}; - int mostRecentEventCount{0}; - std::string text{}; - - /* - * Contains all prop values that affect visual representation of the - * paragraph. - */ - ParagraphAttributes paragraphAttributes{}; /** * Auxiliary information to detect if these props are set or not. diff --git a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/ios/react/renderer/components/iostextinput/TextInputProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/ios/react/renderer/components/iostextinput/TextInputProps.cpp index a825971ddbe8c8..43f5e9efa54c58 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/ios/react/renderer/components/iostextinput/TextInputProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/ios/react/renderer/components/iostextinput/TextInputProps.cpp @@ -18,75 +18,8 @@ TextInputProps::TextInputProps( const PropsParserContext& context, const TextInputProps& sourceProps, const RawProps& rawProps) - : ViewProps(context, sourceProps, rawProps), - BaseTextProps(context, sourceProps, rawProps), + : BaseTextInputProps(context, sourceProps, rawProps), traits(convertRawProp(context, rawProps, sourceProps.traits, {})), - paragraphAttributes(convertRawProp( - context, - rawProps, - sourceProps.paragraphAttributes, - {})), - defaultValue(convertRawProp( - context, - rawProps, - "defaultValue", - sourceProps.defaultValue, - {})), - placeholder(convertRawProp( - context, - rawProps, - "placeholder", - sourceProps.placeholder, - {})), - placeholderTextColor(convertRawProp( - context, - rawProps, - "placeholderTextColor", - sourceProps.placeholderTextColor, - {})), - maxLength(convertRawProp( - context, - rawProps, - "maxLength", - sourceProps.maxLength, - {})), - cursorColor(convertRawProp( - context, - rawProps, - "cursorColor", - sourceProps.cursorColor, - {})), - selectionColor(convertRawProp( - context, - rawProps, - "selectionColor", - sourceProps.selectionColor, - {})), - selectionHandleColor(convertRawProp( - context, - rawProps, - "selectionHandleColor", - sourceProps.selectionHandleColor, - {})), - underlineColorAndroid(convertRawProp( - context, - rawProps, - "underlineColorAndroid", - sourceProps.underlineColorAndroid, - {})), - text(convertRawProp(context, rawProps, "text", sourceProps.text, {})), - mostRecentEventCount(convertRawProp( - context, - rawProps, - "mostRecentEventCount", - sourceProps.mostRecentEventCount, - {})), - autoFocus(convertRawProp( - context, - rawProps, - "autoFocus", - sourceProps.autoFocus, - {})), selection(convertRawProp( context, rawProps, @@ -112,15 +45,6 @@ TextInputProps::TextInputProps( sourceProps.onChangeSync, {})){}; -void TextInputProps::setProp( - const PropsParserContext& context, - RawPropsPropNameHash hash, - const char* propName, - const RawValue& value) { - ViewProps::setProp(context, hash, propName, value); - BaseTextProps::setProp(context, hash, propName, value); -} - TextAttributes TextInputProps::getEffectiveTextAttributes( Float fontSizeMultiplier) const { auto result = TextAttributes::defaultTextAttributes(); diff --git a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/ios/react/renderer/components/iostextinput/TextInputProps.h b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/ios/react/renderer/components/iostextinput/TextInputProps.h index e3db155099c78e..ea1583c917136c 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/ios/react/renderer/components/iostextinput/TextInputProps.h +++ b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/ios/react/renderer/components/iostextinput/TextInputProps.h @@ -11,18 +11,16 @@ #include #include #include -#include -#include +#include #include #include #include -#include #include #include namespace facebook::react { -class TextInputProps final : public ViewProps, public BaseTextProps { +class TextInputProps final : public BaseTextInputProps { public: TextInputProps() = default; TextInputProps( @@ -30,40 +28,12 @@ class TextInputProps final : public ViewProps, public BaseTextProps { const TextInputProps& sourceProps, const RawProps& rawProps); - void setProp( - const PropsParserContext& context, - RawPropsPropNameHash hash, - const char* propName, - const RawValue& value); - #pragma mark - Props - const TextInputTraits traits{}; - const ParagraphAttributes paragraphAttributes{}; - - std::string const defaultValue{}; - - std::string const placeholder{}; - const SharedColor placeholderTextColor{}; - - int maxLength{}; - - /* - * Tint colors - */ - const SharedColor cursorColor{}; - const SharedColor selectionColor{}; - const SharedColor selectionHandleColor{}; - // TODO: Rename to `tintColor` and make universal. - const SharedColor underlineColorAndroid{}; /* * "Private" (only used by TextInput.js) props */ - std::string const text{}; - const int mostRecentEventCount{0}; - - bool autoFocus{false}; std::optional selection{}; std::string const inputAccessoryViewID{};