|
@@ -75,24 +75,45 @@ public class LayoutFactory {
|
75
|
75
|
}
|
76
|
76
|
|
77
|
77
|
private ViewController createSideMenuRoot(LayoutNode node) {
|
78
|
|
- SideMenuController sideMenuController = new SideMenuController(activity, childRegistry, node.id, parseNodeOptions(node));
|
|
78
|
+ SideMenuController sideMenuController = new SideMenuController(activity, childRegistry, node.id, parseNodeOptions(node));
|
|
79
|
+ ViewController childControllerCenter = null, childControllerLeft = null, childControllerRight = null;
|
|
80
|
+
|
79
|
81
|
for (LayoutNode child : node.children) {
|
80
|
|
- ViewController childController = create(child);
|
81
|
|
- childController.setParentController(sideMenuController);
|
82
|
82
|
switch (child.type) {
|
83
|
83
|
case SideMenuCenter:
|
84
|
|
- sideMenuController.setCenterController(childController);
|
|
84
|
+ childControllerCenter = create(child);
|
|
85
|
+ childControllerCenter.setParentController(sideMenuController);
|
85
|
86
|
break;
|
86
|
87
|
case SideMenuLeft:
|
87
|
|
- sideMenuController.setLeftController(childController);
|
|
88
|
+ childControllerLeft = create(child);
|
|
89
|
+ childControllerLeft.setParentController(sideMenuController);
|
88
|
90
|
break;
|
89
|
91
|
case SideMenuRight:
|
90
|
|
- sideMenuController.setRightController(childController);
|
|
92
|
+ childControllerRight = create(child);
|
|
93
|
+ childControllerRight.setParentController(sideMenuController);
|
91
|
94
|
break;
|
92
|
95
|
default:
|
93
|
96
|
throw new IllegalArgumentException("Invalid node type in sideMenu: " + node.type);
|
94
|
97
|
}
|
95
|
|
- }
|
|
98
|
+ }
|
|
99
|
+
|
|
100
|
+ // Need to set the center controller first, otherwise "onPress" events on the JS components
|
|
101
|
+ // of the left and right drawers are not handled properly.
|
|
102
|
+ //
|
|
103
|
+ // See https://github.com/wix/react-native-navigation/issues/2835
|
|
104
|
+ //
|
|
105
|
+ if (childControllerCenter != null) {
|
|
106
|
+ sideMenuController.setCenterController(childControllerCenter);
|
|
107
|
+ }
|
|
108
|
+
|
|
109
|
+ if (childControllerLeft != null) {
|
|
110
|
+ sideMenuController.setLeftController(childControllerLeft);
|
|
111
|
+ }
|
|
112
|
+
|
|
113
|
+ if (childControllerRight != null) {
|
|
114
|
+ sideMenuController.setRightController(childControllerRight);
|
|
115
|
+ }
|
|
116
|
+
|
96
|
117
|
return sideMenuController;
|
97
|
118
|
}
|
98
|
119
|
|