use view.getPaddingStart() directly (#45150)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45150

As the androidx.core 1.13.1 change, ViewCompact.getPaddingStart and getPaddingEnd are deprecated.

based on the suggestion from https://developer.android.com/reference/kotlin/androidx/core/view/ViewCompat#getPaddingStart(android.view.View), use: view.getPaddingStart and view.getPaddingEnd directly.
 {F1717102270}

Changelog: [Internal] - Migrating deprecated APIs with AndroidX.Core 1.13.1

Reviewed By: alanleedev

Differential Revision: D58955567

fbshipit-source-id: b84377e1ded0d94e9035dcfa4dbd9c463396a322
This commit is contained in:
Peng Jiang
2024-06-26 01:47:24 -07:00
committed by Facebook GitHub Bot
parent 71f8d7608f
commit b9ec0e5a1a
@@ -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
@@ -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(