Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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<<81b1343c027b377be3bdea9167e16a5d>>
* @generated SignedSource<<8ea15f9bb12ee59c1ed54881b7ab2799>>
*/

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

/**
* Prevents a borderless ripple feedback underlay from projecting the entire view background on Android, which could hide the background and ripple.
*/
@JvmStatic
public fun fixBorderlessRippleAndroid(): Boolean = accessor.fixBorderlessRippleAndroid()

/**
* Uses the default event priority instead of the discreet event priority by default when dispatching events from Fabric to React.
*/
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<<3e939eebe846d12cab15905db8efba18>>
* @generated SignedSource<<423f851be2b501d3fb7211859c731e74>>
*/

/**
Expand Down Expand Up @@ -77,6 +77,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var enableViewRecyclingForTextCache: Boolean? = null
private var enableViewRecyclingForViewCache: Boolean? = null
private var enableVirtualViewContainerStateExperimentalCache: Boolean? = null
private var fixBorderlessRippleAndroidCache: Boolean? = null
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
private var fixYogaFlexBasisFitContentInMainAxisCache: Boolean? = null
private var fuseboxAssertSingleHostStateCache: Boolean? = null
Expand Down Expand Up @@ -624,6 +625,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

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

override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean {
var cached = fixMappingOfEventPrioritiesBetweenFabricAndReactCache
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<<da34d40665437b2901de2ca5f0bee7c1>>
* @generated SignedSource<<15959c4c8592c5132ebcf822f776f2e8>>
*/

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

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

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

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

@DoNotStrip @JvmStatic public external fun fixYogaFlexBasisFitContentInMainAxis(): 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<<0f4c074c11c564f05950eab73a8fd452>>
* @generated SignedSource<<29635538bf32dd2455977f40eb9b1ee4>>
*/

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

override fun enableVirtualViewContainerStateExperimental(): Boolean = false

override fun fixBorderlessRippleAndroid(): Boolean = false

override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean = false

override fun fixYogaFlexBasisFitContentInMainAxis(): 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<<013790bd2c3fa8b9ff03e8c5e924bf91>>
* @generated SignedSource<<2730b5fcf6901e962f6e2efb9ebe30da>>
*/

/**
Expand Down Expand Up @@ -81,6 +81,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var enableViewRecyclingForTextCache: Boolean? = null
private var enableViewRecyclingForViewCache: Boolean? = null
private var enableVirtualViewContainerStateExperimentalCache: Boolean? = null
private var fixBorderlessRippleAndroidCache: Boolean? = null
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
private var fixYogaFlexBasisFitContentInMainAxisCache: Boolean? = null
private var fuseboxAssertSingleHostStateCache: Boolean? = null
Expand Down Expand Up @@ -685,6 +686,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

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

override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean {
var cached = fixMappingOfEventPrioritiesBetweenFabricAndReactCache
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<<843b2fa7e358dd73c9db083e42b93be6>>
* @generated SignedSource<<c82895ef7e5cee6ba387620a43aa88b8>>
*/

/**
Expand Down Expand Up @@ -33,6 +33,8 @@ public open class ReactNativeFeatureFlagsOverrides_RNOSS_Canary_Android : ReactN

override fun enableSwiftUIBasedFilters(): Boolean = true

override fun fixBorderlessRippleAndroid(): Boolean = true

override fun fuseboxFrameRecordingEnabled(): Boolean = true

override fun fuseboxWebSocketEventsEnabled(): Boolean = true
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<<6607c8678df2693c361f6d8091483662>>
* @generated SignedSource<<361dd8199f01e13cca4b5508371fcc76>>
*/

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

@DoNotStrip public fun enableVirtualViewContainerStateExperimental(): Boolean

@DoNotStrip public fun fixBorderlessRippleAndroid(): Boolean

@DoNotStrip public fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean

