mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Move ReactNativeFeatureFlags to src/private (#52610)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52610 This diff removes `ReactNativeFeatureFlags` from `react-native/Libraries/ReactNative` and migrates `shouldPressibilityUseW3CPointerEventsForHover` to common `ReactNativeFeatureFlags` in `src/private/featureflags`. The `shouldEmitW3CPointerEvents is removed as it is used in `rn-tester` to hide some examples. Changelog: [General][Breaking] - Migrate `shouldPressibilityUseW3CPointerEventsForHover` to common private feature flags and remove `shouldEmitW3CPointerEvents` flag. Reviewed By: robhogan Differential Revision: D75448698 fbshipit-source-id: 03942c9504b855f2054c9a5948c0521ce17365b5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
730a0d5aef
commit
fb4587780e
@@ -16,8 +16,8 @@ import type {
|
||||
MouseEvent,
|
||||
} from '../Types/CoreEventTypes';
|
||||
|
||||
import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
|
||||
import SoundManager from '../Components/Sound/SoundManager';
|
||||
import ReactNativeFeatureFlags from '../ReactNative/ReactNativeFeatureFlags';
|
||||
import UIManager from '../ReactNative/UIManager';
|
||||
import {type RectOrSize, normalizeRect} from '../StyleSheet/Rect';
|
||||
import {type PointerEvent} from '../Types/CoreEventTypes';
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict
|
||||
* @format
|
||||
*/
|
||||
|
||||
export type FeatureFlags = {
|
||||
/**
|
||||
* Function used to enable / disable W3C pointer event emitting in React Native.
|
||||
* If enabled you must also flip the equivalent native flags on each platform:
|
||||
* iOS -> RCTSetDispatchW3CPointerEvents
|
||||
* Android -> ReactFeatureFlags.dispatchPointerEvents
|
||||
*/
|
||||
shouldEmitW3CPointerEvents: () => boolean,
|
||||
/**
|
||||
* Function used to enable / disable Pressibility from using W3C Pointer Events
|
||||
* for its hover callbacks
|
||||
*/
|
||||
shouldPressibilityUseW3CPointerEventsForHover: () => boolean,
|
||||
};
|
||||
|
||||
const ReactNativeFeatureFlags: FeatureFlags = {
|
||||
shouldEmitW3CPointerEvents: () => false,
|
||||
shouldPressibilityUseW3CPointerEventsForHover: () => false,
|
||||
};
|
||||
|
||||
export default ReactNativeFeatureFlags;
|
||||
+7
-1
@@ -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<<6f50c9b7a356260abf8afc022aba8fc2>>
|
||||
* @generated SignedSource<<ebfa5c471b394293aebdb37c6b679903>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -324,6 +324,12 @@ public object ReactNativeFeatureFlags {
|
||||
@JvmStatic
|
||||
public fun releaseImageDataWhenConsumed(): Boolean = accessor.releaseImageDataWhenConsumed()
|
||||
|
||||
/**
|
||||
* Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean = accessor.shouldPressibilityUseW3CPointerEventsForHover()
|
||||
|
||||
/**
|
||||
* Skip activity identity assertion in ReactHostImpl::onHostPause()
|
||||
*/
|
||||
|
||||
+11
-1
@@ -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<<d442e14a9a0f7f5dd2cdbabac34c8415>>
|
||||
* @generated SignedSource<<e00a0a927d72346f532a561faa53f5d4>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -69,6 +69,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
||||
private var preparedTextCacheSizeCache: Double? = null
|
||||
private var preventShadowTreeCommitExhaustionWithLockingCache: Boolean? = null
|
||||
private var releaseImageDataWhenConsumedCache: Boolean? = null
|
||||
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
|
||||
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
|
||||
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
|
||||
private var updateRuntimeShadowNodeReferencesOnCommitCache: Boolean? = null
|
||||
@@ -525,6 +526,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean {
|
||||
var cached = shouldPressibilityUseW3CPointerEventsForHoverCache
|
||||
if (cached == null) {
|
||||
cached = ReactNativeFeatureFlagsCxxInterop.shouldPressibilityUseW3CPointerEventsForHover()
|
||||
shouldPressibilityUseW3CPointerEventsForHoverCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun skipActivityIdentityAssertionOnHostPause(): Boolean {
|
||||
var cached = skipActivityIdentityAssertionOnHostPauseCache
|
||||
if (cached == null) {
|
||||
|
||||
+3
-1
@@ -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<<eb4ba3fd4ce8434f993793febcb8d481>>
|
||||
* @generated SignedSource<<cca36c1bf21945b7a44ff33e77fa1e50>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -126,6 +126,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun releaseImageDataWhenConsumed(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun skipActivityIdentityAssertionOnHostPause(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean
|
||||
|
||||
+3
-1
@@ -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<<ed1b41e080f0575aff6891aa4fadddce>>
|
||||
* @generated SignedSource<<1c1ae67a283926bd5da1c5ddad875810>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -121,6 +121,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
|
||||
|
||||
override fun releaseImageDataWhenConsumed(): Boolean = false
|
||||
|
||||
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean = false
|
||||
|
||||
override fun skipActivityIdentityAssertionOnHostPause(): Boolean = false
|
||||
|
||||
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean = false
|
||||
|
||||
+12
-1
@@ -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<<1c4bee4de12fc3e38a09f2ddf9b39601>>
|
||||
* @generated SignedSource<<4c1cfcf144eb98e871358413340a7651>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -73,6 +73,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
|
||||
private var preparedTextCacheSizeCache: Double? = null
|
||||
private var preventShadowTreeCommitExhaustionWithLockingCache: Boolean? = null
|
||||
private var releaseImageDataWhenConsumedCache: Boolean? = null
|
||||
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
|
||||
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
|
||||
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
|
||||
private var updateRuntimeShadowNodeReferencesOnCommitCache: Boolean? = null
|
||||
@@ -578,6 +579,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean {
|
||||
var cached = shouldPressibilityUseW3CPointerEventsForHoverCache
|
||||
if (cached == null) {
|
||||
cached = currentProvider.shouldPressibilityUseW3CPointerEventsForHover()
|
||||
accessedFeatureFlags.add("shouldPressibilityUseW3CPointerEventsForHover")
|
||||
shouldPressibilityUseW3CPointerEventsForHoverCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun skipActivityIdentityAssertionOnHostPause(): Boolean {
|
||||
var cached = skipActivityIdentityAssertionOnHostPauseCache
|
||||
if (cached == null) {
|
||||
|
||||
+3
-1
@@ -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<<366629baac4727e7db4042a8e9dcab93>>
|
||||
* @generated SignedSource<<02df7850c3578fb7d033038e517e7cef>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -121,6 +121,8 @@ public interface ReactNativeFeatureFlagsProvider {
|
||||
|
||||
@DoNotStrip public fun releaseImageDataWhenConsumed(): Boolean
|
||||
|
||||
@DoNotStrip public fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
|
||||
|
||||
@DoNotStrip public fun skipActivityIdentityAssertionOnHostPause(): Boolean
|
||||
|
||||
@DoNotStrip public fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean
|
||||
|
||||
+15
-1
@@ -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<<1ec5b2dea32e6f318622cb24a9d66ef2>>
|
||||
* @generated SignedSource<<dd77d71fb46a3015fd6705b9a3520f1e>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -333,6 +333,12 @@ class ReactNativeFeatureFlagsJavaProvider
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool shouldPressibilityUseW3CPointerEventsForHover() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("shouldPressibilityUseW3CPointerEventsForHover");
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool skipActivityIdentityAssertionOnHostPause() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("skipActivityIdentityAssertionOnHostPause");
|
||||
@@ -666,6 +672,11 @@ bool JReactNativeFeatureFlagsCxxInterop::releaseImageDataWhenConsumed(
|
||||
return ReactNativeFeatureFlags::releaseImageDataWhenConsumed();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::shouldPressibilityUseW3CPointerEventsForHover(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::skipActivityIdentityAssertionOnHostPause(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::skipActivityIdentityAssertionOnHostPause();
|
||||
@@ -914,6 +925,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
|
||||
makeNativeMethod(
|
||||
"releaseImageDataWhenConsumed",
|
||||
JReactNativeFeatureFlagsCxxInterop::releaseImageDataWhenConsumed),
|
||||
makeNativeMethod(
|
||||
"shouldPressibilityUseW3CPointerEventsForHover",
|
||||
JReactNativeFeatureFlagsCxxInterop::shouldPressibilityUseW3CPointerEventsForHover),
|
||||
makeNativeMethod(
|
||||
"skipActivityIdentityAssertionOnHostPause",
|
||||
JReactNativeFeatureFlagsCxxInterop::skipActivityIdentityAssertionOnHostPause),
|
||||
|
||||
+4
-1
@@ -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<<3570d50c3ff20d976b7145c0c36fd6ac>>
|
||||
* @generated SignedSource<<956c5e2083b578aea5289299939d2e5c>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -177,6 +177,9 @@ class JReactNativeFeatureFlagsCxxInterop
|
||||
static bool releaseImageDataWhenConsumed(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool shouldPressibilityUseW3CPointerEventsForHover(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool skipActivityIdentityAssertionOnHostPause(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
|
||||
@@ -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<<1c8a4501d6e0d7d0b162283cbbdf6a87>>
|
||||
* @generated SignedSource<<9aa9bee329a282a5acffebdd0fe10aff>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -222,6 +222,10 @@ bool ReactNativeFeatureFlags::releaseImageDataWhenConsumed() {
|
||||
return getAccessor().releaseImageDataWhenConsumed();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover() {
|
||||
return getAccessor().shouldPressibilityUseW3CPointerEventsForHover();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlags::skipActivityIdentityAssertionOnHostPause() {
|
||||
return getAccessor().skipActivityIdentityAssertionOnHostPause();
|
||||
}
|
||||
|
||||
@@ -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<<3edca00b84d9b4d30c7d9bf5a8dee039>>
|
||||
* @generated SignedSource<<c1517df16c88db5d1ecab53a0368891e>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -284,6 +284,11 @@ class ReactNativeFeatureFlags {
|
||||
*/
|
||||
RN_EXPORT static bool releaseImageDataWhenConsumed();
|
||||
|
||||
/**
|
||||
* Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks
|
||||
*/
|
||||
RN_EXPORT static bool shouldPressibilityUseW3CPointerEventsForHover();
|
||||
|
||||
/**
|
||||
* Skip activity identity assertion in ReactHostImpl::onHostPause()
|
||||
*/
|
||||
|
||||
+33
-15
@@ -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<<5149f256e2692114e5d4b4efb839589a>>
|
||||
* @generated SignedSource<<9b38f912e401b970753bf59ce58601e7>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -911,6 +911,24 @@ bool ReactNativeFeatureFlagsAccessor::releaseImageDataWhenConsumed() {
|
||||
return flagValue.value();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlagsAccessor::shouldPressibilityUseW3CPointerEventsForHover() {
|
||||
auto flagValue = shouldPressibilityUseW3CPointerEventsForHover_.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(49, "shouldPressibilityUseW3CPointerEventsForHover");
|
||||
|
||||
flagValue = currentProvider_->shouldPressibilityUseW3CPointerEventsForHover();
|
||||
shouldPressibilityUseW3CPointerEventsForHover_ = flagValue;
|
||||
}
|
||||
|
||||
return flagValue.value();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlagsAccessor::skipActivityIdentityAssertionOnHostPause() {
|
||||
auto flagValue = skipActivityIdentityAssertionOnHostPause_.load();
|
||||
|
||||
@@ -920,7 +938,7 @@ bool ReactNativeFeatureFlagsAccessor::skipActivityIdentityAssertionOnHostPause()
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(49, "skipActivityIdentityAssertionOnHostPause");
|
||||
markFlagAsAccessed(50, "skipActivityIdentityAssertionOnHostPause");
|
||||
|
||||
flagValue = currentProvider_->skipActivityIdentityAssertionOnHostPause();
|
||||
skipActivityIdentityAssertionOnHostPause_ = flagValue;
|
||||
@@ -938,7 +956,7 @@ bool ReactNativeFeatureFlagsAccessor::traceTurboModulePromiseRejectionsOnAndroid
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(50, "traceTurboModulePromiseRejectionsOnAndroid");
|
||||
markFlagAsAccessed(51, "traceTurboModulePromiseRejectionsOnAndroid");
|
||||
|
||||
flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid();
|
||||
traceTurboModulePromiseRejectionsOnAndroid_ = flagValue;
|
||||
@@ -956,7 +974,7 @@ bool ReactNativeFeatureFlagsAccessor::updateRuntimeShadowNodeReferencesOnCommit(
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(51, "updateRuntimeShadowNodeReferencesOnCommit");
|
||||
markFlagAsAccessed(52, "updateRuntimeShadowNodeReferencesOnCommit");
|
||||
|
||||
flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommit();
|
||||
updateRuntimeShadowNodeReferencesOnCommit_ = flagValue;
|
||||
@@ -974,7 +992,7 @@ bool ReactNativeFeatureFlagsAccessor::useAlwaysAvailableJSErrorHandling() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(52, "useAlwaysAvailableJSErrorHandling");
|
||||
markFlagAsAccessed(53, "useAlwaysAvailableJSErrorHandling");
|
||||
|
||||
flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling();
|
||||
useAlwaysAvailableJSErrorHandling_ = flagValue;
|
||||
@@ -992,7 +1010,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(53, "useFabricInterop");
|
||||
markFlagAsAccessed(54, "useFabricInterop");
|
||||
|
||||
flagValue = currentProvider_->useFabricInterop();
|
||||
useFabricInterop_ = flagValue;
|
||||
@@ -1010,7 +1028,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeEqualsInNativeReadableArrayAndroi
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(54, "useNativeEqualsInNativeReadableArrayAndroid");
|
||||
markFlagAsAccessed(55, "useNativeEqualsInNativeReadableArrayAndroid");
|
||||
|
||||
flagValue = currentProvider_->useNativeEqualsInNativeReadableArrayAndroid();
|
||||
useNativeEqualsInNativeReadableArrayAndroid_ = flagValue;
|
||||
@@ -1028,7 +1046,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeTransformHelperAndroid() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(55, "useNativeTransformHelperAndroid");
|
||||
markFlagAsAccessed(56, "useNativeTransformHelperAndroid");
|
||||
|
||||
flagValue = currentProvider_->useNativeTransformHelperAndroid();
|
||||
useNativeTransformHelperAndroid_ = flagValue;
|
||||
@@ -1046,7 +1064,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(56, "useNativeViewConfigsInBridgelessMode");
|
||||
markFlagAsAccessed(57, "useNativeViewConfigsInBridgelessMode");
|
||||
|
||||
flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode();
|
||||
useNativeViewConfigsInBridgelessMode_ = flagValue;
|
||||
@@ -1064,7 +1082,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(57, "useOptimizedEventBatchingOnAndroid");
|
||||
markFlagAsAccessed(58, "useOptimizedEventBatchingOnAndroid");
|
||||
|
||||
flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid();
|
||||
useOptimizedEventBatchingOnAndroid_ = flagValue;
|
||||
@@ -1082,7 +1100,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(58, "useRawPropsJsiValue");
|
||||
markFlagAsAccessed(59, "useRawPropsJsiValue");
|
||||
|
||||
flagValue = currentProvider_->useRawPropsJsiValue();
|
||||
useRawPropsJsiValue_ = flagValue;
|
||||
@@ -1100,7 +1118,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(59, "useShadowNodeStateOnClone");
|
||||
markFlagAsAccessed(60, "useShadowNodeStateOnClone");
|
||||
|
||||
flagValue = currentProvider_->useShadowNodeStateOnClone();
|
||||
useShadowNodeStateOnClone_ = flagValue;
|
||||
@@ -1118,7 +1136,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(60, "useTurboModuleInterop");
|
||||
markFlagAsAccessed(61, "useTurboModuleInterop");
|
||||
|
||||
flagValue = currentProvider_->useTurboModuleInterop();
|
||||
useTurboModuleInterop_ = flagValue;
|
||||
@@ -1136,7 +1154,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(61, "useTurboModules");
|
||||
markFlagAsAccessed(62, "useTurboModules");
|
||||
|
||||
flagValue = currentProvider_->useTurboModules();
|
||||
useTurboModules_ = flagValue;
|
||||
@@ -1154,7 +1172,7 @@ double ReactNativeFeatureFlagsAccessor::virtualViewPrerenderRatio() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(62, "virtualViewPrerenderRatio");
|
||||
markFlagAsAccessed(63, "virtualViewPrerenderRatio");
|
||||
|
||||
flagValue = currentProvider_->virtualViewPrerenderRatio();
|
||||
virtualViewPrerenderRatio_ = flagValue;
|
||||
|
||||
+4
-2
@@ -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<<f9c9fbadc2d5324efc94a17705fc6e9a>>
|
||||
* @generated SignedSource<<d58efde14af4dc22dc2079ff08f76c6a>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -81,6 +81,7 @@ class ReactNativeFeatureFlagsAccessor {
|
||||
double preparedTextCacheSize();
|
||||
bool preventShadowTreeCommitExhaustionWithLocking();
|
||||
bool releaseImageDataWhenConsumed();
|
||||
bool shouldPressibilityUseW3CPointerEventsForHover();
|
||||
bool skipActivityIdentityAssertionOnHostPause();
|
||||
bool traceTurboModulePromiseRejectionsOnAndroid();
|
||||
bool updateRuntimeShadowNodeReferencesOnCommit();
|
||||
@@ -106,7 +107,7 @@ class ReactNativeFeatureFlagsAccessor {
|
||||
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
|
||||
bool wasOverridden_;
|
||||
|
||||
std::array<std::atomic<const char*>, 63> accessedFeatureFlags_;
|
||||
std::array<std::atomic<const char*>, 64> accessedFeatureFlags_;
|
||||
|
||||
std::atomic<std::optional<bool>> commonTestFlag_;
|
||||
std::atomic<std::optional<bool>> cxxNativeAnimatedEnabled_;
|
||||
@@ -157,6 +158,7 @@ class ReactNativeFeatureFlagsAccessor {
|
||||
std::atomic<std::optional<double>> preparedTextCacheSize_;
|
||||
std::atomic<std::optional<bool>> preventShadowTreeCommitExhaustionWithLocking_;
|
||||
std::atomic<std::optional<bool>> releaseImageDataWhenConsumed_;
|
||||
std::atomic<std::optional<bool>> shouldPressibilityUseW3CPointerEventsForHover_;
|
||||
std::atomic<std::optional<bool>> skipActivityIdentityAssertionOnHostPause_;
|
||||
std::atomic<std::optional<bool>> traceTurboModulePromiseRejectionsOnAndroid_;
|
||||
std::atomic<std::optional<bool>> updateRuntimeShadowNodeReferencesOnCommit_;
|
||||
|
||||
+5
-1
@@ -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<<bd80e3802bf97fabf66e24db211bf1f4>>
|
||||
* @generated SignedSource<<b88dbe3dfa3c7899a267ac8b31a7185b>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -223,6 +223,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool shouldPressibilityUseW3CPointerEventsForHover() override {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool skipActivityIdentityAssertionOnHostPause() override {
|
||||
return false;
|
||||
}
|
||||
|
||||
+10
-1
@@ -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<<44670421b1b5991cd6af3fb7b1c1bf6c>>
|
||||
* @generated SignedSource<<04e32e131f4bd461a5fc19a3249f6068>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -486,6 +486,15 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef
|
||||
return ReactNativeFeatureFlagsDefaults::releaseImageDataWhenConsumed();
|
||||
}
|
||||
|
||||
bool shouldPressibilityUseW3CPointerEventsForHover() override {
|
||||
auto value = values_["shouldPressibilityUseW3CPointerEventsForHover"];
|
||||
if (!value.isNull()) {
|
||||
return value.getBool();
|
||||
}
|
||||
|
||||
return ReactNativeFeatureFlagsDefaults::shouldPressibilityUseW3CPointerEventsForHover();
|
||||
}
|
||||
|
||||
bool skipActivityIdentityAssertionOnHostPause() override {
|
||||
auto value = values_["skipActivityIdentityAssertionOnHostPause"];
|
||||
if (!value.isNull()) {
|
||||
|
||||
+2
-1
@@ -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<<082c6d17eec877d054193eb9dea45b6d>>
|
||||
* @generated SignedSource<<77b10024ee8f8d4494641f98d06e3086>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -74,6 +74,7 @@ class ReactNativeFeatureFlagsProvider {
|
||||
virtual double preparedTextCacheSize() = 0;
|
||||
virtual bool preventShadowTreeCommitExhaustionWithLocking() = 0;
|
||||
virtual bool releaseImageDataWhenConsumed() = 0;
|
||||
virtual bool shouldPressibilityUseW3CPointerEventsForHover() = 0;
|
||||
virtual bool skipActivityIdentityAssertionOnHostPause() = 0;
|
||||
virtual bool traceTurboModulePromiseRejectionsOnAndroid() = 0;
|
||||
virtual bool updateRuntimeShadowNodeReferencesOnCommit() = 0;
|
||||
|
||||
+6
-1
@@ -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<<5b33805daf165bd61f382354685d1d70>>
|
||||
* @generated SignedSource<<fe06eb448898f734c34e7ea7a3cac7ae>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -289,6 +289,11 @@ bool NativeReactNativeFeatureFlags::releaseImageDataWhenConsumed(
|
||||
return ReactNativeFeatureFlags::releaseImageDataWhenConsumed();
|
||||
}
|
||||
|
||||
bool NativeReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover(
|
||||
jsi::Runtime& /*runtime*/) {
|
||||
return ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover();
|
||||
}
|
||||
|
||||
bool NativeReactNativeFeatureFlags::skipActivityIdentityAssertionOnHostPause(
|
||||
jsi::Runtime& /*runtime*/) {
|
||||
return ReactNativeFeatureFlags::skipActivityIdentityAssertionOnHostPause();
|
||||
|
||||
+3
-1
@@ -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<<3487c7ee26cfd5776c85dcf6a6e7fc10>>
|
||||
* @generated SignedSource<<6bd1e1fcaff90a5588716ac2d65257e0>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -134,6 +134,8 @@ class NativeReactNativeFeatureFlags
|
||||
|
||||
bool releaseImageDataWhenConsumed(jsi::Runtime& runtime);
|
||||
|
||||
bool shouldPressibilityUseW3CPointerEventsForHover(jsi::Runtime& runtime);
|
||||
|
||||
bool skipActivityIdentityAssertionOnHostPause(jsi::Runtime& runtime);
|
||||
|
||||
bool traceTurboModulePromiseRejectionsOnAndroid(jsi::Runtime& runtime);
|
||||
|
||||
@@ -569,6 +569,16 @@ const definitions: FeatureFlagDefinitions = {
|
||||
},
|
||||
ossReleaseStage: 'none',
|
||||
},
|
||||
shouldPressibilityUseW3CPointerEventsForHover: {
|
||||
defaultValue: false,
|
||||
metadata: {
|
||||
description:
|
||||
'Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks',
|
||||
expectedReleaseValue: true,
|
||||
purpose: 'release',
|
||||
},
|
||||
ossReleaseStage: 'none',
|
||||
},
|
||||
skipActivityIdentityAssertionOnHostPause: {
|
||||
defaultValue: false,
|
||||
metadata: {
|
||||
|
||||
Vendored
+2
-2
@@ -15,8 +15,8 @@ import type {ReactDevToolsAgent} from '../../../../../Libraries/Types/ReactDevTo
|
||||
import type {InspectedElement} from './Inspector';
|
||||
|
||||
import View from '../../../../../Libraries/Components/View/View';
|
||||
import ReactNativeFeatureFlags from '../../../../../Libraries/ReactNative/ReactNativeFeatureFlags';
|
||||
import StyleSheet from '../../../../../Libraries/StyleSheet/StyleSheet';
|
||||
import * as ReactNativeFeatureFlags from '../../../../../src/private/featureflags/ReactNativeFeatureFlags';
|
||||
import ElementBox from './ElementBox';
|
||||
import * as React from 'react';
|
||||
|
||||
@@ -129,7 +129,7 @@ export default function ReactDevToolsOverlay({
|
||||
if (isInspecting) {
|
||||
const events =
|
||||
// Pointer events only work on fabric
|
||||
ReactNativeFeatureFlags.shouldEmitW3CPointerEvents()
|
||||
ReactNativeFeatureFlags.shouldPressibilityUseW3CPointerEventsForHover()
|
||||
? {
|
||||
onPointerMove,
|
||||
onPointerDown: onPointerMove,
|
||||
|
||||
@@ -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<<d06db4564bc92829c8191ecbddeb3829>>
|
||||
* @generated SignedSource<<d180e688e17001544465a37141bb59d4>>
|
||||
* @flow strict
|
||||
* @noformat
|
||||
*/
|
||||
@@ -95,6 +95,7 @@ export type ReactNativeFeatureFlags = $ReadOnly<{
|
||||
preparedTextCacheSize: Getter<number>,
|
||||
preventShadowTreeCommitExhaustionWithLocking: Getter<boolean>,
|
||||
releaseImageDataWhenConsumed: Getter<boolean>,
|
||||
shouldPressibilityUseW3CPointerEventsForHover: Getter<boolean>,
|
||||
skipActivityIdentityAssertionOnHostPause: Getter<boolean>,
|
||||
traceTurboModulePromiseRejectionsOnAndroid: Getter<boolean>,
|
||||
updateRuntimeShadowNodeReferencesOnCommit: Getter<boolean>,
|
||||
@@ -366,6 +367,10 @@ export const preventShadowTreeCommitExhaustionWithLocking: Getter<boolean> = cre
|
||||
* Releases the cached image data when it is consumed by the observers.
|
||||
*/
|
||||
export const releaseImageDataWhenConsumed: Getter<boolean> = createNativeFlagGetter('releaseImageDataWhenConsumed', false);
|
||||
/**
|
||||
* Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks
|
||||
*/
|
||||
export const shouldPressibilityUseW3CPointerEventsForHover: Getter<boolean> = createNativeFlagGetter('shouldPressibilityUseW3CPointerEventsForHover', false);
|
||||
/**
|
||||
* Skip activity identity assertion in ReactHostImpl::onHostPause()
|
||||
*/
|
||||
|
||||
+2
-1
@@ -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<<8051b5c10479f9ad92faad99586578d9>>
|
||||
* @generated SignedSource<<9a2b156d961a4da075b6a8b318252cf3>>
|
||||
* @flow strict
|
||||
* @noformat
|
||||
*/
|
||||
@@ -74,6 +74,7 @@ export interface Spec extends TurboModule {
|
||||
+preparedTextCacheSize?: () => number;
|
||||
+preventShadowTreeCommitExhaustionWithLocking?: () => boolean;
|
||||
+releaseImageDataWhenConsumed?: () => boolean;
|
||||
+shouldPressibilityUseW3CPointerEventsForHover?: () => boolean;
|
||||
+skipActivityIdentityAssertionOnHostPause?: () => boolean;
|
||||
+traceTurboModulePromiseRejectionsOnAndroid?: () => boolean;
|
||||
+updateRuntimeShadowNodeReferencesOnCommit?: () => boolean;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
import type {RNTesterModule} from '../../types/RNTesterTypes';
|
||||
|
||||
import * as PressableExampleFbInternal from './PressableExampleFbInternal';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
Alert,
|
||||
@@ -21,7 +22,6 @@ import {
|
||||
Text,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import ReactNativeFeatureFlags from 'react-native/Libraries/ReactNative/ReactNativeFeatureFlags';
|
||||
|
||||
const {useEffect, useRef, useState} = React;
|
||||
|
||||
@@ -274,25 +274,6 @@ function PressableDisabled() {
|
||||
);
|
||||
}
|
||||
|
||||
function PressableHoverStyle() {
|
||||
const [hovered, setHovered] = useState(false);
|
||||
return (
|
||||
<View style={styles.row}>
|
||||
<Pressable
|
||||
style={[
|
||||
{
|
||||
backgroundColor: hovered ? 'rgb(210, 230, 255)' : 'white',
|
||||
},
|
||||
styles.wrapperCustom,
|
||||
]}
|
||||
onHoverIn={() => setHovered(true)}
|
||||
onHoverOut={() => setHovered(false)}>
|
||||
<Text style={styles.text}>Hover Me</Text>
|
||||
</Pressable>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
row: {
|
||||
justifyContent: 'center',
|
||||
@@ -587,17 +568,9 @@ const examples = [
|
||||
return <PressableAriaLabel />;
|
||||
},
|
||||
},
|
||||
...PressableExampleFbInternal.examples,
|
||||
];
|
||||
|
||||
if (ReactNativeFeatureFlags.shouldPressibilityUseW3CPointerEventsForHover()) {
|
||||
examples.push({
|
||||
title: 'Change style based on Hover',
|
||||
render(): React.Node {
|
||||
return <PressableHoverStyle />;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = ({
|
||||
title: 'Pressable',
|
||||
documentationURL: 'https://reactnative.dev/docs/pressable',
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
|
||||
// $FlowFixMe
|
||||
export const examples: Array<any> = [];
|
||||
@@ -13,7 +13,6 @@
|
||||
import type {RNTesterModule, RNTesterModuleInfo} from '../types/RNTesterTypes';
|
||||
|
||||
import * as RNTesterListFbInternal from './RNTesterListFbInternal';
|
||||
import ReactNativeFeatureFlags from 'react-native/Libraries/ReactNative/ReactNativeFeatureFlags';
|
||||
|
||||
const Components: Array<RNTesterModuleInfo> = [
|
||||
{
|
||||
@@ -367,14 +366,6 @@ const APIs: Array<RNTesterModuleInfo> = ([
|
||||
...RNTesterListFbInternal.APIs,
|
||||
]: Array<?RNTesterModuleInfo>).filter(Boolean);
|
||||
|
||||
if (ReactNativeFeatureFlags.shouldEmitW3CPointerEvents()) {
|
||||
APIs.push({
|
||||
key: 'W3C PointerEvents',
|
||||
category: 'Experimental',
|
||||
module: require('../examples/Experimental/W3CPointerEventsExample').default,
|
||||
});
|
||||
}
|
||||
|
||||
const Playgrounds: Array<RNTesterModuleInfo> = [
|
||||
{
|
||||
key: 'PlaygroundExample',
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
import type {RNTesterModule, RNTesterModuleInfo} from '../types/RNTesterTypes';
|
||||
|
||||
import * as RNTesterListFbInternal from './RNTesterListFbInternal';
|
||||
import ReactNativeFeatureFlags from 'react-native/Libraries/ReactNative/ReactNativeFeatureFlags';
|
||||
|
||||
const Components: Array<RNTesterModuleInfo> = [
|
||||
{
|
||||
@@ -341,14 +340,6 @@ const APIs: Array<RNTesterModuleInfo> = ([
|
||||
...RNTesterListFbInternal.APIs,
|
||||
]: Array<?RNTesterModuleInfo>).filter(Boolean);
|
||||
|
||||
if (ReactNativeFeatureFlags.shouldEmitW3CPointerEvents()) {
|
||||
APIs.push({
|
||||
key: 'W3C PointerEvents',
|
||||
category: 'Experimental',
|
||||
module: require('../examples/Experimental/W3CPointerEventsExample').default,
|
||||
});
|
||||
}
|
||||
|
||||
const Playgrounds: Array<RNTesterModuleInfo> = [
|
||||
{
|
||||
key: 'PlaygroundExample',
|
||||
|
||||
Reference in New Issue
Block a user