-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add multi-window support #117
Conversation
I’m really excited about this PR - if there’s anything I can contribute to help get this in please ping me! |
555306b
to
d88f4ec
Compare
d88f4ec
to
de5ae39
Compare
packages/react-native/Libraries/SwiftExtensions/RCTMainWindow.swift
Outdated
Show resolved
Hide resolved
packages/react-native/Libraries/SwiftExtensions/RCTMainWindow.swift
Outdated
Show resolved
Hide resolved
packages/react-native/Libraries/SwiftExtensions/RCTWindow.swift
Outdated
Show resolved
Hide resolved
|
||
id<UIApplicationDelegate> delegate = RCTSharedApplication().delegate; | ||
|
||
SEL lastFocusedWindowSelector = NSSelectorFromString(@"lastFocusedWindow"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solution is not ideal but I didn't find anything better that's available publicly.
I found private API that allows to retrieve "key" window scene (the last interacted with), but usage of private APIs is not allowed.
I'm leaving this for reference:
SEL isKeyWindowSceneSelector = NSSelectorFromString(@"_isKeyWindowScene");
if ([windowScene respondsToSelector:isKeyWindowSceneSelector]) {
BOOL isKeyWindowScene = [windowScene performSelector:isKeyWindowSceneSelector];
if (!isKeyWindowScene) {
continue;
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Post on the Apple dev forums and see if you can get an official response, some folks have gotten private iOS APIs made public via discussions there.
@State private var immersionLevel: ImmersionStyle = .full | ||
|
||
var body: some Scene { | ||
RCTMainWindow(moduleName: "RNTesterApp") | ||
|
||
RCTWindow(id: "SecondWindow", sceneData: reactContext.getSceneData(id: "SecondWindow")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Question] How can we make declaring new windows possible without users touching native code?
1a97f77
to
838e7e5
Compare
838e7e5
to
6caf418
Compare
* feat: add multi-window support * feat: introduce WindowManager # Conflicts: # packages/react-native/Libraries/XR/RCTXRModule.mm # packages/react-native/src/private/specs/visionos_modules/NativeXRModule.js # packages/rn-tester/Podfile.lock # packages/rn-tester/js/examples/XR/XRExample.js fix: creating second root view instance crash
* feat: add multi-window support * feat: introduce WindowManager
* feat: add multi-window support * feat: introduce WindowManager
* feat: add multi-window support * feat: introduce WindowManager
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125) # Conflicts: # packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: creating second root view instance crash
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125) feat: allow to use WindowHandlingModifier outside of RCTMainWindow fix: deep and universal links when app is running (#140) Co-authored-by: Thiago Brezinski <[email protected]> fix: remove window init feat: add support for ornaments & dev menu trigger (#149) * feat: add support for ornaments * feat: add ornaments support to second window fix: allow to manually move dev menu to avoid conflicts (#150) fix: remove unnecessary diff after upstreaming changes (#151) Make CMake 3.29.0 as minimum required version (#155) fix: move visionOS codegen specs, sync with upstream chore: sync with upstream fix: remove template Move template to a separate repo fix: update oot-release scripts chore: remove unnecessary diff (#159) fix: react-native-config chore: sync with upstream chore: sync with upstrteam
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125) feat: allow to use WindowHandlingModifier outside of RCTMainWindow fix: deep and universal links when app is running (#140) Co-authored-by: Thiago Brezinski <[email protected]> fix: remove window init feat: add support for ornaments & dev menu trigger (#149) * feat: add support for ornaments * feat: add ornaments support to second window fix: allow to manually move dev menu to avoid conflicts (#150) fix: remove unnecessary diff after upstreaming changes (#151) Make CMake 3.29.0 as minimum required version (#155) fix: move visionOS codegen specs, sync with upstream chore: sync with upstream fix: remove template Move template to a separate repo fix: update oot-release scripts chore: remove unnecessary diff (#159) fix: react-native-config chore: sync with upstream chore: sync with upstrteam
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125) feat: allow to use WindowHandlingModifier outside of RCTMainWindow fix: deep and universal links when app is running (#140) Co-authored-by: Thiago Brezinski <[email protected]> fix: remove window init feat: add support for ornaments & dev menu trigger (#149) * feat: add support for ornaments * feat: add ornaments support to second window fix: allow to manually move dev menu to avoid conflicts (#150) fix: remove unnecessary diff after upstreaming changes (#151) Make CMake 3.29.0 as minimum required version (#155) fix: move visionOS codegen specs, sync with upstream chore: sync with upstream fix: remove template Move template to a separate repo fix: update oot-release scripts chore: remove unnecessary diff (#159) fix: react-native-config chore: sync with upstream chore: sync with upstrteam
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125) feat: allow to use WindowHandlingModifier outside of RCTMainWindow fix: deep and universal links when app is running (#140) Co-authored-by: Thiago Brezinski <[email protected]> fix: remove window init feat: add support for ornaments & dev menu trigger (#149) * feat: add support for ornaments * feat: add ornaments support to second window fix: allow to manually move dev menu to avoid conflicts (#150) fix: remove unnecessary diff after upstreaming changes (#151) Make CMake 3.29.0 as minimum required version (#155) fix: move visionOS codegen specs, sync with upstream chore: sync with upstream fix: remove template Move template to a separate repo fix: update oot-release scripts chore: remove unnecessary diff (#159) fix: react-native-config chore: sync with upstream chore: sync with upstrteam
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125) feat: allow to use WindowHandlingModifier outside of RCTMainWindow fix: deep and universal links when app is running (#140) Co-authored-by: Thiago Brezinski <[email protected]> fix: remove window init feat: add support for ornaments & dev menu trigger (#149) * feat: add support for ornaments * feat: add ornaments support to second window fix: allow to manually move dev menu to avoid conflicts (#150) fix: remove unnecessary diff after upstreaming changes (#151) Make CMake 3.29.0 as minimum required version (#155) fix: move visionOS codegen specs, sync with upstream chore: sync with upstream fix: remove template Move template to a separate repo fix: update oot-release scripts chore: remove unnecessary diff (#159) fix: react-native-config chore: sync with upstream chore: sync with upstrteam
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125) feat: allow to use WindowHandlingModifier outside of RCTMainWindow fix: deep and universal links when app is running (#140) Co-authored-by: Thiago Brezinski <[email protected]> fix: remove window init feat: add support for ornaments & dev menu trigger (#149) * feat: add support for ornaments * feat: add ornaments support to second window fix: allow to manually move dev menu to avoid conflicts (#150) fix: remove unnecessary diff after upstreaming changes (#151) Make CMake 3.29.0 as minimum required version (#155) fix: move visionOS codegen specs, sync with upstream chore: sync with upstream fix: remove template Move template to a separate repo fix: update oot-release scripts chore: remove unnecessary diff (#159) fix: react-native-config chore: sync with upstream chore: sync with upstrteam
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125) feat: allow to use WindowHandlingModifier outside of RCTMainWindow fix: deep and universal links when app is running (#140) Co-authored-by: Thiago Brezinski <[email protected]> fix: remove window init feat: add support for ornaments & dev menu trigger (#149) * feat: add support for ornaments * feat: add ornaments support to second window fix: allow to manually move dev menu to avoid conflicts (#150) fix: remove unnecessary diff after upstreaming changes (#151) Make CMake 3.29.0 as minimum required version (#155) fix: move visionOS codegen specs, sync with upstream chore: sync with upstream fix: remove template Move template to a separate repo fix: update oot-release scripts chore: remove unnecessary diff (#159) fix: react-native-config chore: sync with upstream chore: sync with upstrteam
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125) feat: allow to use WindowHandlingModifier outside of RCTMainWindow fix: deep and universal links when app is running (#140) Co-authored-by: Thiago Brezinski <[email protected]> fix: remove window init feat: add support for ornaments & dev menu trigger (#149) * feat: add support for ornaments * feat: add ornaments support to second window fix: allow to manually move dev menu to avoid conflicts (#150) fix: remove unnecessary diff after upstreaming changes (#151) Make CMake 3.29.0 as minimum required version (#155) fix: move visionOS codegen specs, sync with upstream chore: sync with upstream fix: remove template Move template to a separate repo fix: update oot-release scripts chore: remove unnecessary diff (#159) fix: react-native-config chore: sync with upstream chore: sync with upstrteam
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125) feat: allow to use WindowHandlingModifier outside of RCTMainWindow fix: deep and universal links when app is running (#140) Co-authored-by: Thiago Brezinski <[email protected]> fix: remove window init feat: add support for ornaments & dev menu trigger (#149) * feat: add support for ornaments * feat: add ornaments support to second window fix: allow to manually move dev menu to avoid conflicts (#150) fix: remove unnecessary diff after upstreaming changes (#151) Make CMake 3.29.0 as minimum required version (#155) fix: move visionOS codegen specs, sync with upstream chore: sync with upstream fix: remove template Move template to a separate repo fix: update oot-release scripts chore: remove unnecessary diff (#159) fix: react-native-config chore: sync with upstream chore: sync with upstrteam
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125) feat: allow to use WindowHandlingModifier outside of RCTMainWindow fix: deep and universal links when app is running (#140) Co-authored-by: Thiago Brezinski <[email protected]> fix: remove window init feat: add support for ornaments & dev menu trigger (#149) * feat: add support for ornaments * feat: add ornaments support to second window fix: allow to manually move dev menu to avoid conflicts (#150) fix: remove unnecessary diff after upstreaming changes (#151) Make CMake 3.29.0 as minimum required version (#155) fix: move visionOS codegen specs, sync with upstream chore: sync with upstream fix: remove template Move template to a separate repo fix: update oot-release scripts chore: remove unnecessary diff (#159) fix: react-native-config chore: sync with upstream chore: sync with upstrteam
Summary:
This PR adds multi-window support with data sharing from React Native to SwiftUI.
Changes
XR.requestSession
now accepts additional object which can be retrieved from the SwiftUI side.New
WindowManager
APIExample usage:
This design allows other platforms to adapt this pattern and extend the returned window object instead of adding more static methods on the
WindowManager
objectChangelog:
[VISIONOS] [ADDED] - Multi window support
Test Plan:
CI Green / Test multi window apis