Fix TextInput-textStyles-e2e test (#42685)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42685

This diff fixes the TextInput-textStyles-e2e test.
The rootcause of this issue is that we were updating the lineHeight of ReactEditText (AppCompatEditText) when lineHeight is set as a prop from React.
This is a problem, because one one side lineHeight is managed  by React Native (setting styles in the spannables) and on the other side we ar calling setLineHeight on AppCompatEditText, which breaks the rendering.

We should only manage lineHeight using RN styles, that's why I'm removing call to super.setLineHeight()

Changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D53142429

fbshipit-source-id: cedf803171a490afa67252e9e7f83749502326e6
This commit is contained in:
David Vacca
2024-01-26 15:50:31 -08:00
committed by Facebook GitHub Bot
parent c8ab44cf0b
commit de42893d01
@@ -83,6 +83,7 @@ import java.util.Objects;
* VisibleForTesting from {@link TextInputEventsTestCase}.
*/
public class ReactEditText extends AppCompatEditText {
private final InputMethodManager mInputMethodManager;
private final String TAG = ReactEditText.class.getSimpleName();
public static final boolean DEBUG_MODE = ReactBuildConfig.DEBUG && false;
@@ -273,9 +274,7 @@ public class ReactEditText extends AppCompatEditText {
@Override
public void setLineHeight(int lineHeight) {
mTextAttributes.setLineHeight(lineHeight);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
super.setLineHeight(lineHeight);
}
// We don't call super.setLineHeight() because LineHeight is fully managed by ReactNative
}
@Override
@@ -1232,6 +1231,7 @@ public class ReactEditText extends AppCompatEditText {
* changed by the user, and not explicitly set by JS.
*/
private class TextWatcherDelegator implements TextWatcher {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
if (!mIsSettingTextFromJS && mListeners != null) {