Skip to content

Commit 8869fa4

Browse files
javachefacebook-github-bot
authored andcommitted
Fix stale reference to ReactViewGroup#mAllChildren (#47950)
Summary: Pull Request resolved: #47950 `addInArray` may reallocate `mAllChildren` so it's not correct to store this reference. Changelog: [Internal] Reviewed By: tdn120 Differential Revision: D66474532 fbshipit-source-id: 90ce2fcbf8ff236501ed47b2acc413e54ef8b82a
1 parent 84adf26 commit 8869fa4

File tree

1 file changed

+3
-2
lines changed
  • packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view

1 file changed

+3
-2
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,11 +638,12 @@ View getChildAtWithSubviewClippingEnabled(int index) {
638638
/*package*/ void addViewWithSubviewClippingEnabled(
639639
final View child, int index, ViewGroup.LayoutParams params) {
640640
Assertions.assertCondition(mRemoveClippedSubviews);
641-
Rect clippingRect = Assertions.assertNotNull(mClippingRect);
642-
View[] childArray = Assertions.assertNotNull(mAllChildren);
643641
addInArray(child, index);
642+
644643
// we add view as "clipped" and then run {@link #updateSubviewClipStatus} to conditionally
645644
// attach it
645+
Rect clippingRect = Assertions.assertNotNull(mClippingRect);
646+
View[] childArray = Assertions.assertNotNull(mAllChildren);
646647
int clippedSoFar = 0;
647648
for (int i = 0; i < index; i++) {
648649
if (isViewClipped(childArray[i])) {

0 commit comments

Comments
 (0)