[Android] Remove old versions checks#4287
Open
m-bert wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
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_INTguards aroundforegroundusage 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/appminSdkVersionbelow 23, this will crash on API 21/22 devices whenuseDrawableOnForegroundis 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 |
Collaborator
Author
There was a problem hiding this comment.
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() | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
We have fallback to 24 and as said in the description, RN is at 24 now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR removes old version checks in Button.
Mresolves to23, while in React Native current minimum is 24 (see here)Test plan
Build expo-example