浏览代码

Overlay parent can't be null anymore

Guy Carmeli 6 年前
父节点
当前提交
e45231e7f0

+ 2
- 7
lib/android/app/src/main/java/com/reactnativenavigation/presentation/OverlayManager.java 查看文件

@@ -1,6 +1,5 @@
1 1
 package com.reactnativenavigation.presentation;
2 2
 
3
-import android.support.annotation.Nullable;
4 3
 import android.view.ViewGroup;
5 4
 
6 5
 import com.reactnativenavigation.utils.CommandListener;
@@ -11,14 +10,10 @@ import java.util.HashMap;
11 10
 public class OverlayManager {
12 11
     private final HashMap<String, ViewController> overlayRegistry = new HashMap<>();
13 12
 
14
-    public void show(@Nullable ViewGroup root, ViewController overlay, CommandListener listener) {
15
-        if (root == null) {
16
-            listener.onError("Can't show Overlay before setRoot is called. This will be resolved in #3899");
17
-            return;
18
-        }
13
+    public void show(ViewGroup overlaysContainer, ViewController overlay, CommandListener listener) {
19 14
         overlayRegistry.put(overlay.getId(), overlay);
20 15
         overlay.setOnAppearedListener(() -> listener.onSuccess(overlay.getId()));
21
-        root.addView(overlay.getView());
16
+        overlaysContainer.addView(overlay.getView());
22 17
     }
23 18
 
24 19
     public void dismiss(String componentId, CommandListener listener) {