mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add TextInput.editable and BaseTextInputProps (#46356)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46356 # Changelog: [Internal]- Currently TextInput does not expose `editable` and `readOnly` (only `editable` is exposed as Android-specific prop). This change is to add them to BaseTextInputProps so they can be supported cross-platform. Reviewed By: rshest Differential Revision: D62180722 fbshipit-source-id: 6cb82589f1d36b61167761f5a2e70e8d4b31b01b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5b5a8397aa
commit
4a22f2c816
+14
@@ -102,6 +102,18 @@ BaseTextInputProps::BaseTextInputProps(
|
||||
rawProps,
|
||||
"autoCapitalize",
|
||||
sourceProps.autoCapitalize,
|
||||
{})),
|
||||
editable(convertRawProp(
|
||||
context,
|
||||
rawProps,
|
||||
"editable",
|
||||
sourceProps.editable,
|
||||
{})),
|
||||
readOnly(convertRawProp(
|
||||
context,
|
||||
rawProps,
|
||||
"readOnly",
|
||||
sourceProps.readOnly,
|
||||
{})) {}
|
||||
|
||||
void BaseTextInputProps::setProp(
|
||||
@@ -180,6 +192,8 @@ void BaseTextInputProps::setProp(
|
||||
RAW_SET_PROP_SWITCH_CASE_BASIC(text);
|
||||
RAW_SET_PROP_SWITCH_CASE_BASIC(mostRecentEventCount);
|
||||
RAW_SET_PROP_SWITCH_CASE_BASIC(autoCapitalize);
|
||||
RAW_SET_PROP_SWITCH_CASE_BASIC(editable);
|
||||
RAW_SET_PROP_SWITCH_CASE_BASIC(readOnly);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -63,6 +63,9 @@ class BaseTextInputProps : public ViewProps, public BaseTextProps {
|
||||
bool autoFocus{false};
|
||||
|
||||
std::string autoCapitalize{};
|
||||
|
||||
bool editable{true};
|
||||
bool readOnly{false};
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
-4
@@ -87,8 +87,6 @@ AndroidTextInputProps::AndroidTextInputProps(
|
||||
"maxFontSizeMultiplier",
|
||||
sourceProps.maxFontSizeMultiplier,
|
||||
{0.0})),
|
||||
editable(CoreFeatures::enablePropIteratorSetter? sourceProps.editable :
|
||||
convertRawProp(context, rawProps, "editable", sourceProps.editable, {false})),
|
||||
keyboardType(CoreFeatures::enablePropIteratorSetter? sourceProps.keyboardType : convertRawProp(context, rawProps,
|
||||
"keyboardType",
|
||||
sourceProps.keyboardType,
|
||||
@@ -223,7 +221,6 @@ void AndroidTextInputProps::setProp(
|
||||
RAW_SET_PROP_SWITCH_CASE_BASIC(autoCorrect);
|
||||
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(multiline);
|
||||
@@ -313,7 +310,6 @@ folly::dynamic AndroidTextInputProps::getDynamic() const {
|
||||
props["autoFocus"] = autoFocus;
|
||||
props["allowFontScaling"] = allowFontScaling;
|
||||
props["maxFontSizeMultiplier"] = maxFontSizeMultiplier;
|
||||
props["editable"] = editable;
|
||||
props["keyboardType"] = keyboardType;
|
||||
props["returnKeyType"] = returnKeyType;
|
||||
props["maxLength"] = maxLength;
|
||||
|
||||
-1
@@ -87,7 +87,6 @@ class AndroidTextInputProps final : public BaseTextInputProps {
|
||||
bool autoCorrect{false};
|
||||
bool allowFontScaling{false};
|
||||
Float maxFontSizeMultiplier{0.0};
|
||||
bool editable{false};
|
||||
std::string keyboardType{};
|
||||
std::string returnKeyType{};
|
||||
bool multiline{false};
|
||||
|
||||
Reference in New Issue
Block a user