Skip to content

Commit

Permalink
feat: allow to use WindowHandlingModifier outside of RCTMainWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
okwasniewski committed Apr 5, 2024
1 parent aba4587 commit 4630ffb
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@ public struct RCTMainWindow: Scene {
/**
Handles data sharing between React Native and SwiftUI views.
*/
struct WindowHandlingModifier: ViewModifier {
public struct WindowHandlingModifier: ViewModifier {
typealias UserInfoType = Dictionary<String, AnyHashable>

@Environment(\.reactContext) private var reactContext
@Environment(\.openWindow) private var openWindow
@Environment(\.dismissWindow) private var dismissWindow
@Environment(\.supportsMultipleWindows) private var supportsMultipleWindows

func body(content: Content) -> some View {
public init() {}

public func body(content: Content) -> some View {
// Attach listeners only if app supports multiple windows
if supportsMultipleWindows {
content
Expand Down

0 comments on commit 4630ffb

Please sign in to comment.