Change assertion to avoid crash in ReactScrollView.java (#39593)

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

Looking into a crash leads by assertion error in this line, I talked to NickGerleman and we think there might be some case when ContentView is not rendered, so it would have 0 child. Changing the assertion to allow 0 child.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D49508540

fbshipit-source-id: 43c50814ead24332c1b24ff2dea50d564519034b
This commit is contained in:
Katy Chang
2023-09-26 10:13:03 -07:00
committed by Facebook GitHub Bot
parent 4fbe05577b
commit 91d3a9539d
@@ -1188,7 +1188,8 @@ public class ReactScrollView extends ScrollView
int count = getChildCount();
Assertions.assertCondition(
count == 1, "React Native ScrollView always has exactly 1 child; a content View");
count <= 1,
"React Native ScrollView should not have more than one child, it should have exactly 1 child; a content View");
if (count > 0) {
for (int i = 0; i < count; i++) {