Skip to content

[Android] Remove old versions checks#4287

Open
m-bert wants to merge 1 commit into
mainfrom
@mbert/remove-android-checks
Open

[Android] Remove old versions checks#4287
m-bert wants to merge 1 commit into
mainfrom
@mbert/remove-android-checks

Conversation

@m-bert

@m-bert m-bert commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR removes old version checks in Button. M resolves to 23, while in React Native current minimum is 24 (see here)

Test plan

Build expo-example

Copilot AI review requested due to automatic review settings June 29, 2026 13:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR simplifies the Android Button implementation by removing Android version gating (API level checks) around foreground/ripple handling, based on the assumption that the effective minimum Android SDK is now high enough (RN minSdk 24).

Changes:

  • Removed @TargetApi(M) usage and related import.
  • Dropped Build.VERSION.SDK_INT guards around foreground usage and ripple radius configuration.
Comments suppressed due to low confidence (1)

packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt:694

  • This branch assigns to foreground (API 23+) without checking the runtime SDK level. If a consumer overrides the library/app minSdkVersion below 23, this will crash on API 21/22 devices when useDrawableOnForeground is enabled. Restore the API guard and fall back to the manual-draw path on older Android versions.
      if (useDrawableOnForeground && selectable != null) {
        // Explicit foreground mode — View natively forwards state/hotspot.
        foreground = selectable
        selectableDrawable = null
      } else {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
foreground = null
}
foreground = null

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have fallback to 24 and as said in the description, RN is at 24 now.

Comment on lines +775 to 777
if (rippleRadius != null) {
drawable.radius = PixelUtil.toPixelFromDIP(rippleRadius.toFloat()).toInt()
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have fallback to 24 and as said in the description, RN is at 24 now.

@m-bert m-bert requested a review from j-piasecki June 29, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants