Skip to content

Commit 7b3c622

Browse files
rshestfacebook-github-bot
authored andcommitted
Hoist TextInput.autoCapitalize to BaseTextInputProps on C++ side
Summary: ## Changelog: [Internal]- Even though `TextInput.autoCapitalize` is supposed to be cross-platform, on the C++ side of the props data structures it was only exposed as an Android-specific one. This would have it still work on the iOS side (as the corresponding prop is passed to Objective C around the C++ structs anyway), however it may also cause subtle scenarios, whereas the prop changes dynamically on the iOS side, but this doesn't get reflected on the native side. This change fixes this problem by simply hoisting the prop into the `BaseTextInputProps`, which makes it available across all platforms, as it should be. Differential Revision: D56726940 fbshipit-source-id: 9ba18f1f92095874e07207650b46655c331f3e91
1 parent 35c7956 commit 7b3c622

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

packages/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,13 @@ BaseTextInputProps::BaseTextInputProps(
9696
rawProps,
9797
"autoFocus",
9898
sourceProps.autoFocus,
99-
{})){};
99+
{})),
100+
autoCapitalize(convertRawProp(
101+
context,
102+
rawProps,
103+
"autoCapitalize",
104+
sourceProps.autoCapitalize,
105+
{})) {}
100106

101107
void BaseTextInputProps::setProp(
102108
const PropsParserContext& context,
@@ -173,6 +179,7 @@ void BaseTextInputProps::setProp(
173179
RAW_SET_PROP_SWITCH_CASE_BASIC(cursorColor);
174180
RAW_SET_PROP_SWITCH_CASE_BASIC(text);
175181
RAW_SET_PROP_SWITCH_CASE_BASIC(mostRecentEventCount);
182+
RAW_SET_PROP_SWITCH_CASE_BASIC(autoCapitalize);
176183
}
177184
}
178185

packages/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ class BaseTextInputProps : public ViewProps, public BaseTextProps {
6161
int mostRecentEventCount{0};
6262

6363
bool autoFocus{false};
64+
65+
std::string autoCapitalize{};
6466
};
6567

6668
} // namespace facebook::react

packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ AndroidTextInputProps::AndroidTextInputProps(
7575
"showSoftInputOnFocus",
7676
sourceProps.showSoftInputOnFocus,
7777
{false})),
78-
autoCapitalize(CoreFeatures::enablePropIteratorSetter? sourceProps.autoCapitalize : convertRawProp(context, rawProps,
79-
"autoCapitalize",
80-
sourceProps.autoCapitalize,
81-
{})),
8278
autoCorrect(CoreFeatures::enablePropIteratorSetter? sourceProps.autoCorrect : convertRawProp(context, rawProps,
8379
"autoCorrect",
8480
sourceProps.autoCorrect,
@@ -228,7 +224,6 @@ void AndroidTextInputProps::setProp(
228224
RAW_SET_PROP_SWITCH_CASE_BASIC(inlineImagePadding);
229225
RAW_SET_PROP_SWITCH_CASE_BASIC(importantForAutofill);
230226
RAW_SET_PROP_SWITCH_CASE_BASIC(showSoftInputOnFocus);
231-
RAW_SET_PROP_SWITCH_CASE_BASIC(autoCapitalize);
232227
RAW_SET_PROP_SWITCH_CASE_BASIC(autoCorrect);
233228
RAW_SET_PROP_SWITCH_CASE_BASIC(allowFontScaling);
234229
RAW_SET_PROP_SWITCH_CASE_BASIC(maxFontSizeMultiplier);

packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ class AndroidTextInputProps final : public BaseTextInputProps {
8484
int inlineImagePadding{0};
8585
std::string importantForAutofill{};
8686
bool showSoftInputOnFocus{false};
87-
std::string autoCapitalize{};
8887
bool autoCorrect{false};
8988
bool allowFontScaling{false};
9089
Float maxFontSizeMultiplier{0.0};

0 commit comments

Comments
 (0)