11import SwiftUI
2- import React
32
43/**
54 This SwiftUI struct returns main React Native scene. It should be used only once as it conains setup code.
@@ -22,11 +21,11 @@ public struct RCTMainWindow: Scene {
2221 var moduleName : String
2322 var initialProps : RCTRootViewRepresentable . InitialPropsType
2423 var onOpenURLCallback : ( ( URL ) -> ( ) ) ?
25- var devMenuPlacement : ToolbarPlacement = . bottomOrnament
24+ var devMenuSceneAnchor : UnitPoint ?
2625 var contentView : AnyView ?
2726
2827 var rootView : RCTRootViewRepresentable {
29- RCTRootViewRepresentable ( moduleName: moduleName, initialProps: initialProps)
28+ RCTRootViewRepresentable ( moduleName: moduleName, initialProps: initialProps, devMenuSceneAnchor : devMenuSceneAnchor )
3029 }
3130
3231 /// Creates new RCTMainWindowWindow.
@@ -38,11 +37,11 @@ public struct RCTMainWindow: Scene {
3837 public init (
3938 moduleName: String ,
4039 initialProps: RCTRootViewRepresentable . InitialPropsType = nil ,
41- devMenuPlacement : ToolbarPlacement = . bottomOrnament
40+ devMenuSceneAnchor : UnitPoint ? = . bottom
4241 ) {
4342 self . moduleName = moduleName
4443 self . initialProps = initialProps
45- self . devMenuPlacement = devMenuPlacement
44+ self . devMenuSceneAnchor = devMenuSceneAnchor
4645 self . contentView = AnyView ( rootView)
4746 }
4847
@@ -56,12 +55,12 @@ public struct RCTMainWindow: Scene {
5655 public init < Content: View > (
5756 moduleName: String ,
5857 initialProps: RCTRootViewRepresentable . InitialPropsType = nil ,
59- devMenuPlacement : ToolbarPlacement = . bottomOrnament ,
58+ devMenuSceneAnchor : UnitPoint ? = . bottom ,
6059 @ViewBuilder contentView: @escaping ( _ view: RCTRootViewRepresentable ) -> Content
6160 ) {
6261 self . moduleName = moduleName
6362 self . initialProps = initialProps
64- self . devMenuPlacement = devMenuPlacement
63+ self . devMenuSceneAnchor = devMenuSceneAnchor
6564 self . contentView = AnyView ( contentView ( rootView) )
6665 }
6766
@@ -72,11 +71,6 @@ public struct RCTMainWindow: Scene {
7271 . onOpenURL ( perform: { url in
7372 onOpenURLCallback ? ( url)
7473 } )
75- #if DEBUG
76- . toolbar {
77- DevMenuView ( placement: . bottomOrnament)
78- }
79- #endif
8074 }
8175 }
8276}
@@ -139,29 +133,3 @@ public struct WindowHandlingModifier: ViewModifier {
139133 }
140134}
141135
142- /**
143- Toolbar which displays additional controls to easily open dev menu and trigger reload command.
144- */
145- struct DevMenuView : ToolbarContent {
146- let placement : ToolbarItemPlacement
147-
148- var body : some ToolbarContent {
149- ToolbarItem ( placement: placement) {
150- Button ( action: {
151- RCTTriggerReloadCommandListeners ( " User Reload " )
152- } , label: {
153- Image ( systemName: " arrow.clockwise " )
154- } )
155- }
156- ToolbarItem ( placement: placement) {
157- Button ( action: {
158- NotificationCenter . default. post (
159- Notification ( name: Notification . Name ( " RCTShowDevMenuNotification " ) , object: nil )
160- )
161- } ,
162- label: {
163- Image ( systemName: " filemenu.and.selection " )
164- } )
165- }
166- }
167- }
0 commit comments