From 08ecdee71c9d5a4e385a585941ca93ae1002b01f Mon Sep 17 00:00:00 2001 From: Mohamed Moussa Date: Thu, 11 Apr 2024 04:28:07 -0700 Subject: [PATCH] Fix missing setLeftTopRightBottom method (#44033) Summary: We were seeing errors due to `setLeftTopRightBottom` being called without a check for the Android version despite that method [being added in Android API level 29](https://developer.android.com/reference/android/view/View#setLeftTopRightBottom(int,%20int,%20int,%20int)). I've replaced it with the older API methods to fix the issue. This issue originates from https://github.com/facebook/react-native/pull/38526 ## Changelog: [ANDROID] [FIXED] - Resolved error "No virtual method setLeftTopRightBottom" Pull Request resolved: https://github.com/facebook/react-native/pull/44033 Test Plan: Change is pretty trivial, but we tested it in our production app ([Tarteel](https://www.tarteel.ai/)) for a week and confirmed that the error is resolved. Reviewed By: cortinico Differential Revision: D56002098 Pulled By: NickGerleman fbshipit-source-id: ff97d0be2703006b14c865dd148e40eb10069acb --- .../views/scroll/ReactHorizontalScrollContainerView.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollContainerView.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollContainerView.java index bf29f95f2f2..3a60050526b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollContainerView.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollContainerView.java @@ -50,7 +50,10 @@ public class ReactHorizontalScrollContainerView extends ReactViewGroup { int newLeft = 0; int width = right - left; int newRight = newLeft + width; - setLeftTopRightBottom(newLeft, top, newRight, bottom); + setLeft(newLeft); + setTop(top); + setRight(newRight); + setBottom(bottom); } } }