From 64eb0438b7407be27df34d2325b7235ee0f1c403 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 5 Nov 2024 08:39:50 -0800 Subject: [PATCH] Undo a breaking change on ReactViewGroup constructor (#47423) Summary: cipolleschi found out that we broke the `ReactViewGroup` constructor when making this class Nullsafe. Specifically now users would need to pass a `Context` and not a `Context?` as libraries will break (and this will break a lot of them). So I'm undoing this change by annotating this parameter as Nullable. Changelog: [Android] [Changed] - Undo a breaking change on ReactViewGroup constructor Reviewed By: tdn120 Differential Revision: D65483379 --- .../com/facebook/react/views/view/ReactViewGroup.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java index 8277b71a9f01..6c33e2ee70e2 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java @@ -143,7 +143,13 @@ public void shutdown() { private float mBackfaceOpacity; private String mBackfaceVisibility; - public ReactViewGroup(Context context) { + /** + * Creates a new `ReactViewGroup` instance. + * + * @param context A {@link Context} instance. It's Nullable to not break compatibility with OSS + * users (could be made non-null in the future but requires proper comms). + */ + public ReactViewGroup(@Nullable Context context) { super(context); initView(); }