Skip to content

Commit 99273f4

Browse files
Abbondanzometa-codesync[bot]
authored andcommitted
Replace deprecated postOnAnimationDelayed calls (#54285)
Summary: Pull Request resolved: #54285 `View#postOnAnimationDelayed` has existed [since API 16](https://developer.android.com/reference/android/view/View#postOnAnimationDelayed(java.lang.Runnable,%20long)) and has been marked as deprecated in ViewCompat [since 1.13.0](https://developer.android.com/reference/androidx/core/view/ViewCompat#postOnAnimationDelayed(android.view.View,java.lang.Runnable,long)). Let's clean it up! Changelog: [Internal] Reviewed By: alanleedev Differential Revision: D85569478 fbshipit-source-id: 7cedf59c9c8fe44d2cec63d7539d955a4fa597e3
1 parent 2810128 commit 99273f4

2 files changed

Lines changed: 12 additions & 16 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -829,8 +829,7 @@ public void run() {
829829
handlePostTouchScrolling(0, 0);
830830
}
831831
};
832-
ViewCompat.postOnAnimationDelayed(
833-
this, mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
832+
postOnAnimationDelayed(mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
834833
}
835834
return result;
836835
}
@@ -1132,8 +1131,8 @@ public void run() {
11321131
// We are still scrolling.
11331132
mActivelyScrolling = false;
11341133
mStableFrames = 0;
1135-
ViewCompat.postOnAnimationDelayed(
1136-
ReactHorizontalScrollView.this, this, ReactScrollViewHelper.MOMENTUM_DELAY);
1134+
ReactHorizontalScrollView.this.postOnAnimationDelayed(
1135+
this, ReactScrollViewHelper.MOMENTUM_DELAY);
11371136
} else {
11381137
// There has not been a scroll update since the last time this Runnable executed.
11391138
ReactScrollViewHelper.updateFabricScrollState(ReactHorizontalScrollView.this);
@@ -1162,14 +1161,13 @@ public void run() {
11621161
flingAndSnap(0);
11631162
}
11641163
// The scrollview has not "stabilized" so we just post to check again a frame later
1165-
ViewCompat.postOnAnimationDelayed(
1166-
ReactHorizontalScrollView.this, this, ReactScrollViewHelper.MOMENTUM_DELAY);
1164+
ReactHorizontalScrollView.this.postOnAnimationDelayed(
1165+
this, ReactScrollViewHelper.MOMENTUM_DELAY);
11671166
}
11681167
}
11691168
}
11701169
};
1171-
ViewCompat.postOnAnimationDelayed(
1172-
this, mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
1170+
postOnAnimationDelayed(mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
11731171
}
11741172

11751173
private void cancelPostTouchScrolling() {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,7 @@ public void run() {
683683
handlePostTouchScrolling(0, 0);
684684
}
685685
};
686-
ViewCompat.postOnAnimationDelayed(
687-
this, mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
686+
postOnAnimationDelayed(mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
688687
}
689688
return result;
690689
}
@@ -900,8 +899,8 @@ public void run() {
900899
// We are still scrolling.
901900
mActivelyScrolling = false;
902901
mStableFrames = 0;
903-
ViewCompat.postOnAnimationDelayed(
904-
ReactScrollView.this, this, ReactScrollViewHelper.MOMENTUM_DELAY);
902+
ReactScrollView.this.postOnAnimationDelayed(
903+
this, ReactScrollViewHelper.MOMENTUM_DELAY);
905904
} else {
906905
// There has not been a scroll update since the last time this Runnable executed.
907906
ReactScrollViewHelper.updateFabricScrollState(ReactScrollView.this);
@@ -930,14 +929,13 @@ public void run() {
930929
flingAndSnap(0);
931930
}
932931
// The scrollview has not "stabilized" so we just post to check again a frame later
933-
ViewCompat.postOnAnimationDelayed(
934-
ReactScrollView.this, this, ReactScrollViewHelper.MOMENTUM_DELAY);
932+
ReactScrollView.this.postOnAnimationDelayed(
933+
this, ReactScrollViewHelper.MOMENTUM_DELAY);
935934
}
936935
}
937936
}
938937
};
939-
ViewCompat.postOnAnimationDelayed(
940-
this, mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
938+
postOnAnimationDelayed(mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
941939
}
942940

943941
private void cancelPostTouchScrolling() {

0 commit comments

Comments
 (0)