mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 22:10:14 +00:00
Cleanup "setAndroidLayoutDirection" (#47736)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47736 This has been 100% enabled in production across all the apps for more than a month, after an experiment a long time ago, and we kinda depend on it now for correct border drawing in some cases. Let's clean it up! Changelog: [Internal] Reviewed By: joevilches Differential Revision: D66208418 fbshipit-source-id: 582a38bd84a2d085ba5c4aac4cd478680dd206cc
This commit is contained in:
parent
a865975ce3
commit
e88974f199
@ -7028,11 +7028,10 @@ public abstract interface class com/facebook/react/views/scroll/ReactScrollViewH
|
||||
}
|
||||
|
||||
public final class com/facebook/react/views/scroll/ReactScrollViewHelper$ReactScrollViewScrollState {
|
||||
public fun <init> (I)V
|
||||
public fun <init> ()V
|
||||
public final fun getDecelerationRate ()F
|
||||
public final fun getFinalAnimatedPositionScroll ()Landroid/graphics/Point;
|
||||
public final fun getLastStateUpdateScroll ()Landroid/graphics/Point;
|
||||
public final fun getLayoutDirection ()I
|
||||
public final fun getScrollAwayPaddingTop ()I
|
||||
public final fun isCanceled ()Z
|
||||
public final fun isFinished ()Z
|
||||
|
@ -800,12 +800,10 @@ public class SurfaceMountingManager {
|
||||
throw new IllegalStateException("Unable to find View for tag: " + reactTag);
|
||||
}
|
||||
|
||||
if (ReactNativeFeatureFlags.setAndroidLayoutDirection()) {
|
||||
viewToUpdate.setLayoutDirection(
|
||||
layoutDirection == 1
|
||||
? View.LAYOUT_DIRECTION_LTR
|
||||
: layoutDirection == 2 ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_INHERIT);
|
||||
}
|
||||
viewToUpdate.setLayoutDirection(
|
||||
layoutDirection == 1
|
||||
? View.LAYOUT_DIRECTION_LTR
|
||||
: layoutDirection == 2 ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_INHERIT);
|
||||
|
||||
// Even though we have exact dimensions, we still call measure because some platform views (e.g.
|
||||
// Switch) assume that method will always be called before onLayout and onDraw. They use it to
|
||||
|
@ -153,15 +153,9 @@ final class IntBufferBatchMountItem implements BatchMountItem {
|
||||
int width = mIntBuffer[i++];
|
||||
int height = mIntBuffer[i++];
|
||||
int displayType = mIntBuffer[i++];
|
||||
|
||||
if (ReactNativeFeatureFlags.setAndroidLayoutDirection()) {
|
||||
int layoutDirection = mIntBuffer[i++];
|
||||
surfaceMountingManager.updateLayout(
|
||||
reactTag, parentTag, x, y, width, height, displayType, layoutDirection);
|
||||
} else {
|
||||
surfaceMountingManager.updateLayout(
|
||||
reactTag, parentTag, x, y, width, height, displayType, 0);
|
||||
}
|
||||
int layoutDirection = mIntBuffer[i++];
|
||||
surfaceMountingManager.updateLayout(
|
||||
reactTag, parentTag, x, y, width, height, displayType, layoutDirection);
|
||||
} else if (type == INSTRUCTION_UPDATE_PADDING) {
|
||||
surfaceMountingManager.updatePadding(
|
||||
mIntBuffer[i++], mIntBuffer[i++], mIntBuffer[i++], mIntBuffer[i++], mIntBuffer[i++]);
|
||||
@ -251,8 +245,7 @@ final class IntBufferBatchMountItem implements BatchMountItem {
|
||||
int w = mIntBuffer[i++];
|
||||
int h = mIntBuffer[i++];
|
||||
int displayType = mIntBuffer[i++];
|
||||
int layoutDirection =
|
||||
ReactNativeFeatureFlags.setAndroidLayoutDirection() ? mIntBuffer[i++] : 0;
|
||||
int layoutDirection = mIntBuffer[i++];
|
||||
s.append(
|
||||
String.format(
|
||||
"UPDATE LAYOUT [%d]->[%d]: x:%d y:%d w:%d h:%d displayType:%d layoutDirection:"
|
||||
|
@ -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<<124e8e4892062fa63a9a70ae0c53653d>>
|
||||
* @generated SignedSource<<b1ad8179cf22c2e97f623435bf152aab>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -238,12 +238,6 @@ public object ReactNativeFeatureFlags {
|
||||
@JvmStatic
|
||||
public fun loadVectorDrawablesOnImages(): Boolean = accessor.loadVectorDrawablesOnImages()
|
||||
|
||||
/**
|
||||
* Propagate layout direction to Android views.
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun setAndroidLayoutDirection(): Boolean = accessor.setAndroidLayoutDirection()
|
||||
|
||||
/**
|
||||
* Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause.
|
||||
*/
|
||||
|
@ -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<<28da40176c64703dcab4bc0d1af078a8>>
|
||||
* @generated SignedSource<<7dd21b62dfe429aecdbd179cb482fb26>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -55,7 +55,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
|
||||
private var initEagerTurboModulesOnNativeModulesQueueAndroidCache: Boolean? = null
|
||||
private var lazyAnimationCallbacksCache: Boolean? = null
|
||||
private var loadVectorDrawablesOnImagesCache: Boolean? = null
|
||||
private var setAndroidLayoutDirectionCache: Boolean? = null
|
||||
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
|
||||
private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null
|
||||
private var useFabricInteropCache: Boolean? = null
|
||||
@ -382,15 +381,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun setAndroidLayoutDirection(): Boolean {
|
||||
var cached = setAndroidLayoutDirectionCache
|
||||
if (cached == null) {
|
||||
cached = ReactNativeFeatureFlagsCxxInterop.setAndroidLayoutDirection()
|
||||
setAndroidLayoutDirectionCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean {
|
||||
var cached = traceTurboModulePromiseRejectionsOnAndroidCache
|
||||
if (cached == null) {
|
||||
|
@ -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<<e53c4f66b6261f983ad1502adc31f1dc>>
|
||||
* @generated SignedSource<<fcfded14a5fe05501892993c1f58f3ed>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -98,8 +98,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun loadVectorDrawablesOnImages(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun setAndroidLayoutDirection(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun useAlwaysAvailableJSErrorHandling(): Boolean
|
||||
|
@ -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<<3d25d7b8ee194721c39fb5eb5eda87d4>>
|
||||
* @generated SignedSource<<86d8dd894e80a788af7f47172d30d33c>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -93,8 +93,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
|
||||
|
||||
override fun loadVectorDrawablesOnImages(): Boolean = false
|
||||
|
||||
override fun setAndroidLayoutDirection(): Boolean = true
|
||||
|
||||
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean = false
|
||||
|
||||
override fun useAlwaysAvailableJSErrorHandling(): Boolean = false
|
||||
|
@ -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<<fb8747b040cd9c29e9ca0a7c1647ad91>>
|
||||
* @generated SignedSource<<4bb5173b9ba1d3e620f3a7d613b27ac7>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -59,7 +59,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
|
||||
private var initEagerTurboModulesOnNativeModulesQueueAndroidCache: Boolean? = null
|
||||
private var lazyAnimationCallbacksCache: Boolean? = null
|
||||
private var loadVectorDrawablesOnImagesCache: Boolean? = null
|
||||
private var setAndroidLayoutDirectionCache: Boolean? = null
|
||||
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
|
||||
private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null
|
||||
private var useFabricInteropCache: Boolean? = null
|
||||
@ -421,16 +420,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun setAndroidLayoutDirection(): Boolean {
|
||||
var cached = setAndroidLayoutDirectionCache
|
||||
if (cached == null) {
|
||||
cached = currentProvider.setAndroidLayoutDirection()
|
||||
accessedFeatureFlags.add("setAndroidLayoutDirection")
|
||||
setAndroidLayoutDirectionCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean {
|
||||
var cached = traceTurboModulePromiseRejectionsOnAndroidCache
|
||||
if (cached == null) {
|
||||
|
@ -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<<24bae6a173c941923c84f418a114ec2f>>
|
||||
* @generated SignedSource<<2217f2b9992c9424c3d1d221bdfa2236>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -93,8 +93,6 @@ public interface ReactNativeFeatureFlagsProvider {
|
||||
|
||||
@DoNotStrip public fun loadVectorDrawablesOnImages(): Boolean
|
||||
|
||||
@DoNotStrip public fun setAndroidLayoutDirection(): Boolean
|
||||
|
||||
@DoNotStrip public fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean
|
||||
|
||||
@DoNotStrip public fun useAlwaysAvailableJSErrorHandling(): Boolean
|
||||
|
@ -27,7 +27,6 @@ import com.facebook.react.bridge.RetryableMountingLayerException;
|
||||
import com.facebook.react.bridge.SoftAssertions;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
|
||||
import com.facebook.react.touch.JSResponderHandler;
|
||||
import com.facebook.react.uimanager.layoutanimation.LayoutAnimationController;
|
||||
import com.facebook.react.uimanager.layoutanimation.LayoutAnimationListener;
|
||||
@ -178,9 +177,7 @@ public class NativeViewHierarchyManager {
|
||||
try {
|
||||
View viewToUpdate = resolveView(tag);
|
||||
|
||||
if (ReactNativeFeatureFlags.setAndroidLayoutDirection()) {
|
||||
viewToUpdate.setLayoutDirection(LayoutDirectionUtil.toAndroidFromYoga(layoutDirection));
|
||||
}
|
||||
viewToUpdate.setLayoutDirection(LayoutDirectionUtil.toAndroidFromYoga(layoutDirection));
|
||||
|
||||
// Even though we have exact dimensions, we still call measure because some platform views
|
||||
// (e.g.
|
||||
|
@ -37,8 +37,6 @@ import com.facebook.react.animated.NativeAnimatedModule;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
|
||||
import com.facebook.react.modules.i18nmanager.I18nUtil;
|
||||
import com.facebook.react.uimanager.BackgroundStyleApplicator;
|
||||
import com.facebook.react.uimanager.LengthPercentage;
|
||||
import com.facebook.react.uimanager.LengthPercentageType;
|
||||
@ -139,13 +137,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
|
||||
ViewCompat.setAccessibilityDelegate(this, new ReactScrollViewAccessibilityDelegate());
|
||||
|
||||
mScroller = getOverScrollerFromParent();
|
||||
mReactScrollViewScrollState =
|
||||
new ReactScrollViewScrollState(
|
||||
// TODO: The ScrollView content may be laid out in a different direction than the
|
||||
// instance if the `direction` style is set on the ScrollView or above it.
|
||||
I18nUtil.getInstance().isRTL(context)
|
||||
? ViewCompat.LAYOUT_DIRECTION_RTL
|
||||
: ViewCompat.LAYOUT_DIRECTION_LTR);
|
||||
mReactScrollViewScrollState = new ReactScrollViewScrollState();
|
||||
|
||||
setOnHierarchyChangeListener(this);
|
||||
setClipChildren(false);
|
||||
@ -1088,13 +1080,9 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
|
||||
int firstOffset = 0;
|
||||
int lastOffset = maximumOffset;
|
||||
int width = getWidth() - ViewCompat.getPaddingStart(this) - ViewCompat.getPaddingEnd(this);
|
||||
int layoutDirection =
|
||||
ReactNativeFeatureFlags.setAndroidLayoutDirection()
|
||||
? getLayoutDirection()
|
||||
: mReactScrollViewScrollState.getLayoutDirection();
|
||||
|
||||
// offsets are from the right edge in RTL layouts
|
||||
if (layoutDirection == LAYOUT_DIRECTION_RTL) {
|
||||
if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
|
||||
targetOffset = maximumOffset - targetOffset;
|
||||
velocityX = -velocityX;
|
||||
}
|
||||
@ -1184,7 +1172,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
|
||||
// if scrolling after the last snap offset and snapping to the
|
||||
// end of the list is disabled, then we allow free scrolling
|
||||
int currentOffset = getScrollX();
|
||||
if (layoutDirection == LAYOUT_DIRECTION_RTL) {
|
||||
if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
|
||||
currentOffset = maximumOffset - currentOffset;
|
||||
}
|
||||
if (!mSnapToEnd && targetOffset >= lastOffset) {
|
||||
@ -1224,7 +1212,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
|
||||
// Make sure the new offset isn't out of bounds
|
||||
targetOffset = Math.min(Math.max(0, targetOffset), maximumOffset);
|
||||
|
||||
if (layoutDirection == LAYOUT_DIRECTION_RTL) {
|
||||
if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
|
||||
targetOffset = maximumOffset - targetOffset;
|
||||
velocityX = -velocityX;
|
||||
}
|
||||
@ -1423,11 +1411,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
|
||||
// does not shift layout. If `maintainVisibleContentPosition` is enabled, we try to adjust
|
||||
// position so that the viewport keeps the same insets to previously visible views. TODO: MVCP
|
||||
// does not work in RTL.
|
||||
int layoutDirection =
|
||||
ReactNativeFeatureFlags.setAndroidLayoutDirection()
|
||||
? v.getLayoutDirection()
|
||||
: mReactScrollViewScrollState.getLayoutDirection();
|
||||
if (layoutDirection == LAYOUT_DIRECTION_RTL) {
|
||||
if (v.getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
|
||||
adjustPositionForContentChangeRTL(left, right, oldLeft, oldRight);
|
||||
} else if (mMaintainVisibleContentPositionHelper != null) {
|
||||
mMaintainVisibleContentPositionHelper.updateScrollPosition();
|
||||
|
@ -119,7 +119,7 @@ public class ReactScrollView extends ScrollView
|
||||
private int pendingContentOffsetY = UNSET_CONTENT_OFFSET;
|
||||
private @Nullable StateWrapper mStateWrapper = null;
|
||||
private final ReactScrollViewScrollState mReactScrollViewScrollState =
|
||||
new ReactScrollViewScrollState(ViewCompat.LAYOUT_DIRECTION_LTR);
|
||||
new ReactScrollViewScrollState();
|
||||
private final ValueAnimator DEFAULT_FLING_ANIMATOR = ObjectAnimator.ofInt(this, "scrollY", 0, 0);
|
||||
private PointerEvents mPointerEvents = PointerEvents.AUTO;
|
||||
private long mLastScrollDispatchTime = 0;
|
||||
|
@ -331,25 +331,9 @@ public object ReactScrollViewHelper {
|
||||
val scrollPos = scrollState.lastStateUpdateScroll
|
||||
val scrollX = scrollPos.x
|
||||
val scrollY = scrollPos.y
|
||||
val layoutDirection = scrollState.layoutDirection
|
||||
val fabricScrollX =
|
||||
if (layoutDirection == View.LAYOUT_DIRECTION_RTL) {
|
||||
// getScrollX returns offset from left even when layout direction is RTL.
|
||||
// The following line calculates offset from right.
|
||||
val child = scrollView.getChildAt(0)
|
||||
val contentWidth = child?.width ?: 0
|
||||
-(contentWidth - scrollX - scrollView.width)
|
||||
} else {
|
||||
scrollX
|
||||
}
|
||||
if (DEBUG_MODE) {
|
||||
FLog.i(
|
||||
TAG,
|
||||
"updateFabricScrollState[%d] scrollX %d scrollY %d fabricScrollX %d",
|
||||
scrollView.id,
|
||||
scrollX,
|
||||
scrollY,
|
||||
fabricScrollX)
|
||||
TAG, "updateFabricScrollState[%d] scrollX %d scrollY %d", scrollView.id, scrollX, scrollY)
|
||||
}
|
||||
val stateWrapper = scrollView.stateWrapper
|
||||
if (stateWrapper != null) {
|
||||
@ -507,13 +491,7 @@ public object ReactScrollViewHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public class ReactScrollViewScrollState(
|
||||
/**
|
||||
* Get the layout direction. Can be either scrollView.LAYOUT_DIRECTION_RTL (1) or
|
||||
* scrollView.LAYOUT_DIRECTION_LTR (0). If the value is -1, it means unknown layout.
|
||||
*/
|
||||
public val layoutDirection: Int
|
||||
) {
|
||||
public class ReactScrollViewScrollState() {
|
||||
|
||||
/** Get the position after current animation is finished */
|
||||
public val finalAnimatedPositionScroll: Point = Point()
|
||||
|
@ -63,9 +63,7 @@ inline int getIntBufferSizeForType(CppMountItem::Type mountItemType) {
|
||||
case CppMountItem::Type::UpdatePadding:
|
||||
return 5; // tag, top, left, bottom, right
|
||||
case CppMountItem::Type::UpdateLayout:
|
||||
return ReactNativeFeatureFlags::setAndroidLayoutDirection()
|
||||
? 8 // tag, parentTag, x, y, w, h, DisplayType, LayoutDirection
|
||||
: 7; // tag, parentTag, x, y, w, h, DisplayType
|
||||
return 8; // tag, parentTag, x, y, w, h, DisplayType, LayoutDirection
|
||||
case CppMountItem::Type::UpdateOverflowInset:
|
||||
return 5; // tag, left, top, right, bottom
|
||||
case CppMountItem::Undefined:
|
||||
@ -377,26 +375,15 @@ inline void writeUpdateLayoutMountItem(
|
||||
int w = round(scale(frame.size.width, pointScaleFactor));
|
||||
int h = round(scale(frame.size.height, pointScaleFactor));
|
||||
|
||||
if (ReactNativeFeatureFlags::setAndroidLayoutDirection()) {
|
||||
buffer.writeIntArray(std::array<int, 8>{
|
||||
mountItem.newChildShadowView.tag,
|
||||
mountItem.parentShadowView.tag,
|
||||
x,
|
||||
y,
|
||||
w,
|
||||
h,
|
||||
toInt(layoutMetrics.displayType),
|
||||
toInt(layoutMetrics.layoutDirection)});
|
||||
} else {
|
||||
buffer.writeIntArray(std::array<int, 7>{
|
||||
mountItem.newChildShadowView.tag,
|
||||
mountItem.parentShadowView.tag,
|
||||
x,
|
||||
y,
|
||||
w,
|
||||
h,
|
||||
toInt(layoutMetrics.displayType)});
|
||||
}
|
||||
buffer.writeIntArray(std::array<int, 8>{
|
||||
mountItem.newChildShadowView.tag,
|
||||
mountItem.parentShadowView.tag,
|
||||
x,
|
||||
y,
|
||||
w,
|
||||
h,
|
||||
toInt(layoutMetrics.displayType),
|
||||
toInt(layoutMetrics.layoutDirection)});
|
||||
}
|
||||
|
||||
inline void writeUpdateEventEmitterMountItem(
|
||||
|
@ -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<<17da000ed077668a52a4dacba88162b0>>
|
||||
* @generated SignedSource<<d5ccaecdf8cc2cf6144409658d9076ae>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -249,12 +249,6 @@ class ReactNativeFeatureFlagsProviderHolder
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool setAndroidLayoutDirection() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("setAndroidLayoutDirection");
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool traceTurboModulePromiseRejectionsOnAndroid() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("traceTurboModulePromiseRejectionsOnAndroid");
|
||||
@ -494,11 +488,6 @@ bool JReactNativeFeatureFlagsCxxInterop::loadVectorDrawablesOnImages(
|
||||
return ReactNativeFeatureFlags::loadVectorDrawablesOnImages();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::setAndroidLayoutDirection(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::setAndroidLayoutDirection();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::traceTurboModulePromiseRejectionsOnAndroid(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid();
|
||||
@ -685,9 +674,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
|
||||
makeNativeMethod(
|
||||
"loadVectorDrawablesOnImages",
|
||||
JReactNativeFeatureFlagsCxxInterop::loadVectorDrawablesOnImages),
|
||||
makeNativeMethod(
|
||||
"setAndroidLayoutDirection",
|
||||
JReactNativeFeatureFlagsCxxInterop::setAndroidLayoutDirection),
|
||||
makeNativeMethod(
|
||||
"traceTurboModulePromiseRejectionsOnAndroid",
|
||||
JReactNativeFeatureFlagsCxxInterop::traceTurboModulePromiseRejectionsOnAndroid),
|
||||
|
@ -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<<20fa39ef7b31222a0a34e131d60e6bec>>
|
||||
* @generated SignedSource<<0b07eaeba8112f65ecb18d53b7b893af>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -135,9 +135,6 @@ class JReactNativeFeatureFlagsCxxInterop
|
||||
static bool loadVectorDrawablesOnImages(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool setAndroidLayoutDirection(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool traceTurboModulePromiseRejectionsOnAndroid(
|
||||
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<<cfa6f544c0bcb190836329d8f597efc6>>
|
||||
* @generated SignedSource<<90e3ea3abb6f13c711aec3754ab03126>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -166,10 +166,6 @@ bool ReactNativeFeatureFlags::loadVectorDrawablesOnImages() {
|
||||
return getAccessor().loadVectorDrawablesOnImages();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlags::setAndroidLayoutDirection() {
|
||||
return getAccessor().setAndroidLayoutDirection();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid() {
|
||||
return getAccessor().traceTurboModulePromiseRejectionsOnAndroid();
|
||||
}
|
||||
|
@ -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<<0c0217362f582ac635d5f46347e65252>>
|
||||
* @generated SignedSource<<4544b1e206765808859ef84c2e6333a9>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -214,11 +214,6 @@ class ReactNativeFeatureFlags {
|
||||
*/
|
||||
RN_EXPORT static bool loadVectorDrawablesOnImages();
|
||||
|
||||
/**
|
||||
* Propagate layout direction to Android views.
|
||||
*/
|
||||
RN_EXPORT static bool setAndroidLayoutDirection();
|
||||
|
||||
/**
|
||||
* Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause.
|
||||
*/
|
||||
|
@ -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<<aacc5f6cbb2cc7e0eae9beee9b6abceb>>
|
||||
* @generated SignedSource<<cd77cfb18c0099b88035ff42fcd2dd46>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -659,24 +659,6 @@ bool ReactNativeFeatureFlagsAccessor::loadVectorDrawablesOnImages() {
|
||||
return flagValue.value();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlagsAccessor::setAndroidLayoutDirection() {
|
||||
auto flagValue = setAndroidLayoutDirection_.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(35, "setAndroidLayoutDirection");
|
||||
|
||||
flagValue = currentProvider_->setAndroidLayoutDirection();
|
||||
setAndroidLayoutDirection_ = flagValue;
|
||||
}
|
||||
|
||||
return flagValue.value();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlagsAccessor::traceTurboModulePromiseRejectionsOnAndroid() {
|
||||
auto flagValue = traceTurboModulePromiseRejectionsOnAndroid_.load();
|
||||
|
||||
@ -686,7 +668,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(36, "traceTurboModulePromiseRejectionsOnAndroid");
|
||||
markFlagAsAccessed(35, "traceTurboModulePromiseRejectionsOnAndroid");
|
||||
|
||||
flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid();
|
||||
traceTurboModulePromiseRejectionsOnAndroid_ = flagValue;
|
||||
@ -704,7 +686,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(37, "useAlwaysAvailableJSErrorHandling");
|
||||
markFlagAsAccessed(36, "useAlwaysAvailableJSErrorHandling");
|
||||
|
||||
flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling();
|
||||
useAlwaysAvailableJSErrorHandling_ = flagValue;
|
||||
@ -722,7 +704,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(38, "useFabricInterop");
|
||||
markFlagAsAccessed(37, "useFabricInterop");
|
||||
|
||||
flagValue = currentProvider_->useFabricInterop();
|
||||
useFabricInterop_ = flagValue;
|
||||
@ -740,7 +722,7 @@ bool ReactNativeFeatureFlagsAccessor::useImmediateExecutorInAndroidBridgeless()
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(39, "useImmediateExecutorInAndroidBridgeless");
|
||||
markFlagAsAccessed(38, "useImmediateExecutorInAndroidBridgeless");
|
||||
|
||||
flagValue = currentProvider_->useImmediateExecutorInAndroidBridgeless();
|
||||
useImmediateExecutorInAndroidBridgeless_ = 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::useOptimisedViewPreallocationOnAndroid() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(41, "useOptimisedViewPreallocationOnAndroid");
|
||||
markFlagAsAccessed(40, "useOptimisedViewPreallocationOnAndroid");
|
||||
|
||||
flagValue = currentProvider_->useOptimisedViewPreallocationOnAndroid();
|
||||
useOptimisedViewPreallocationOnAndroid_ = flagValue;
|
||||
@ -794,7 +776,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(42, "useOptimizedEventBatchingOnAndroid");
|
||||
markFlagAsAccessed(41, "useOptimizedEventBatchingOnAndroid");
|
||||
|
||||
flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid();
|
||||
useOptimizedEventBatchingOnAndroid_ = flagValue;
|
||||
@ -812,7 +794,7 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdate() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(43, "useRuntimeShadowNodeReferenceUpdate");
|
||||
markFlagAsAccessed(42, "useRuntimeShadowNodeReferenceUpdate");
|
||||
|
||||
flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdate();
|
||||
useRuntimeShadowNodeReferenceUpdate_ = 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;
|
||||
|
@ -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<<bc9b07f2b54079d3ebb4cfd536b079bc>>
|
||||
* @generated SignedSource<<6f11d494553e3f12b2ca326a880746f3>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -67,7 +67,6 @@ class ReactNativeFeatureFlagsAccessor {
|
||||
bool initEagerTurboModulesOnNativeModulesQueueAndroid();
|
||||
bool lazyAnimationCallbacks();
|
||||
bool loadVectorDrawablesOnImages();
|
||||
bool setAndroidLayoutDirection();
|
||||
bool traceTurboModulePromiseRejectionsOnAndroid();
|
||||
bool useAlwaysAvailableJSErrorHandling();
|
||||
bool useFabricInterop();
|
||||
@ -89,7 +88,7 @@ class ReactNativeFeatureFlagsAccessor {
|
||||
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
|
||||
bool wasOverridden_;
|
||||
|
||||
std::array<std::atomic<const char*>, 46> accessedFeatureFlags_;
|
||||
std::array<std::atomic<const char*>, 45> accessedFeatureFlags_;
|
||||
|
||||
std::atomic<std::optional<bool>> commonTestFlag_;
|
||||
std::atomic<std::optional<bool>> completeReactInstanceCreationOnBgThreadOnAndroid_;
|
||||
@ -126,7 +125,6 @@ class ReactNativeFeatureFlagsAccessor {
|
||||
std::atomic<std::optional<bool>> initEagerTurboModulesOnNativeModulesQueueAndroid_;
|
||||
std::atomic<std::optional<bool>> lazyAnimationCallbacks_;
|
||||
std::atomic<std::optional<bool>> loadVectorDrawablesOnImages_;
|
||||
std::atomic<std::optional<bool>> setAndroidLayoutDirection_;
|
||||
std::atomic<std::optional<bool>> traceTurboModulePromiseRejectionsOnAndroid_;
|
||||
std::atomic<std::optional<bool>> useAlwaysAvailableJSErrorHandling_;
|
||||
std::atomic<std::optional<bool>> useFabricInterop_;
|
||||
|
@ -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<<0f27ce54a52c9fbefa1a8b55a291d07e>>
|
||||
* @generated SignedSource<<213e1ad83360a79e27d41c06e20fb8c9>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -167,10 +167,6 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool setAndroidLayoutDirection() override {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool traceTurboModulePromiseRejectionsOnAndroid() override {
|
||||
return false;
|
||||
}
|
||||
|
@ -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<<7e933dbc3a9b39a024de073288397430>>
|
||||
* @generated SignedSource<<5b2b2aba574e77851ad214809ead9228>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -60,7 +60,6 @@ class ReactNativeFeatureFlagsProvider {
|
||||
virtual bool initEagerTurboModulesOnNativeModulesQueueAndroid() = 0;
|
||||
virtual bool lazyAnimationCallbacks() = 0;
|
||||
virtual bool loadVectorDrawablesOnImages() = 0;
|
||||
virtual bool setAndroidLayoutDirection() = 0;
|
||||
virtual bool traceTurboModulePromiseRejectionsOnAndroid() = 0;
|
||||
virtual bool useAlwaysAvailableJSErrorHandling() = 0;
|
||||
virtual bool useFabricInterop() = 0;
|
||||
|
@ -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<<4fe3b8f579c6db6093e4b1b732bd392a>>
|
||||
* @generated SignedSource<<aeb742608efce797a86b73e243a62d0c>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -219,11 +219,6 @@ bool NativeReactNativeFeatureFlags::loadVectorDrawablesOnImages(
|
||||
return ReactNativeFeatureFlags::loadVectorDrawablesOnImages();
|
||||
}
|
||||
|
||||
bool NativeReactNativeFeatureFlags::setAndroidLayoutDirection(
|
||||
jsi::Runtime& /*runtime*/) {
|
||||
return ReactNativeFeatureFlags::setAndroidLayoutDirection();
|
||||
}
|
||||
|
||||
bool NativeReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid(
|
||||
jsi::Runtime& /*runtime*/) {
|
||||
return ReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid();
|
||||
|
@ -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<<895944e81ecdf7f1df63bfa9ebe52b13>>
|
||||
* @generated SignedSource<<b42cf9d00bd5b0d01f3d14b633771201>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -107,8 +107,6 @@ class NativeReactNativeFeatureFlags
|
||||
|
||||
bool loadVectorDrawablesOnImages(jsi::Runtime& runtime);
|
||||
|
||||
bool setAndroidLayoutDirection(jsi::Runtime& runtime);
|
||||
|
||||
bool traceTurboModulePromiseRejectionsOnAndroid(jsi::Runtime& runtime);
|
||||
|
||||
bool useAlwaysAvailableJSErrorHandling(jsi::Runtime& runtime);
|
||||
|
@ -343,14 +343,6 @@ const definitions: FeatureFlagDefinitions = {
|
||||
purpose: 'experimentation',
|
||||
},
|
||||
},
|
||||
setAndroidLayoutDirection: {
|
||||
defaultValue: true,
|
||||
metadata: {
|
||||
dateAdded: '2024-05-17',
|
||||
description: 'Propagate layout direction to Android views.',
|
||||
purpose: 'experimentation',
|
||||
},
|
||||
},
|
||||
traceTurboModulePromiseRejectionsOnAndroid: {
|
||||
defaultValue: false,
|
||||
metadata: {
|
||||
|
@ -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<<d7715d63338e96f5842026458a3b69c8>>
|
||||
* @generated SignedSource<<ce07f8091a19d5b479350f7a3b05067b>>
|
||||
* @flow strict
|
||||
*/
|
||||
|
||||
@ -87,7 +87,6 @@ export type ReactNativeFeatureFlags = {
|
||||
initEagerTurboModulesOnNativeModulesQueueAndroid: Getter<boolean>,
|
||||
lazyAnimationCallbacks: Getter<boolean>,
|
||||
loadVectorDrawablesOnImages: Getter<boolean>,
|
||||
setAndroidLayoutDirection: Getter<boolean>,
|
||||
traceTurboModulePromiseRejectionsOnAndroid: Getter<boolean>,
|
||||
useAlwaysAvailableJSErrorHandling: Getter<boolean>,
|
||||
useFabricInterop: Getter<boolean>,
|
||||
@ -334,10 +333,6 @@ export const lazyAnimationCallbacks: Getter<boolean> = createNativeFlagGetter('l
|
||||
* Adds support for loading vector drawable assets in the Image component (only on Android)
|
||||
*/
|
||||
export const loadVectorDrawablesOnImages: Getter<boolean> = createNativeFlagGetter('loadVectorDrawablesOnImages', false);
|
||||
/**
|
||||
* Propagate layout direction to Android views.
|
||||
*/
|
||||
export const setAndroidLayoutDirection: Getter<boolean> = createNativeFlagGetter('setAndroidLayoutDirection', true);
|
||||
/**
|
||||
* Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause.
|
||||
*/
|
||||
|
@ -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<<ced421dd8531e9a074999a1cdb5e4a16>>
|
||||
* @generated SignedSource<<4caaf5dbaa68614ce53c8aecbd512df8>>
|
||||
* @flow strict
|
||||
*/
|
||||
|
||||
@ -59,7 +59,6 @@ export interface Spec extends TurboModule {
|
||||
+initEagerTurboModulesOnNativeModulesQueueAndroid?: () => boolean;
|
||||
+lazyAnimationCallbacks?: () => boolean;
|
||||
+loadVectorDrawablesOnImages?: () => boolean;
|
||||
+setAndroidLayoutDirection?: () => boolean;
|
||||
+traceTurboModulePromiseRejectionsOnAndroid?: () => boolean;
|
||||
+useAlwaysAvailableJSErrorHandling?: () => boolean;
|
||||
+useFabricInterop?: () => boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user