Skip to content

Commit

Permalink
use view.getPaddingStart() directly
Browse files Browse the repository at this point in the history
Summary:
As the androidx.core 1.13.1 change, we got the error when build this module:
```
xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt:439:24: warning: 'getPaddingStart(View): Int' is deprecated. Deprecated in Java
                ViewCompat.getPaddingStart(scrollView) -
                           ^
    xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt:440:24: warning: 'getPaddingEnd(View): Int' is deprecated. Deprecated in Java
                ViewCompat.getPaddingEnd(scrollView))
```

based on the suggestion:
 {F1717102270}

Differential Revision: D58955567
  • Loading branch information
Peng Jiang authored and facebook-github-bot committed Jun 24, 2024
1 parent 0f65d2d commit 877d817
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import android.graphics.Point
import android.view.View
import android.view.ViewGroup
import android.widget.OverScroller
import androidx.core.view.ViewCompat
import com.facebook.common.logging.FLog
import com.facebook.react.bridge.ReactContext
import com.facebook.react.bridge.WritableMap
Expand Down Expand Up @@ -434,10 +433,7 @@ public object ReactScrollViewHelper {
scroller.setFriction(1.0f - scrollState.decelerationRate)

// predict where a fling would end up so we can scroll to the nearest snap offset
val width =
(scrollView.width -
ViewCompat.getPaddingStart(scrollView) -
ViewCompat.getPaddingEnd(scrollView))
val width = scrollView.width - scrollView.getPaddingStart() - scrollView.getPaddingEnd()
val height = scrollView.height - scrollView.paddingBottom - scrollView.paddingTop
val finalAnimatedPositionScroll = scrollState.finalAnimatedPositionScroll
scroller.fling(
Expand Down

0 comments on commit 877d817

Please sign in to comment.