Skip to content

Commit

Permalink
Cleanup enableEventEmitterRetentionDuringGesturesOnAndroid feature fl…
Browse files Browse the repository at this point in the history
…ag (facebook#49590)

Summary:

This feature flag was used to validate a fix for handling of events during
gesture on pressable. It can now be removed as the flag has been set to true for several
internal app (Twilight among others) for several months.

Changelog:
[Internal] [Changed] -

Reviewed By: javache

Differential Revision: D69983235
  • Loading branch information
cortinico authored and facebook-github-bot committed Feb 21, 2025
1 parent bd8c197 commit d6adcaf
Show file tree
Hide file tree
Showing 24 changed files with 56 additions and 197 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ public object DefaultNewArchitectureEntryPoint {

override fun enableFabricRenderer(): Boolean = bridgelessEnabled || fabricEnabled

// We turn this feature flag to true for OSS to fix #44610 and #45126 and other
// similar bugs related to pressable.
override fun enableEventEmitterRetentionDuringGesturesOnAndroid(): Boolean =
bridgelessEnabled || fabricEnabled

override fun useTurboModules(): Boolean = bridgelessEnabled || turboModulesEnabled
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,7 @@ public void deleteView(int reactTag) {
return;
}

if (ReactNativeFeatureFlags.enableEventEmitterRetentionDuringGesturesOnAndroid()
&& mViewsWithActiveTouches.contains(reactTag)) {
if (mViewsWithActiveTouches.contains(reactTag)) {
// If the view that went offscreen is still being touched, we can't delete it yet.
// We have to delay the deletion till the touch is completed.
// This is causing bugs like those otherwise:
Expand Down Expand Up @@ -1180,16 +1179,10 @@ public void run() {
}

public void markActiveTouchForTag(int reactTag) {
if (!ReactNativeFeatureFlags.enableEventEmitterRetentionDuringGesturesOnAndroid()) {
return;
}
mViewsWithActiveTouches.add(reactTag);
}

public void sweepActiveTouchForTag(int reactTag) {
if (!ReactNativeFeatureFlags.enableEventEmitterRetentionDuringGesturesOnAndroid()) {
return;
}
mViewsWithActiveTouches.remove(reactTag);
if (mViewsToDeleteAfterTouchFinishes.contains(reactTag)) {
mViewsToDeleteAfterTouchFinishes.remove(reactTag);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<6e8144a48ab65f3b5ad8dd601cee2114>>
* @generated SignedSource<<4558ccf6c50d565ffdbb33aa5470261d>>
*/

/**
Expand Down Expand Up @@ -64,12 +64,6 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enableEagerRootViewAttachment(): Boolean = accessor.enableEagerRootViewAttachment()

/**
* Enables the retention of EventEmitterWrapper on Android till the touch gesture is over to fix a bug on pressable (#44610)
*/
@JvmStatic
public fun enableEventEmitterRetentionDuringGesturesOnAndroid(): Boolean = accessor.enableEventEmitterRetentionDuringGesturesOnAndroid()

/**
* This feature flag enables logs for Fabric.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<dd2fa7d4fb722350d77094f8bcc38872>>
* @generated SignedSource<<7aacac604f39305d7374b4396f81d013>>
*/

/**
Expand All @@ -26,7 +26,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var enableBridgelessArchitectureCache: Boolean? = null
private var enableCppPropsIteratorSetterCache: Boolean? = null
private var enableEagerRootViewAttachmentCache: Boolean? = null
private var enableEventEmitterRetentionDuringGesturesOnAndroidCache: Boolean? = null
private var enableFabricLogsCache: Boolean? = null
private var enableFabricRendererCache: Boolean? = null
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
Expand Down Expand Up @@ -117,15 +116,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

override fun enableEventEmitterRetentionDuringGesturesOnAndroid(): Boolean {
var cached = enableEventEmitterRetentionDuringGesturesOnAndroidCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableEventEmitterRetentionDuringGesturesOnAndroid()
enableEventEmitterRetentionDuringGesturesOnAndroidCache = cached
}
return cached
}

override fun enableFabricLogs(): Boolean {
var cached = enableFabricLogsCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<eb52a136ba489460c2131105f4cc5b3f>>
* @generated SignedSource<<1d893a8a1636357f73ee76011fa31b04>>
*/

/**
Expand Down Expand Up @@ -40,8 +40,6 @@ public object ReactNativeFeatureFlagsCxxInterop {

@DoNotStrip @JvmStatic public external fun enableEagerRootViewAttachment(): Boolean

@DoNotStrip @JvmStatic public external fun enableEventEmitterRetentionDuringGesturesOnAndroid(): Boolean

@DoNotStrip @JvmStatic public external fun enableFabricLogs(): Boolean

@DoNotStrip @JvmStatic public external fun enableFabricRenderer(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<5315bd93234b8c00b7d029081231eeeb>>
* @generated SignedSource<<66fc8ba13c69e2f5a1f90372b6b2e94f>>
*/

/**
Expand Down Expand Up @@ -35,8 +35,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun enableEagerRootViewAttachment(): Boolean = false

override fun enableEventEmitterRetentionDuringGesturesOnAndroid(): Boolean = false

override fun enableFabricLogs(): Boolean = false

override fun enableFabricRenderer(): Boolean = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<a97afc0515bcfc2e4ed60565af08ce8a>>
* @generated SignedSource<<b0313560bc4d5f3eeedeee0a7d929cd0>>
*/

/**
Expand All @@ -30,7 +30,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var enableBridgelessArchitectureCache: Boolean? = null
private var enableCppPropsIteratorSetterCache: Boolean? = null
private var enableEagerRootViewAttachmentCache: Boolean? = null
private var enableEventEmitterRetentionDuringGesturesOnAndroidCache: Boolean? = null
private var enableFabricLogsCache: Boolean? = null
private var enableFabricRendererCache: Boolean? = null
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
Expand Down Expand Up @@ -127,16 +126,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

override fun enableEventEmitterRetentionDuringGesturesOnAndroid(): Boolean {
var cached = enableEventEmitterRetentionDuringGesturesOnAndroidCache
if (cached == null) {
cached = currentProvider.enableEventEmitterRetentionDuringGesturesOnAndroid()
accessedFeatureFlags.add("enableEventEmitterRetentionDuringGesturesOnAndroid")
enableEventEmitterRetentionDuringGesturesOnAndroidCache = cached
}
return cached
}

override fun enableFabricLogs(): Boolean {
var cached = enableFabricLogsCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<51121a77716b7748f993496eff5f6bfb>>
* @generated SignedSource<<1a774b2ea19f08ad20dc7e486e23898b>>
*/

/**
Expand Down Expand Up @@ -35,8 +35,6 @@ public interface ReactNativeFeatureFlagsProvider {

@DoNotStrip public fun enableEagerRootViewAttachment(): Boolean

@DoNotStrip public fun enableEventEmitterRetentionDuringGesturesOnAndroid(): Boolean

@DoNotStrip public fun enableFabricLogs(): Boolean

@DoNotStrip public fun enableFabricRenderer(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ public open class ReactNativeNewArchitectureFeatureFlagsDefaults(
) : ReactNativeFeatureFlagsDefaults() {
override fun enableBridgelessArchitecture(): Boolean = newArchitectureEnabled

// We turn this feature flag to true to fix #44610 and #45126 and other
// similar bugs related to pressable.
override fun enableEventEmitterRetentionDuringGesturesOnAndroid(): Boolean =
newArchitectureEnabled

override fun enableFabricRenderer(): Boolean = newArchitectureEnabled

override fun useFabricInterop(): Boolean = newArchitectureEnabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.UIManager;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
import com.facebook.react.uimanager.common.UIManagerType;
import com.facebook.react.uimanager.events.EventDispatcher;
import com.facebook.react.uimanager.events.TouchEvent;
Expand Down Expand Up @@ -192,9 +191,6 @@ public void handleTouchEvent(

private void markActiveTouchForTag(
int surfaceId, int reactTag, @Nullable ReactContext reactContext) {
if (!ReactNativeFeatureFlags.enableEventEmitterRetentionDuringGesturesOnAndroid()) {
return;
}
if (reactContext == null) {
return;
}
Expand All @@ -206,9 +202,6 @@ private void markActiveTouchForTag(

private void sweepActiveTouchForTag(
int surfaceId, int reactTag, @Nullable ReactContext reactContext) {
if (!ReactNativeFeatureFlags.enableEventEmitterRetentionDuringGesturesOnAndroid()) {
return;
}
if (reactContext == null) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<b0dab4690bff769baf4e83f508a6e514>>
* @generated SignedSource<<aec9501e32ed78797a6d8cbe1c989dbe>>
*/

/**
Expand Down Expand Up @@ -75,12 +75,6 @@ class ReactNativeFeatureFlagsProviderHolder
return method(javaProvider_);
}

bool enableEventEmitterRetentionDuringGesturesOnAndroid() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableEventEmitterRetentionDuringGesturesOnAndroid");
return method(javaProvider_);
}

bool enableFabricLogs() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableFabricLogs");
Expand Down Expand Up @@ -325,11 +319,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableEagerRootViewAttachment(
return ReactNativeFeatureFlags::enableEagerRootViewAttachment();
}

bool JReactNativeFeatureFlagsCxxInterop::enableEventEmitterRetentionDuringGesturesOnAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableEventEmitterRetentionDuringGesturesOnAndroid();
}

bool JReactNativeFeatureFlagsCxxInterop::enableFabricLogs(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableFabricLogs();
Expand Down Expand Up @@ -554,9 +543,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enableEagerRootViewAttachment",
JReactNativeFeatureFlagsCxxInterop::enableEagerRootViewAttachment),
makeNativeMethod(
"enableEventEmitterRetentionDuringGesturesOnAndroid",
JReactNativeFeatureFlagsCxxInterop::enableEventEmitterRetentionDuringGesturesOnAndroid),
makeNativeMethod(
"enableFabricLogs",
JReactNativeFeatureFlagsCxxInterop::enableFabricLogs),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<0bf1c23eda1c41a60eaae19e87c541e9>>
* @generated SignedSource<<58c8d8e8d63463a2dead66042b877378>>
*/

/**
Expand Down Expand Up @@ -48,9 +48,6 @@ class JReactNativeFeatureFlagsCxxInterop
static bool enableEagerRootViewAttachment(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool enableEventEmitterRetentionDuringGesturesOnAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool enableFabricLogs(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<0a3119b99e455127d8a404963a23eb96>>
* @generated SignedSource<<5eb8bf78f457c44ae514b706bf23265e>>
*/

/**
Expand Down Expand Up @@ -50,10 +50,6 @@ bool ReactNativeFeatureFlags::enableEagerRootViewAttachment() {
return getAccessor().enableEagerRootViewAttachment();
}

bool ReactNativeFeatureFlags::enableEventEmitterRetentionDuringGesturesOnAndroid() {
return getAccessor().enableEventEmitterRetentionDuringGesturesOnAndroid();
}

bool ReactNativeFeatureFlags::enableFabricLogs() {
return getAccessor().enableFabricLogs();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<b354e1b9ffc58e74ffff200c14728d1d>>
* @generated SignedSource<<6733084994ad357b1deab51d39ab8914>>
*/

/**
Expand Down Expand Up @@ -69,11 +69,6 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool enableEagerRootViewAttachment();

/**
* Enables the retention of EventEmitterWrapper on Android till the touch gesture is over to fix a bug on pressable (#44610)
*/
RN_EXPORT static bool enableEventEmitterRetentionDuringGesturesOnAndroid();

/**
* This feature flag enables logs for Fabric.
*/
Expand Down
Loading

0 comments on commit d6adcaf

Please # to comment.