Skip to content

Commit e5eb1da

Browse files
committed
feat: add multi-window support (#117)
* 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
1 parent 30bd592 commit e5eb1da

File tree

76 files changed

+1254
-1904
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1254
-1904
lines changed

.github/workflows/test-all.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
name: Test All
22

3-
on:
4-
workflow_dispatch:
5-
inputs:
6-
run-e2e-tests:
7-
description: Whether to run E2E tests or not
8-
type: boolean
9-
default: false
10-
pull_request:
11-
push:
12-
branches:
13-
- main
14-
- "*-stable"
3+
# on:
4+
# workflow_dispatch:
5+
# pull_request:
6+
# push:
7+
# tags:
8+
# - 'v*'
9+
# # nightly build @ 2:15 AM UTC
10+
# schedule:
11+
# - cron: '15 2 * * *'
1512

1613
jobs:
1714
set_release_type:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The source for the React Native visionOS documentation and website is hosted on
3131

3232
Prerequisites:
3333
- Download the latest Xcode (at least 15.2)
34-
- Install the latest version of CMake (at least v3.28.0)
34+
- Install the latest version of CMake (at least v3.29.0)
3535

3636
Check out `rn-tester` [README.md](./packages/rn-tester/README.md) to build React Native from the source.
3737

packages/helloworld/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"test": "jest"
1313
},
1414
"dependencies": {
15-
"react": "19.0.0",
16-
"react-native": "1000.0.0"
15+
"react": "18.3.1",
16+
"@callstack/react-native-visionos": "1000.0.0"
1717
},
1818
"devDependencies": {
1919
"@babel/core": "^7.25.2",

packages/out-of-tree-platforms/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@callstack/out-of-tree-platforms",
3-
"version": "0.75.0-main",
3+
"version": "0.76.0-main",
44
"description": "Utils for React Native out of tree platforms.",
55
"keywords": ["out-of-tree", "react-native"],
66
"homepage": "https://github.com/callstack/react-native-visionos/tree/HEAD/packages/out-of-tree-platforms#readme",

packages/react-native-test-library/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
],
2727
"devDependencies": {
2828
"@babel/core": "^7.25.2",
29-
"@react-native/babel-preset": "0.77.0-main",
30-
"react-native": "1000.0.0"
29+
"@react-native/babel-preset": "0.76.0-main",
30+
"@callstack/react-native-visionos": "0.77.0-main"
3131
},
3232
"peerDependencies": {
3333
"react": "*",

packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ NS_ASSUME_NONNULL_BEGIN
6262

6363
/// The window object, used to render the UViewControllers
6464
@property (nonatomic, strong, nonnull) UIWindow *window;
65-
66-
@property (nonatomic, nullable) RCTBridge *bridge;
65+
/// Store last focused window to properly handle multi-window scenarios
66+
@property (nonatomic, weak, nullable) UIWindow *lastFocusedWindow;
67+
@property (nonatomic, strong, nullable) RCTBridge *bridge;
6768
@property (nonatomic, strong, nullable) NSString *moduleName;
6869
@property (nonatomic, strong, nullable) NSDictionary *initialProps;
6970
@property (nonatomic, strong) RCTReactNativeFactory *reactNativeFactory;

packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
4646
{
4747
self.reactNativeFactory = [[RCTReactNativeFactory alloc] initWithDelegate:self];
4848

49-
if (self.automaticallyLoadReactNativeWindow) {
50-
[self loadReactNativeWindow:launchOptions];
51-
}
52-
5349
return YES;
5450
}
5551

packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ - (UIView *)viewWithModuleName:(NSString *)moduleName
153153
RCTSurfaceHostingProxyRootView *surfaceHostingProxyRootView =
154154
[[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface];
155155

156+
#if TARGET_OS_VISION
157+
surfaceHostingProxyRootView.backgroundColor = [UIColor clearColor];
158+
#else
156159
surfaceHostingProxyRootView.backgroundColor = [UIColor systemBackgroundColor];
157160
if (_configuration.customizeRootView != nil) {
158161
_configuration.customizeRootView(surfaceHostingProxyRootView);
@@ -186,7 +189,13 @@ - (UIView *)createRootViewWithBridge:(RCTBridge *)bridge
186189
{
187190
BOOL enableFabric = _configuration.fabricEnabled;
188191
UIView *rootView = RCTAppSetupDefaultRootView(bridge, moduleName, initProps, enableFabric);
192+
193+
#if TARGET_OS_VISION
194+
rootView.backgroundColor = [UIColor clearColor];
195+
#else
189196
rootView.backgroundColor = [UIColor systemBackgroundColor];
197+
#endif
198+
190199
return rootView;
191200
}
192201

packages/react-native/Libraries/LinkingIOS/RCTLinkingManager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@
2424
continueUserActivity:(nonnull NSUserActivity *)userActivity
2525
restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> *_Nullable))restorationHandler;
2626

27+
+ (void)onOpenURL:(nonnull NSURL *)url NS_SWIFT_NAME(onOpenURL(url:));
28+
2729
@end

packages/react-native/Libraries/LinkingIOS/RCTLinkingManager.mm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#import "RCTLinkingPlugins.h"
1616

1717
static NSString *const kOpenURLNotification = @"RCTOpenURLNotification";
18+
static NSURL *initialURL = nil;
1819

1920
static void postNotificationWithURL(NSURL *URL, id sender)
2021
{
@@ -82,6 +83,16 @@ + (BOOL)application:(UIApplication *)application
8283
return YES;
8384
}
8485

86+
87+
+ (void)onOpenURL:(NSURL *)url
88+
{
89+
if (initialURL == nil) {
90+
initialURL = url;
91+
} else {
92+
postNotificationWithURL(url, self);
93+
}
94+
}
95+
8596
- (void)handleOpenURLNotification:(NSNotification *)notification
8697
{
8798
[self sendEventWithName:@"url" body:notification.userInfo];
@@ -154,6 +165,7 @@ - (void)handleOpenURLNotification:(NSNotification *)notification
154165

155166
RCT_EXPORT_METHOD(getInitialURL : (RCTPromiseResolveBlock)resolve reject : (__unused RCTPromiseRejectBlock)reject)
156167
{
168+
#if !TARGET_OS_VISION
157169
NSURL *initialURL = nil;
158170
if (self.bridge.launchOptions[UIApplicationLaunchOptionsURLKey]) {
159171
initialURL = self.bridge.launchOptions[UIApplicationLaunchOptionsURLKey];
@@ -164,6 +176,8 @@ - (void)handleOpenURLNotification:(NSNotification *)notification
164176
initialURL = ((NSUserActivity *)userActivityDictionary[@"UIApplicationLaunchOptionsUserActivityKey"]).webpageURL;
165177
}
166178
}
179+
#endif
180+
// React Native visionOS uses static property to retrieve initialURL.
167181
resolve(RCTNullIfNil(initialURL.absoluteString));
168182
}
169183

0 commit comments

Comments
 (0)