From f42413bad93749273e98299dcb21ec68d280010b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Kwas=CC=81niewski?= Date: Fri, 5 Apr 2024 08:34:29 +0200 Subject: [PATCH] feat: allow to use WindowHandlingModifier outside of RCTMainWindow --- .../Libraries/SwiftExtensions/RCTMainWindow.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/react-native/Libraries/SwiftExtensions/RCTMainWindow.swift b/packages/react-native/Libraries/SwiftExtensions/RCTMainWindow.swift index bbf3a3c203252e..d34c31221d87b0 100644 --- a/packages/react-native/Libraries/SwiftExtensions/RCTMainWindow.swift +++ b/packages/react-native/Libraries/SwiftExtensions/RCTMainWindow.swift @@ -37,7 +37,7 @@ public struct RCTMainWindow: Scene { /** Handles data sharing between React Native and SwiftUI views. */ -struct WindowHandlingModifier: ViewModifier { +public struct WindowHandlingModifier: ViewModifier { typealias UserInfoType = Dictionary @Environment(\.reactContext) private var reactContext @@ -45,7 +45,9 @@ struct WindowHandlingModifier: ViewModifier { @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