Skip to content

Commit 83ed548

Browse files
authored
Merge pull request #2 from callstack/docs/migrate-from-readme
docs: migrate from README
2 parents 3f1a380 + 1b54b88 commit 83ed548

14 files changed

+240
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Website
1+
# React Native visionOS Docs
22

33
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
44

docs/api/XR.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
Manage Immersive Experiences.
2+
3+
## Methods
4+
5+
#### **`requestSession`**
6+
7+
```js
8+
requestSession: (sessionId?: string) => Promise<void>
9+
```
10+
11+
Opens a new [`ImmersiveSpace`](https://developer.apple.com/documentation/swiftui/immersive-spaces) given it's unique `Id`.
12+
13+
:::warning
14+
15+
Opening an `ImmersiveSpace` can fail in following scenarios:
16+
17+
- `ImmersiveSpace` is not declared.
18+
- `UIApplicationSupportsMultipleScenes` is set to `false`.
19+
- User cancels the request.
20+
21+
:::
22+
23+
#### **`endSession`**
24+
25+
```js
26+
endSession: () => Promise<void>
27+
```
28+
29+
Closes currently open `ImmersiveSpace`.
30+
31+
## Constants
32+
33+
#### **`supportsMultipleScenes`**
34+
35+
```js
36+
supportsMultipleScenes: boolean;
37+
```
38+
39+
A Boolean value that indicates whether the app may display multiple scenes simultaneously. Returns the value of `UIApplicationSupportsMultipleScenes` key from `Info.plist`.
40+
41+
:::info
42+
43+
## UIApplicationSupportsMultipleScenes
44+
45+
In order to use this API, make sure your app supports multiple scenes. Set `UIApplicationSupportsMultipleScenes` to `true` in `Info.plist`:
46+
47+
```json
48+
<dict>
49+
<key>UIApplicationSceneManifest</key>
50+
<dict>
51+
<key>UIApplicationPreferredDefaultSceneSessionRole</key>
52+
<string>UIWindowSceneSessionRoleApplication</string>
53+
<key>UIApplicationSupportsMultipleScenes</key>
54+
// highlight-next-line
55+
<true/>
56+
<key>UISceneConfigurations</key>
57+
<dict/>
58+
</dict>
59+
</dict>
60+
</plist>
61+
62+
```
63+
64+
:::

docs/api/hoverEffect.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Hover Effects
2+
3+
:::warning
4+
5+
This prop is soon to be removed in favour of applying this effect using `cursor: pointer` style.
6+
7+
:::
8+
9+
This is a prop on `<View />` component allowing to add hover effect. It's applied to all Touchable and Pressable components by default.
10+
11+
If you want to customize it you can use the `visionos_hoverEffect` prop, like so:
12+
13+
```tsx
14+
<TouchableOpacity visionos_hoverEffect="lift">
15+
<Text>Click me</Text>
16+
</TouchableOpacity>
17+
```
18+
19+
The available options are: `lift` or `highlight`.

docs/api/intro.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
# Introduction
6+
7+
React Native visionOS builds upon APIs provided by [React Native Core](https://reactnative.dev), so every API listed in React Native docs is available, this documentation lists React Native visionOS specific APIs.
8+
9+
### List of APIs provided by React Native visionOS
10+
11+
- `XR` - API to manage Immersive Experiences
12+
- `visionos_hoverEffect` - Hover effects (soon to be removed in favour of `cursor: 'pointer'`).
File renamed without changes.
File renamed without changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# App Entry Point
2+
3+
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.
4+
5+
Here is an example from the template:
6+
7+
```swift title="App.swift"
8+
@main
9+
struct HelloWorldApp: App {
10+
@UIApplicationDelegateAdaptor var delegate: AppDelegate
11+
12+
var body: some Scene {
13+
RCTMainWindow(moduleName: "HelloWorld")
14+
}
15+
}
16+
```
17+
18+
We are using `@UIApplicationDelegateAdaptor`, a property wrapper that allows us to use familiar `AppDelegate` in SwiftUI life cycle.
19+
20+
`AppDelegate` extends `RCTAppDelegate` which does most of React Native initialization.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Folder Structure
2+
3+
React Native visionOS builds upon the same template used for iOS and Android. Native visionOS files are stored inside of `visionos` folder (that's why it's required to run `pod install` in this folder instead of `ios`).
4+
5+
Your folder structure should look like so:
6+
7+
```
8+
SpatialApp
9+
├── __tests__
10+
├── android
11+
│   ├── app
12+
│   └── gradle
13+
├── ios
14+
│   ├── SpatialApp
15+
│   ├── SpatialApp.xcworkspace
16+
│   ├── SpatialApp.xcodeproj
17+
│   └── SpatialAppTests
18+
├── visionos
19+
│ ├── SpatialApp
20+
│ ├── SpatialApp.xcodeproj
21+
│ ├── SpatialApp.xcworkspace
22+
│ └── SpatialAppTests
23+
├── node_modules
24+
└── src
25+
```
File renamed without changes.

docs/docs/guides/_category_.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"label": "Guides",
3+
"position": 2,
4+
"link": {
5+
"type": "generated-index"
6+
},
7+
}

0 commit comments

Comments
 (0)