Skip to content
Closed
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
1 change: 0 additions & 1 deletion packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -6025,7 +6025,6 @@ public abstract interface class com/facebook/react/views/scroll/VirtualView {
public final class com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout : androidx/swiperefreshlayout/widget/SwipeRefreshLayout {
public fun <init> (Lcom/facebook/react/bridge/ReactContext;)V
public fun canChildScrollUp ()Z
public fun dispatchGenericMotionEvent (Landroid/view/MotionEvent;)Z
public fun onInterceptTouchEvent (Landroid/view/MotionEvent;)Z
public fun onLayout (ZIIII)V
public fun onTouchEvent (Landroid/view/MotionEvent;)Z
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<<8cca42a9160a8a0e307a00e53cad46e8>>
* @generated SignedSource<<7a9f9d29e1d5f01df33a0893e143a6db>>
*/

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

/**
* When enabled, ReactSwipeRefreshLayout will forward ACTION_SCROLL events to its child for proper handling.
*/
@JvmStatic
public fun passScrollToSwipeRefreshChild(): Boolean = accessor.passScrollToSwipeRefreshChild()

/**
* Enable reporting Performance Issues (`detail.devtools.performanceIssue`). Displayed in the V2 Performance Monitor and the "Performance Issues" sub-panel in DevTools.
*/
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<<2adb48ad6907058ba092af9703994a57>>
* @generated SignedSource<<a0dee36eb68677b468c991297f0e95f7>>
*/

/**
Expand Down Expand Up @@ -79,7 +79,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var fuseboxNetworkInspectionEnabledCache: Boolean? = null
private var hideOffscreenVirtualViewsOnIOSCache: Boolean? = null
private var overrideBySynchronousMountPropsAtMountingAndroidCache: Boolean? = null
private var passScrollToSwipeRefreshChildCache: Boolean? = null
private var perfIssuesEnabledCache: Boolean? = null
private var perfMonitorV2EnabledCache: Boolean? = null
private var preparedTextCacheSizeCache: Double? = null
Expand Down Expand Up @@ -631,15 +630,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

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

override fun perfIssuesEnabled(): Boolean {
var cached = perfIssuesEnabledCache
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<<54ca4d2bf514ce152b2f566205716aa6>>
* @generated SignedSource<<ebb2bd0f070345e71737dab60a788a88>>
*/

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

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

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

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

@DoNotStrip @JvmStatic public external fun perfMonitorV2Enabled(): 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<<8f895394bc6263275f42c0bfa10674b4>>
* @generated SignedSource<<beceb761f215c0819c27da186138971e>>
*/

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

override fun overrideBySynchronousMountPropsAtMountingAndroid(): Boolean = false

override fun passScrollToSwipeRefreshChild(): Boolean = false

override fun perfIssuesEnabled(): Boolean = false

override fun perfMonitorV2Enabled(): 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<<45b7473c077eb6fd4c2b46712962ddbd>>
* @generated SignedSource<<44f52bff0ecd0f26c2173581b09dccce>>
*/

/**
Expand Down Expand Up @@ -83,7 +83,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var fuseboxNetworkInspectionEnabledCache: Boolean? = null
private var hideOffscreenVirtualViewsOnIOSCache: Boolean? = null
private var overrideBySynchronousMountPropsAtMountingAndroidCache: Boolean? = null
private var passScrollToSwipeRefreshChildCache: Boolean? = null
private var perfIssuesEnabledCache: Boolean? = null
private var perfMonitorV2EnabledCache: Boolean? = null
private var preparedTextCacheSizeCache: Double? = null
Expand Down Expand Up @@ -694,16 +693,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

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

override fun perfIssuesEnabled(): Boolean {
var cached = perfIssuesEnabledCache
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<<d50ebf5805d13b4da427ce1318c6cabc>>
* @generated SignedSource<<2bc1b7c78ced990301722e1c1dcc2dcf>>
*/

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

@DoNotStrip public fun overrideBySynchronousMountPropsAtMountingAndroid(): Boolean

@DoNotStrip public fun passScrollToSwipeRefreshChild(): Boolean

@DoNotStrip public fun perfIssuesEnabled(): Boolean

@DoNotStrip public fun perfMonitorV2Enabled(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,11 @@ import android.view.ViewConfiguration
import android.view.ViewGroup
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.facebook.react.bridge.ReactContext
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
import com.facebook.react.uimanager.PixelUtil
import com.facebook.react.uimanager.events.NativeGestureUtil
import kotlin.math.abs

/**
* Basic extension of [SwipeRefreshLayout] with ReactNative-specific functionality.
*
* This component wraps a scrollable child (typically a ScrollView or RecyclerView) and provides
* pull-to-refresh functionality. It handles touch event interception for the refresh gesture while
* properly forwarding other events to its children.
*/
/** Basic extension of [SwipeRefreshLayout] with ReactNative-specific functionality. */
public class ReactSwipeRefreshLayout(reactContext: ReactContext) :
SwipeRefreshLayout(reactContext) {

Expand Down Expand Up @@ -134,31 +127,6 @@ public class ReactSwipeRefreshLayout(reactContext: ReactContext) :
return true
}

/**
* Dispatches generic motion events to children.
*
* This override ensures that [MotionEvent.ACTION_SCROLL] events (from joystick, scrollwheel, or
* other pointing devices) are properly forwarded to child views.
*/
public override fun dispatchGenericMotionEvent(ev: MotionEvent): Boolean {
// For ACTION_SCROLL events, dispatch to child for handling
// The child ScrollView will use nested scrolling APIs to communicate with this
// SwipeRefreshLayout
if (
ReactNativeFeatureFlags.passScrollToSwipeRefreshChild() &&
ev.actionMasked == MotionEvent.ACTION_SCROLL
) {
val child = getChildAt(0)
if (child != null) {
val handled = child.dispatchGenericMotionEvent(ev)
if (handled) {
return true
}
}
}
return super.dispatchGenericMotionEvent(ev)
}

private companion object {
private const val DEFAULT_CIRCLE_TARGET = 64f
}
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<<77d79172d377c62d4d26ddd16dab56ec>>
* @generated SignedSource<<89d63e717ae8634f32613243bcbe2c40>>
*/

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

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

bool perfIssuesEnabled() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("perfIssuesEnabled");
Expand Down Expand Up @@ -812,11 +806,6 @@ bool JReactNativeFeatureFlagsCxxInterop::overrideBySynchronousMountPropsAtMounti
return ReactNativeFeatureFlags::overrideBySynchronousMountPropsAtMountingAndroid();
}

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

bool JReactNativeFeatureFlagsCxxInterop::perfIssuesEnabled(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::perfIssuesEnabled();
Expand Down Expand Up @@ -1120,9 +1109,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"overrideBySynchronousMountPropsAtMountingAndroid",
JReactNativeFeatureFlagsCxxInterop::overrideBySynchronousMountPropsAtMountingAndroid),
makeNativeMethod(
"passScrollToSwipeRefreshChild",
JReactNativeFeatureFlagsCxxInterop::passScrollToSwipeRefreshChild),
makeNativeMethod(
"perfIssuesEnabled",
JReactNativeFeatureFlagsCxxInterop::perfIssuesEnabled),
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<<35b3b4933e2c337c4d924c2cc545eac6>>
* @generated SignedSource<<1cf1c6d1d2a98a495db315e0e7edcc32>>
*/

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

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

static bool perfIssuesEnabled(
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<<fa1074c6da1ee0be0ba9160e63f8958f>>
* @generated SignedSource<<a931a366c816b23f59896dafc9285f85>>
*/

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

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

bool ReactNativeFeatureFlags::perfIssuesEnabled() {
return getAccessor().perfIssuesEnabled();
}
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<<94420e56d4980f03465c949a42cb6062>>
* @generated SignedSource<<0741bbc608bc7d7fdd242d33197057b7>>
*/

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

/**
* When enabled, ReactSwipeRefreshLayout will forward ACTION_SCROLL events to its child for proper handling.
*/
RN_EXPORT static bool passScrollToSwipeRefreshChild();

/**
* Enable reporting Performance Issues (`detail.devtools.performanceIssue`). Displayed in the V2 Performance Monitor and the "Performance Issues" sub-panel in DevTools.
*/
Expand Down
Loading
Loading