Skip to content

Commit

Permalink
feat: update docs (#80)
Browse files Browse the repository at this point in the history
* feat: update docs

* Update README.md

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>

* Update README.md

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>

* Update README.md

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>

* Update README.md

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>

* Update README.md

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>

---------

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
  • Loading branch information
okwasniewski and thymikee authored Jan 24, 2024
1 parent d31623e commit 4e11ae3
Showing 1 changed file with 41 additions and 6 deletions.
47 changes: 41 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ React Native Vision OS allows you to write visionOS with full support for platfo
## New project creation

1. Make sure you have a [proper development environment setup](https://reactnative.dev/docs/environment-setup)
2. Download the latest Xcode beta [here](https://developer.apple.com/xcode/).
3. Install visionOS Simulator runtime.
4. Install the latest version of CMake (at least v3.28.0)
2. Download the latest Xcode (at least 15.2).
3. Install visionOS simulator runtime.
4. Install the latest version of CMake (at least v3.28.0).
5. Initialize the project using this command:

```
Expand All @@ -28,20 +28,55 @@ npx @callstack/react-native-visionos@latest init YourApp
6. Next, go to `YourApp/visionos` folder and run following commands to install Pods:

```
cd visionos
bundle install
bundle exec pod install
```

7. Open `YourApp/visionos/YourApp.xcworkspace` using Xcode 15 Beta.
8. Build the app by clicking the "Run" button in Xcode.
7. Now you can run `yarn visionos`
8. (Optional) you also can open project using Xcode (`xed YourApp/visionos/YourApp.xcworkspace`).
- Build the app by clicking the "Run" button in Xcode.

## Platform guidelines

We suggest you read [Human Interface Guidelines for visionOS](https://developer.apple.com/design/human-interface-guidelines/designing-for-visionos) when creating visionOS apps.

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.

## API Reference

### App entry point
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.

Here is a example from the template:
```swift
// App.swift
@main
struct HelloWorldApp: App {
@UIApplicationDelegateAdaptor var delegate: AppDelegate

var body: some Scene {
RCTMainWindow(moduleName: "HelloWorld")
}
}
```

We are using `@UIApplicationDelegateAdaptor`, a property wrapper that allows us to use familiar `AppDelegate` in SwiftUI life cycle.

`AppDelegate` extends `RCTAppDelegate` which does most of React Native initialization.

### Hover effect API
This is a prop on `<View />` component allowing to add hover effect. It's applied to all Touchable and Pressable components by default.

If you want to customize it you can use the `visionos_hoverEffect` prop, like so:

```jsx
<TouchableOpacity visionos_hoverEffect="lift">
<Text>Click me</Text>
</TouchableOpacity>
```

The available options are: `lift` or `highlight`.

## Contributing

1. Follow the same steps as in the `New project creation` section.
Expand Down

0 comments on commit 4e11ae3

Please sign in to comment.