Skip to content

Commit ede0f4d

Browse files
authored
[Android] Remove old versions checks (#4287)
## Description This PR removes old version checks in Button. `M` resolves to `23`, while in React Native current minimum is 24 ([see here](https://github.com/react/react-native/blob/ce72288bfc7d306040d7d1c291f78573ae83d7a0/packages/react-native/gradle/libs.versions.toml#L3)) ## Test plan Build expo-example
1 parent d2bd181 commit ede0f4d

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import android.animation.AnimatorSet
55
import android.animation.ObjectAnimator
66
import android.animation.ValueAnimator
77
import android.annotation.SuppressLint
8-
import android.annotation.TargetApi
98
import android.content.Context
109
import android.content.res.ColorStateList
1110
import android.graphics.Canvas
@@ -63,7 +62,6 @@ class RNGestureHandlerButtonViewManager :
6362

6463
public override fun createViewInstance(context: ThemedReactContext) = ButtonViewGroup(context)
6564

66-
@TargetApi(Build.VERSION_CODES.M)
6765
@ReactProp(name = "foreground")
6866
override fun setForeground(view: ButtonViewGroup, useDrawableOnForeground: Boolean) {
6967
view.useDrawableOnForeground = useDrawableOnForeground
@@ -681,18 +679,15 @@ class RNGestureHandlerButtonViewManager :
681679
return
682680
}
683681
needBackgroundUpdate = false
684-
685-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
686-
foreground = null
687-
}
682+
foreground = null
688683

689684
val selectable = createSelectableDrawable()
690685
val underlay = createUnderlayDrawable()
691686
underlayDrawable = underlay
692687
// Set this view as callback so ObjectAnimator alpha changes trigger redraws.
693688
underlay.callback = this
694689

695-
if (useDrawableOnForeground && selectable != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
690+
if (useDrawableOnForeground && selectable != null) {
696691
// Explicit foreground mode — View natively forwards state/hotspot.
697692
foreground = selectable
698693
selectableDrawable = null
@@ -777,7 +772,7 @@ class RNGestureHandlerButtonViewManager :
777772
if (useBorderlessDrawable) null else ShapeDrawable(RectShape()),
778773
)
779774

780-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && rippleRadius != null) {
775+
if (rippleRadius != null) {
781776
drawable.radius = PixelUtil.toPixelFromDIP(rippleRadius.toFloat()).toInt()
782777
}
783778

0 commit comments

Comments
 (0)