mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix modal crash on create with initial props (#52729)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52729 The Modal view creation contains initial properties when using Props 2.0. This diff adds support for Modal view creations having initial properties by allowing the `updateProperties` fast path only if the dialog is already initialized. Without the change, the fast path gets called before the dialog could be initialized which leads to throwing an exception when the dialog is being checked to see if it is initialized. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D78638902 fbshipit-source-id: 61ad007b82867fa8b35648e3d8c930ee0e86c80d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a0a77f7476
commit
1f6eb884bf
+7
-2
@@ -256,8 +256,13 @@ public class ReactModalHostView(context: ThemedReactContext) :
|
||||
if (createNewDialog) {
|
||||
dismiss()
|
||||
} else {
|
||||
updateProperties()
|
||||
return
|
||||
// With Props 2.0 the view creation could include initial props. This means the dialog might
|
||||
// still have to be created before the properties can be set. We only update properties if the
|
||||
// dialog was already initialized.
|
||||
dialog?.let {
|
||||
updateProperties()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the flag since we are going to create a new dialog
|
||||
|
||||
Reference in New Issue
Block a user