@DoNotStrip public fun fixYogaFlexBasisFitContentInMainAxis(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ package com.facebook.react.uimanager.drawable
import android.content.Context
import android.graphics.Outline
import android.graphics.Path
import android.graphics.Rect
import android.graphics.RectF
import android.graphics.drawable.Drawable
import android.graphics.drawable.DrawableWrapper
import android.graphics.drawable.LayerDrawable
import android.os.Build
import com.facebook.react.common.annotations.UnstableReactNativeAPI
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
import com.facebook.react.uimanager.PixelUtil.dpToPx
import com.facebook.react.uimanager.style.BorderInsets
import com.facebook.react.uimanager.style.BorderRadiusStyle
Expand Down Expand Up @@ -240,10 +243,32 @@ internal class CompositeBackgroundDrawable(
background?.let { layers.add(it) }
backgroundImage?.let { layers.add(it) }
border?.let { layers.add(it) }
feedbackUnderlay?.let { layers.add(it) }
feedbackUnderlay?.let {
layers.add(
if (ReactNativeFeatureFlags.fixBorderlessRippleAndroid()) {
UnprojectedRippleWrapper(it)
} else {
it
}
)
}
layers.addAll(innerShadows.asReversed())
outline?.let { layers.add(it) }
return layers.toTypedArray()
}
}
}

/**
* Wraps the feedback underlay so it is never reported as projected. LayerDrawable reports itself as
* projected if any layer is, so a borderless ripple in the feedback underlay would project the
* entire background, including the background color and borders, onto the nearest native ancestor's
* background. With view flattening, that ancestor may be painted under the view's flattened React
* parent, hiding the background and ripple. Ignore the underlay's projection; borderless ripples
* can still draw outside the view's bounds since React Native views don't clip their children.
*/
private class UnprojectedRippleWrapper(drawable: Drawable) : DrawableWrapper(drawable) {
override fun isProjected(): Boolean = false

override fun getDirtyBounds(): Rect = drawable?.dirtyBounds ?: super.getDirtyBounds()
}
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<<dad8d48d93f01fc5ec68f70dbd9a9e73>>
* @generated SignedSource<<6238811c274064fbbcd2839230f00b93>>
*/

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

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

bool fixMappingOfEventPrioritiesBetweenFabricAndReact() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("fixMappingOfEventPrioritiesBetweenFabricAndReact");
Expand Down Expand Up @@ -868,6 +874,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableVirtualViewContainerStateExperime
return ReactNativeFeatureFlags::enableVirtualViewContainerStateExperimental();
}

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

bool JReactNativeFeatureFlagsCxxInterop::fixMappingOfEventPrioritiesBetweenFabricAndReact(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact();
Expand Down Expand Up @@ -1235,6 +1246,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enableVirtualViewContainerStateExperimental",
JReactNativeFeatureFlagsCxxInterop::enableVirtualViewContainerStateExperimental),
makeNativeMethod(
"fixBorderlessRippleAndroid",
JReactNativeFeatureFlagsCxxInterop::fixBorderlessRippleAndroid),
makeNativeMethod(
"fixMappingOfEventPrioritiesBetweenFabricAndReact",
JReactNativeFeatureFlagsCxxInterop::fixMappingOfEventPrioritiesBetweenFabricAndReact),
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<<7a9a9c1938c3e01f589e05fffe349ad3>>
* @generated SignedSource<<cd0ad8bc1af104e98e722a94d6ddaabd>>
*/

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

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

static bool fixMappingOfEventPrioritiesBetweenFabricAndReact(
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<<8b23b6ea5f2d377f8126adffd753dae7>>
* @generated SignedSource<<18217c67d74c25b53dbf51c57225eab6>>
*/

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

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

bool ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact() {
return getAccessor().fixMappingOfEventPrioritiesBetweenFabricAndReact();
}
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<<dae6ad344267433b319e0928830e0e11>>
* @generated SignedSource<<862975d58a367fc28cd240e991ee5ff5>>
*/

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

/**
* Prevents a borderless ripple feedback underlay from projecting the entire view background on Android, which could hide the background and ripple.
*/
RN_EXPORT static bool fixBorderlessRippleAndroid();

/**
* Uses the default event priority instead of the discreet event priority by default when dispatching events from Fabric to React.
*/
Expand Down
Loading
Loading