From e00028f6bb6c19de861f9a25f377295755f3671b Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Fri, 2 May 2025 13:21:27 -0700 Subject: [PATCH] Clean up useEditTextStockAndroidFocusBehavior feature flag (#51039) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51039 We added a feature flag in case this broke things. Its been about 4 months now with now issues, I think we can clean this up. Changelog: [Android][Fixed] - Can now focus TextInput with keyboard Reviewed By: NickGerleman Differential Revision: D73954790 fbshipit-source-id: 4682cf709aa2f34ba69e76a35d07a908edb28f23 --- .../ReactAndroid/api/ReactAndroid.api | 1 - .../featureflags/ReactNativeFeatureFlags.kt | 8 +--- .../ReactNativeFeatureFlagsCxxAccessor.kt | 12 +---- .../ReactNativeFeatureFlagsCxxInterop.kt | 4 +- .../ReactNativeFeatureFlagsDefaults.kt | 4 +- .../ReactNativeFeatureFlagsLocalAccessor.kt | 13 +---- .../ReactNativeFeatureFlagsProvider.kt | 4 +- .../react/views/textinput/ReactEditText.kt | 48 ++----------------- .../JReactNativeFeatureFlagsCxxInterop.cpp | 16 +------ .../JReactNativeFeatureFlagsCxxInterop.h | 5 +- .../featureflags/ReactNativeFeatureFlags.cpp | 6 +-- .../featureflags/ReactNativeFeatureFlags.h | 7 +-- .../ReactNativeFeatureFlagsAccessor.cpp | 34 ++++--------- .../ReactNativeFeatureFlagsAccessor.h | 6 +-- .../ReactNativeFeatureFlagsDefaults.h | 6 +-- .../ReactNativeFeatureFlagsDynamicProvider.h | 11 +---- .../ReactNativeFeatureFlagsProvider.h | 3 +- .../NativeReactNativeFeatureFlags.cpp | 7 +-- .../NativeReactNativeFeatureFlags.h | 4 +- .../ReactNativeFeatureFlags.config.js | 10 ---- .../featureflags/ReactNativeFeatureFlags.js | 7 +-- .../specs/NativeReactNativeFeatureFlags.js | 3 +- 22 files changed, 30 insertions(+), 189 deletions(-) diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index ac3c6ba9043..69e8a088065 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -6600,7 +6600,6 @@ public class com/facebook/react/views/textinput/ReactEditText : androidx/appcomp public fun onTextContextMenuItem (I)Z public fun onTouchEvent (Landroid/view/MotionEvent;)Z public fun removeTextChangedListener (Landroid/text/TextWatcher;)V - public fun requestFocus (ILandroid/graphics/Rect;)Z public final fun requestFocusFromJS ()V public final fun setAllowFontScaling (Z)V public final fun setAutoFocus (Z)V diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt index 2ccc7ca1af9..b54d7faf251 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<991cfdadfc26e470da425a986d75c766>> + * @generated SignedSource<> */ /** @@ -258,12 +258,6 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun useAlwaysAvailableJSErrorHandling(): Boolean = accessor.useAlwaysAvailableJSErrorHandling() - /** - * If true, focusing in ReactEditText will mainly use stock Android requestFocus() behavior. If false it will use legacy custom focus behavior. - */ - @JvmStatic - public fun useEditTextStockAndroidFocusBehavior(): Boolean = accessor.useEditTextStockAndroidFocusBehavior() - /** * Should this application enable the Fabric Interop Layer for Android? If yes, the application will behave so that it can accept non-Fabric components and render them on Fabric. This toggle is controlling extra logic such as custom event dispatching that are needed for the Fabric Interop Layer to work correctly. */ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt index bab2cb1e257..85f9f05f999 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<65268cf15face782370694a2a5bd8c3f>> + * @generated SignedSource<<9c1e0e7e87aead96e2554ef5ecf9e7af>> */ /** @@ -58,7 +58,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null private var updateRuntimeShadowNodeReferencesOnCommitCache: Boolean? = null private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null - private var useEditTextStockAndroidFocusBehaviorCache: Boolean? = null private var useFabricInteropCache: Boolean? = null private var useNativeViewConfigsInBridgelessModeCache: Boolean? = null private var useOptimizedEventBatchingOnAndroidCache: Boolean? = null @@ -409,15 +408,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces return cached } - override fun useEditTextStockAndroidFocusBehavior(): Boolean { - var cached = useEditTextStockAndroidFocusBehaviorCache - if (cached == null) { - cached = ReactNativeFeatureFlagsCxxInterop.useEditTextStockAndroidFocusBehavior() - useEditTextStockAndroidFocusBehaviorCache = cached - } - return cached - } - override fun useFabricInterop(): Boolean { var cached = useFabricInteropCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt index 04d905a2673..5f6f58688df 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<6650ca57c9b43c16506ea8a95cf95b8a>> + * @generated SignedSource<> */ /** @@ -104,8 +104,6 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun useAlwaysAvailableJSErrorHandling(): Boolean - @DoNotStrip @JvmStatic public external fun useEditTextStockAndroidFocusBehavior(): Boolean - @DoNotStrip @JvmStatic public external fun useFabricInterop(): Boolean @DoNotStrip @JvmStatic public external fun useNativeViewConfigsInBridgelessMode(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt index 50e0e32dbce..5df17cda4dd 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<906ab78c1c4099bc4711c102885becd0>> + * @generated SignedSource<> */ /** @@ -99,8 +99,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun useAlwaysAvailableJSErrorHandling(): Boolean = false - override fun useEditTextStockAndroidFocusBehavior(): Boolean = true - override fun useFabricInterop(): Boolean = true override fun useNativeViewConfigsInBridgelessMode(): Boolean = false diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt index 53ac861f467..9f45b7d5fb8 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<5b145ee103cf6b40e13d33c88cd52777>> */ /** @@ -62,7 +62,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null private var updateRuntimeShadowNodeReferencesOnCommitCache: Boolean? = null private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null - private var useEditTextStockAndroidFocusBehaviorCache: Boolean? = null private var useFabricInteropCache: Boolean? = null private var useNativeViewConfigsInBridgelessModeCache: Boolean? = null private var useOptimizedEventBatchingOnAndroidCache: Boolean? = null @@ -451,16 +450,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc return cached } - override fun useEditTextStockAndroidFocusBehavior(): Boolean { - var cached = useEditTextStockAndroidFocusBehaviorCache - if (cached == null) { - cached = currentProvider.useEditTextStockAndroidFocusBehavior() - accessedFeatureFlags.add("useEditTextStockAndroidFocusBehavior") - useEditTextStockAndroidFocusBehaviorCache = cached - } - return cached - } - override fun useFabricInterop(): Boolean { var cached = useFabricInteropCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt index 42815da7857..b3ce0e12bc9 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<9cdb965a420d53cf36b6531684cb07ae>> */ /** @@ -99,8 +99,6 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun useAlwaysAvailableJSErrorHandling(): Boolean - @DoNotStrip public fun useEditTextStockAndroidFocusBehavior(): Boolean - @DoNotStrip public fun useFabricInterop(): Boolean @DoNotStrip public fun useNativeViewConfigsInBridgelessMode(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt index 2936dd005c8..639b3d3a876 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt @@ -47,7 +47,6 @@ import com.facebook.react.bridge.ReactSoftExceptionLogger.logSoftException import com.facebook.react.common.ReactConstants import com.facebook.react.common.build.ReactBuildConfig import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags -import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags.useEditTextStockAndroidFocusBehavior import com.facebook.react.internal.featureflags.ReactNativeNewArchitectureFeatureFlags import com.facebook.react.uimanager.BackgroundStyleApplicator.clipToPaddingBox import com.facebook.react.uimanager.BackgroundStyleApplicator.getBackgroundColor @@ -198,10 +197,6 @@ public open class ReactEditText public constructor(context: Context) : AppCompat } init { - if (!useEditTextStockAndroidFocusBehavior()) { - isFocusableInTouchMode = false - } - inputMethodManager = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager defaultGravityHorizontal = @@ -240,8 +235,7 @@ public open class ReactEditText public constructor(context: Context) : AppCompat // selection on accessibility click to undo that. setSelection(length) } - return if (useEditTextStockAndroidFocusBehavior()) requestFocusProgrammatically() - else requestFocusInternal() + return requestFocusProgrammatically() } return super.performAccessibilityAction(host, action, args) } @@ -366,38 +360,10 @@ public open class ReactEditText public constructor(context: Context) : AppCompat if (id == android.R.id.paste) android.R.id.pasteAsPlainText else id) override fun clearFocus() { - val useStockFocusBehavior = useEditTextStockAndroidFocusBehavior() - if (!useStockFocusBehavior) { - isFocusableInTouchMode = false - } super.clearFocus() hideSoftKeyboard() } - override fun requestFocus(direction: Int, previouslyFocusedRect: Rect?): Boolean = - // This is a no-op so that when the OS calls requestFocus(), nothing will happen. - // ReactEditText - // is a controlled component, which means its focus is controlled by JS, with two exceptions: - // autofocus when it's attached to the window, and responding to accessibility events. In both - // of these cases, we call requestFocusInternal() directly. - if (useEditTextStockAndroidFocusBehavior()) { - super.requestFocus(direction, previouslyFocusedRect) - } else { - isFocused - } - - private fun requestFocusInternal(): Boolean { - isFocusableInTouchMode = true - // We must explicitly call this method on the super class; if we call requestFocus() without - // any arguments, it will call into the overridden requestFocus(int, Rect) above, which no-ops. - val focused = super.requestFocus(FOCUS_DOWN, null) - if (showSoftInputOnFocus) { - showSoftKeyboard() - } - - return focused - } - // For cases like autoFocus, or ref.focus() where we request focus programmatically and not // through // interacting with the EditText directly (like clicking on it). We cannot use stock @@ -629,11 +595,7 @@ public open class ReactEditText public constructor(context: Context) : AppCompat } public fun requestFocusFromJS() { - if (useEditTextStockAndroidFocusBehavior()) { - requestFocusProgrammatically() - } else { - requestFocusInternal() - } + requestFocusProgrammatically() } internal fun clearFocusFromJS() { @@ -983,11 +945,7 @@ public open class ReactEditText public constructor(context: Context) : AppCompat } if (autoFocus && !didAttachToWindow) { - if (useEditTextStockAndroidFocusBehavior()) { - requestFocusProgrammatically() - } else { - requestFocusInternal() - } + requestFocusProgrammatically() } didAttachToWindow = true diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp index e4655540d76..b575f3a26c7 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<65232e117b548982fd5c59502599b1bb>> + * @generated SignedSource<> */ /** @@ -267,12 +267,6 @@ class ReactNativeFeatureFlagsJavaProvider return method(javaProvider_); } - bool useEditTextStockAndroidFocusBehavior() override { - static const auto method = - getReactNativeFeatureFlagsProviderJavaClass()->getMethod("useEditTextStockAndroidFocusBehavior"); - return method(javaProvider_); - } - bool useFabricInterop() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("useFabricInterop"); @@ -509,11 +503,6 @@ bool JReactNativeFeatureFlagsCxxInterop::useAlwaysAvailableJSErrorHandling( return ReactNativeFeatureFlags::useAlwaysAvailableJSErrorHandling(); } -bool JReactNativeFeatureFlagsCxxInterop::useEditTextStockAndroidFocusBehavior( - facebook::jni::alias_ref /*unused*/) { - return ReactNativeFeatureFlags::useEditTextStockAndroidFocusBehavior(); -} - bool JReactNativeFeatureFlagsCxxInterop::useFabricInterop( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::useFabricInterop(); @@ -694,9 +683,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "useAlwaysAvailableJSErrorHandling", JReactNativeFeatureFlagsCxxInterop::useAlwaysAvailableJSErrorHandling), - makeNativeMethod( - "useEditTextStockAndroidFocusBehavior", - JReactNativeFeatureFlagsCxxInterop::useEditTextStockAndroidFocusBehavior), makeNativeMethod( "useFabricInterop", JReactNativeFeatureFlagsCxxInterop::useFabricInterop), diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h index 33c0872c0b2..ab831a13283 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<980b6545944b8053fbe9901d3e4746ee>> + * @generated SignedSource<<2a5ad62d2cb4f1111391f1b566e10c1d>> */ /** @@ -144,9 +144,6 @@ class JReactNativeFeatureFlagsCxxInterop static bool useAlwaysAvailableJSErrorHandling( facebook::jni::alias_ref); - static bool useEditTextStockAndroidFocusBehavior( - facebook::jni::alias_ref); - static bool useFabricInterop( facebook::jni::alias_ref); diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp index 60ddd0bde1e..4456694202a 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<7929b1ed09571f4afd84196d8c672615>> + * @generated SignedSource<<0eb63ead191be88440cbb73fd760dec7>> */ /** @@ -178,10 +178,6 @@ bool ReactNativeFeatureFlags::useAlwaysAvailableJSErrorHandling() { return getAccessor().useAlwaysAvailableJSErrorHandling(); } -bool ReactNativeFeatureFlags::useEditTextStockAndroidFocusBehavior() { - return getAccessor().useEditTextStockAndroidFocusBehavior(); -} - bool ReactNativeFeatureFlags::useFabricInterop() { return getAccessor().useFabricInterop(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index a7f842d15e3..631ac03eb06 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<0588d6b7fda4af37b3ba8ec5ad88657b>> + * @generated SignedSource<<80dcd75591a392144c2fd2817cc4408a>> */ /** @@ -229,11 +229,6 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool useAlwaysAvailableJSErrorHandling(); - /** - * If true, focusing in ReactEditText will mainly use stock Android requestFocus() behavior. If false it will use legacy custom focus behavior. - */ - RN_EXPORT static bool useEditTextStockAndroidFocusBehavior(); - /** * Should this application enable the Fabric Interop Layer for Android? If yes, the application will behave so that it can accept non-Fabric components and render them on Fabric. This toggle is controlling extra logic such as custom event dispatching that are needed for the Fabric Interop Layer to work correctly. */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index 8c56eebe7f1..8d1574a59f8 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<0c39183e7858453bfc18515be46eb17f>> */ /** @@ -713,24 +713,6 @@ bool ReactNativeFeatureFlagsAccessor::useAlwaysAvailableJSErrorHandling() { return flagValue.value(); } -bool ReactNativeFeatureFlagsAccessor::useEditTextStockAndroidFocusBehavior() { - auto flagValue = useEditTextStockAndroidFocusBehavior_.load(); - - if (!flagValue.has_value()) { - // This block is not exclusive but it is not necessary. - // If multiple threads try to initialize the feature flag, we would only - // be accessing the provider multiple times but the end state of this - // instance and the returned flag value would be the same. - - markFlagAsAccessed(38, "useEditTextStockAndroidFocusBehavior"); - - flagValue = currentProvider_->useEditTextStockAndroidFocusBehavior(); - useEditTextStockAndroidFocusBehavior_ = flagValue; - } - - return flagValue.value(); -} - bool ReactNativeFeatureFlagsAccessor::useFabricInterop() { auto flagValue = useFabricInterop_.load(); @@ -740,7 +722,7 @@ bool ReactNativeFeatureFlagsAccessor::useFabricInterop() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(39, "useFabricInterop"); + markFlagAsAccessed(38, "useFabricInterop"); flagValue = currentProvider_->useFabricInterop(); useFabricInterop_ = flagValue; @@ -758,7 +740,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(40, "useNativeViewConfigsInBridgelessMode"); + markFlagAsAccessed(39, "useNativeViewConfigsInBridgelessMode"); flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode(); useNativeViewConfigsInBridgelessMode_ = flagValue; @@ -776,7 +758,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimizedEventBatchingOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(41, "useOptimizedEventBatchingOnAndroid"); + markFlagAsAccessed(40, "useOptimizedEventBatchingOnAndroid"); flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid(); useOptimizedEventBatchingOnAndroid_ = flagValue; @@ -794,7 +776,7 @@ bool ReactNativeFeatureFlagsAccessor::useRawPropsJsiValue() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(42, "useRawPropsJsiValue"); + markFlagAsAccessed(41, "useRawPropsJsiValue"); flagValue = currentProvider_->useRawPropsJsiValue(); useRawPropsJsiValue_ = flagValue; @@ -812,7 +794,7 @@ bool ReactNativeFeatureFlagsAccessor::useShadowNodeStateOnClone() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(43, "useShadowNodeStateOnClone"); + markFlagAsAccessed(42, "useShadowNodeStateOnClone"); flagValue = currentProvider_->useShadowNodeStateOnClone(); useShadowNodeStateOnClone_ = flagValue; @@ -830,7 +812,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModuleInterop() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(44, "useTurboModuleInterop"); + markFlagAsAccessed(43, "useTurboModuleInterop"); flagValue = currentProvider_->useTurboModuleInterop(); useTurboModuleInterop_ = flagValue; @@ -848,7 +830,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModules() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(45, "useTurboModules"); + markFlagAsAccessed(44, "useTurboModules"); flagValue = currentProvider_->useTurboModules(); useTurboModules_ = flagValue; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h index b7177ce05f4..9c5f1db7f22 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<336504fac084993c9aff86f274d45342>> */ /** @@ -70,7 +70,6 @@ class ReactNativeFeatureFlagsAccessor { bool traceTurboModulePromiseRejectionsOnAndroid(); bool updateRuntimeShadowNodeReferencesOnCommit(); bool useAlwaysAvailableJSErrorHandling(); - bool useEditTextStockAndroidFocusBehavior(); bool useFabricInterop(); bool useNativeViewConfigsInBridgelessMode(); bool useOptimizedEventBatchingOnAndroid(); @@ -89,7 +88,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 46> accessedFeatureFlags_; + std::array, 45> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> animatedShouldSignalBatch_; @@ -129,7 +128,6 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> traceTurboModulePromiseRejectionsOnAndroid_; std::atomic> updateRuntimeShadowNodeReferencesOnCommit_; std::atomic> useAlwaysAvailableJSErrorHandling_; - std::atomic> useEditTextStockAndroidFocusBehavior_; std::atomic> useFabricInterop_; std::atomic> useNativeViewConfigsInBridgelessMode_; std::atomic> useOptimizedEventBatchingOnAndroid_; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index 45f19eb9137..5e8ea4a2ccd 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<3d6301ade77a134895cf5ba0499f50b8>> + * @generated SignedSource<<825294594363fb672b6cd64eaa954dd4>> */ /** @@ -179,10 +179,6 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return false; } - bool useEditTextStockAndroidFocusBehavior() override { - return true; - } - bool useFabricInterop() override { return true; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h index cfac1d2dcd2..de2b15cdeb3 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<3684edcb7df20ae270d101504da667ed>> + * @generated SignedSource<> */ /** @@ -387,15 +387,6 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef return ReactNativeFeatureFlagsDefaults::useAlwaysAvailableJSErrorHandling(); } - bool useEditTextStockAndroidFocusBehavior() override { - auto value = values_["useEditTextStockAndroidFocusBehavior"]; - if (!value.isNull()) { - return value.getBool(); - } - - return ReactNativeFeatureFlagsDefaults::useEditTextStockAndroidFocusBehavior(); - } - bool useFabricInterop() override { auto value = values_["useFabricInterop"]; if (!value.isNull()) { diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index f4a020082af..641e52aa31b 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<490d765da7ce24dc5bc87643c3ec0793>> + * @generated SignedSource<<905f26c85dc731205b1a6f44c4e32468>> */ /** @@ -63,7 +63,6 @@ class ReactNativeFeatureFlagsProvider { virtual bool traceTurboModulePromiseRejectionsOnAndroid() = 0; virtual bool updateRuntimeShadowNodeReferencesOnCommit() = 0; virtual bool useAlwaysAvailableJSErrorHandling() = 0; - virtual bool useEditTextStockAndroidFocusBehavior() = 0; virtual bool useFabricInterop() = 0; virtual bool useNativeViewConfigsInBridgelessMode() = 0; virtual bool useOptimizedEventBatchingOnAndroid() = 0; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index 1e328d7c796..f3a1d555024 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<614814062283858cf70138a2ac3d6304>> */ /** @@ -234,11 +234,6 @@ bool NativeReactNativeFeatureFlags::useAlwaysAvailableJSErrorHandling( return ReactNativeFeatureFlags::useAlwaysAvailableJSErrorHandling(); } -bool NativeReactNativeFeatureFlags::useEditTextStockAndroidFocusBehavior( - jsi::Runtime& /*runtime*/) { - return ReactNativeFeatureFlags::useEditTextStockAndroidFocusBehavior(); -} - bool NativeReactNativeFeatureFlags::useFabricInterop( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::useFabricInterop(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index f66f66cb074..c871564ef62 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<8497861e92cb78ab7b2bae7ac3c3e200>> + * @generated SignedSource<<1c0248c3eda43cc89a61b3e3ff8b4345>> */ /** @@ -113,8 +113,6 @@ class NativeReactNativeFeatureFlags bool useAlwaysAvailableJSErrorHandling(jsi::Runtime& runtime); - bool useEditTextStockAndroidFocusBehavior(jsi::Runtime& runtime); - bool useFabricInterop(jsi::Runtime& runtime); bool useNativeViewConfigsInBridgelessMode(jsi::Runtime& runtime); diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index 6b99dd05511..f066ecb5d75 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -446,16 +446,6 @@ const definitions: FeatureFlagDefinitions = { }, ossReleaseStage: 'none', }, - useEditTextStockAndroidFocusBehavior: { - defaultValue: true, - metadata: { - description: - 'If true, focusing in ReactEditText will mainly use stock Android requestFocus() behavior. If false it will use legacy custom focus behavior.', - expectedReleaseValue: true, - purpose: 'release', - }, - ossReleaseStage: 'none', - }, useFabricInterop: { defaultValue: true, metadata: { diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index fe2b0cbaefe..c850347fb05 100644 --- a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<9aead6f81a34e5c7ad93ebceed4dad54>> + * @generated SignedSource<> * @flow strict */ @@ -84,7 +84,6 @@ export type ReactNativeFeatureFlags = $ReadOnly<{ traceTurboModulePromiseRejectionsOnAndroid: Getter, updateRuntimeShadowNodeReferencesOnCommit: Getter, useAlwaysAvailableJSErrorHandling: Getter, - useEditTextStockAndroidFocusBehavior: Getter, useFabricInterop: Getter, useNativeViewConfigsInBridgelessMode: Getter, useOptimizedEventBatchingOnAndroid: Getter, @@ -310,10 +309,6 @@ export const updateRuntimeShadowNodeReferencesOnCommit: Getter = create * In Bridgeless mode, use the always available javascript error reporting pipeline. */ export const useAlwaysAvailableJSErrorHandling: Getter = createNativeFlagGetter('useAlwaysAvailableJSErrorHandling', false); -/** - * If true, focusing in ReactEditText will mainly use stock Android requestFocus() behavior. If false it will use legacy custom focus behavior. - */ -export const useEditTextStockAndroidFocusBehavior: Getter = createNativeFlagGetter('useEditTextStockAndroidFocusBehavior', true); /** * Should this application enable the Fabric Interop Layer for Android? If yes, the application will behave so that it can accept non-Fabric components and render them on Fabric. This toggle is controlling extra logic such as custom event dispatching that are needed for the Fabric Interop Layer to work correctly. */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index 9d73b241880..223a2924345 100644 --- a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<715d2a137ded85479120f5090c05b3b6>> * @flow strict */ @@ -62,7 +62,6 @@ export interface Spec extends TurboModule { +traceTurboModulePromiseRejectionsOnAndroid?: () => boolean; +updateRuntimeShadowNodeReferencesOnCommit?: () => boolean; +useAlwaysAvailableJSErrorHandling?: () => boolean; - +useEditTextStockAndroidFocusBehavior?: () => boolean; +useFabricInterop?: () => boolean; +useNativeViewConfigsInBridgelessMode?: () => boolean; +useOptimizedEventBatchingOnAndroid?: () => boolean;