You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## How is it different from running app in compatibility mode?
16
+
## 🎉 Building your first spatial React Native app
17
+
Follow the [Getting Started](https://callstack.github.io/react-native-visionos-docs/getting-started/create-first-app) guide. If you wish to get started quickly, you can utilize this command:
17
18
18
-
React Native visionOS unlocks full capabilities of the platform, giving your app transparent look that feels right at home next to other visionOS apps. It allows you to leverage the power of `ImmersiveSpace`s and multi-window apps.
19
-
20
-
Side by side comparison of running the same app: React Native visionOS vs React Native iOS (Compatibility mode).
6. Next, go to `YourApp/visionos` folder and run following commands to install Pods:
21
+
```
39
22
40
-
```
41
-
bundle install
42
-
bundle exec pod install
43
-
```
44
-
45
-
7. Now you can run `yarn visionos`
46
-
8. (Optional) you also can open project using Xcode (`xed YourApp/visionos/YourApp.xcworkspace`).
47
-
- Build the app by clicking the "Run" button in Xcode.
48
-
49
-
## Platform guidelines
50
-
51
-
We suggest you read [Human Interface Guidelines for visionOS](https://developer.apple.com/design/human-interface-guidelines/designing-for-visionos) when creating visionOS apps.
52
-
53
-
It's important not to cover the translucent background with a solid color, as it helps to ground apps and make them feel like part of the environment.
54
-
55
-
## API Reference
56
-
57
-
### App entry point
58
-
React Native visionOS uses SwiftUI lifecycle. The app entry point is now `App.swift` file (by default it is `main.m`). This change allows us to use full capabilities of the visionOS SDK.
Opens a new [`ImmersiveSpace`](https://developer.apple.com/documentation/swiftui/immersive-spaces) given it's unique `Id`.
99
-
100
-
**`endSession`**
101
-
```js
102
-
endSession: () =>Promise<void>
103
-
```
104
-
Closes currently open `ImmersiveSpace`.
105
-
106
-
#### Constants
107
-
**`supportsMultipleScenes`**
108
-
```js
109
-
supportsMultipleScenes: boolean
110
-
```
111
-
A Boolean value that indicates whether the app may display multiple scenes simultaneously. Returns the value of `UIApplicationSupportsMultipleScenes` key from `Info.plist`.
112
-
113
-
### Example Usage
114
-
115
-
1. Set `UIApplicationSupportsMultipleScenes` to `true` in `Info.plist`:
116
-
```diff
117
-
<?xml version="1.0" encoding="UTF-8"?>
118
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
Alert.alert('Error', 'Multiple scenes are not supported');
166
-
return;
167
-
}
168
-
awaitXR.requestSession('TestImmersiveSpace'); // Pass the same identifier from `App.swift`
169
-
} catch (e) {
170
-
Alert.alert('Error', e.message);
171
-
}
172
-
};
173
-
174
-
constcloseXRSession=async () => {
175
-
awaitXR.endSession();
176
-
};
177
-
```
178
-
> [!CAUTION]
179
-
> Opening an `ImmersiveSpace` can fail in this secarios:
180
-
> -`ImmersiveSpace` is not declared.
181
-
> -`UIApplicationSupportsMultipleScenes` is set to `false`.
182
-
> - User cancels the request.
26
+
The full documentation for React Native visionOS can be found on our [website](https://callstack.github.io/react-native-visionos-docs).
183
27
184
-
For a full example usage, refer to [`XRExample.js`](https://github.com/callstack/react-native-visionos/blob/main/packages/rn-tester/js/examples/XR/XRExample.js).
28
+
The source for the React Native visionOS documentation and website is hosted on a separate repo, @callstack/react-native-visionos-docs.
0 commit comments