diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java index 1638b75147d..5350aa5364a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java @@ -39,7 +39,7 @@ import androidx.core.view.ViewCompat; import com.facebook.infer.annotation.Assertions; import com.facebook.react.bridge.JavaOnlyMap; import com.facebook.react.bridge.ReactContext; -import com.facebook.react.uimanager.StateWrapper; +import com.facebook.react.uimanager.FabricViewStateManager; import com.facebook.react.uimanager.UIManagerModule; import com.facebook.react.views.text.ReactSpan; import com.facebook.react.views.text.ReactTextUpdate; @@ -61,7 +61,8 @@ import java.util.ArrayList; * called this explicitly. This is the default behavior on other platforms as well. * VisibleForTesting from {@link TextInputEventsTestCase}. */ -public class ReactEditText extends AppCompatEditText { +public class ReactEditText extends AppCompatEditText + implements FabricViewStateManager.HasFabricViewStateManager { private final InputMethodManager mInputMethodManager; // This flag is set to true when we set the text of the EditText explicitly. In that case, no @@ -100,7 +101,7 @@ public class ReactEditText extends AppCompatEditText { private ReactViewBackgroundManager mReactBackgroundManager; protected @Nullable JavaOnlyMap mAttributedString = null; - protected @Nullable StateWrapper mStateWrapper = null; + private final FabricViewStateManager mFabricViewStateManager = new FabricViewStateManager(); protected boolean mDisableTextDiffing = false; protected boolean mIsSettingTextFromState = false; @@ -605,7 +606,7 @@ public class ReactEditText extends AppCompatEditText { // wrapper 100% of the time. // Since the LocalData object is constructed by getting values from the underlying EditText // view, we don't need to construct one or apply it at all - it provides no use in Fabric. - if (mStateWrapper == null) { + if (!mFabricViewStateManager.hasStateWrapper()) { ReactContext reactContext = getReactContext(this); final ReactTextInputLocalData localData = new ReactTextInputLocalData(this); UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class); @@ -820,6 +821,11 @@ public class ReactEditText extends AppCompatEditText { } } + @Override + public FabricViewStateManager getFabricViewStateManager() { + return mFabricViewStateManager; + } + /** * This class will redirect *TextChanged calls to the listeners only in the case where the text is * changed by the user, and not explicitly set by JS. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java index 4703908cc7b..c322d6e02f2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java @@ -50,6 +50,7 @@ import com.facebook.react.bridge.WritableNativeMap; import com.facebook.react.common.MapBuilder; import com.facebook.react.module.annotations.ReactModule; import com.facebook.react.uimanager.BaseViewManager; +import com.facebook.react.uimanager.FabricViewStateManager; import com.facebook.react.uimanager.LayoutShadowNode; import com.facebook.react.uimanager.PixelUtil; import com.facebook.react.uimanager.ReactStylesDiffMap; @@ -919,7 +920,7 @@ public class ReactTextInputManager extends BaseViewManager