@reactvision/react-viro 2.54.0 → 2.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -46
- package/android/react_viro/react_viro-release.aar +0 -0
- package/android/viro_renderer/viro_renderer-release.aar +0 -0
- package/components/AR/ViroARCamera.tsx +5 -0
- package/components/AR/ViroARImageMarker.tsx +5 -0
- package/components/AR/ViroARObjectMarker.tsx +5 -0
- package/components/AR/ViroARPlane.tsx +5 -0
- package/components/AR/ViroARPlaneSelector.tsx +5 -0
- package/components/AR/ViroARScene.tsx +5 -0
- package/components/AR/ViroARSceneNavigator.tsx +54 -0
- package/components/Studio/StudioARScene.tsx +368 -0
- package/components/Studio/StudioSceneNavigator.tsx +191 -0
- package/components/Studio/VRTStudioModule.ts +40 -0
- package/components/Studio/domain/animationRegistry.ts +86 -0
- package/components/Studio/domain/collisionBindingsRuntime.ts +93 -0
- package/components/Studio/domain/collisionPairKey.ts +15 -0
- package/components/Studio/domain/dragConfiguration.ts +48 -0
- package/components/Studio/domain/materialConfig.ts +276 -0
- package/components/Studio/domain/physicsConfig.ts +204 -0
- package/components/Studio/domain/sceneNavigationHandler.ts +150 -0
- package/components/Studio/domain/studioMaterials.ts +33 -0
- package/components/Studio/domain/triggerImageRegistry.ts +64 -0
- package/components/Studio/domain/useStudioShaderTimeUniforms.ts +51 -0
- package/components/Studio/domain/useStudioShaderViewportUniforms.ts +52 -0
- package/components/Studio/domain/viroNodeFactory.tsx +323 -0
- package/components/Studio/index.ts +18 -0
- package/components/Studio/types.ts +164 -0
- package/components/Types/ViroEvents.ts +53 -0
- package/components/Utilities/VRModuleOpenXR.ts +50 -0
- package/components/Utilities/VRQuestNavigatorBridge.ts +168 -0
- package/components/Utilities/ViroPlatform.ts +52 -0
- package/components/Utilities/ViroVersion.ts +1 -1
- package/components/Utilities/useAnySourceHover.ts +55 -0
- package/components/Utilities/useAnySourcePressed.ts +70 -0
- package/components/ViroQuestEntryPoint.tsx +79 -0
- package/components/ViroVRSceneNavigator.tsx +44 -19
- package/components/ViroXRSceneNavigator.tsx +217 -0
- package/components/VisionOS/ViroVisionOSModule.ts +93 -0
- package/dist/components/AR/ViroARCamera.d.ts +1 -1
- package/dist/components/AR/ViroARCamera.js +5 -0
- package/dist/components/AR/ViroARImageMarker.d.ts +1 -1
- package/dist/components/AR/ViroARImageMarker.js +5 -0
- package/dist/components/AR/ViroARObjectMarker.d.ts +1 -1
- package/dist/components/AR/ViroARObjectMarker.js +5 -0
- package/dist/components/AR/ViroARPlane.d.ts +1 -1
- package/dist/components/AR/ViroARPlane.js +5 -0
- package/dist/components/AR/ViroARPlaneSelector.d.ts +1 -1
- package/dist/components/AR/ViroARPlaneSelector.js +5 -0
- package/dist/components/AR/ViroARScene.d.ts +1 -1
- package/dist/components/AR/ViroARScene.js +5 -0
- package/dist/components/AR/ViroARSceneNavigator.d.ts +13 -0
- package/dist/components/AR/ViroARSceneNavigator.js +36 -0
- package/dist/components/Studio/StudioARScene.d.ts +15 -0
- package/dist/components/Studio/StudioARScene.js +299 -0
- package/dist/components/Studio/StudioSceneNavigator.d.ts +31 -0
- package/dist/components/Studio/StudioSceneNavigator.js +174 -0
- package/dist/components/Studio/VRTStudioModule.d.ts +15 -0
- package/dist/components/Studio/VRTStudioModule.js +31 -0
- package/dist/components/Studio/domain/animationRegistry.d.ts +11 -0
- package/dist/components/Studio/domain/animationRegistry.js +67 -0
- package/dist/components/Studio/domain/collisionBindingsRuntime.d.ts +21 -0
- package/dist/components/Studio/domain/collisionBindingsRuntime.js +54 -0
- package/dist/components/Studio/domain/collisionPairKey.d.ts +8 -0
- package/dist/components/Studio/domain/collisionPairKey.js +15 -0
- package/dist/components/Studio/domain/dragConfiguration.d.ts +20 -0
- package/dist/components/Studio/domain/dragConfiguration.js +37 -0
- package/dist/components/Studio/domain/materialConfig.d.ts +56 -0
- package/dist/components/Studio/domain/materialConfig.js +239 -0
- package/dist/components/Studio/domain/physicsConfig.d.ts +69 -0
- package/dist/components/Studio/domain/physicsConfig.js +165 -0
- package/dist/components/Studio/domain/sceneNavigationHandler.d.ts +12 -0
- package/dist/components/Studio/domain/sceneNavigationHandler.js +112 -0
- package/dist/components/Studio/domain/studioMaterials.d.ts +6 -0
- package/dist/components/Studio/domain/studioMaterials.js +30 -0
- package/dist/components/Studio/domain/triggerImageRegistry.d.ts +13 -0
- package/dist/components/Studio/domain/triggerImageRegistry.js +47 -0
- package/dist/components/Studio/domain/useStudioShaderTimeUniforms.d.ts +6 -0
- package/dist/components/Studio/domain/useStudioShaderTimeUniforms.js +48 -0
- package/dist/components/Studio/domain/useStudioShaderViewportUniforms.d.ts +6 -0
- package/dist/components/Studio/domain/useStudioShaderViewportUniforms.js +48 -0
- package/dist/components/Studio/domain/viroNodeFactory.d.ts +28 -0
- package/dist/components/Studio/domain/viroNodeFactory.js +193 -0
- package/dist/components/Studio/index.d.ts +3 -0
- package/dist/components/Studio/index.js +7 -0
- package/dist/components/Studio/types.d.ts +149 -0
- package/dist/components/Studio/types.js +4 -0
- package/dist/components/Types/ViroEvents.d.ts +49 -1
- package/dist/components/Types/ViroEvents.js +1 -0
- package/dist/components/Utilities/VRModuleOpenXR.d.ts +32 -0
- package/dist/components/Utilities/VRModuleOpenXR.js +44 -0
- package/dist/components/Utilities/VRQuestNavigatorBridge.d.ts +85 -0
- package/dist/components/Utilities/VRQuestNavigatorBridge.js +124 -0
- package/dist/components/Utilities/ViroPlatform.d.ts +10 -0
- package/dist/components/Utilities/ViroPlatform.js +43 -0
- package/dist/components/Utilities/ViroVersion.d.ts +1 -1
- package/dist/components/Utilities/ViroVersion.js +1 -1
- package/dist/components/Utilities/useAnySourceHover.d.ts +36 -0
- package/dist/components/Utilities/useAnySourceHover.js +48 -0
- package/dist/components/Utilities/useAnySourcePressed.d.ts +37 -0
- package/dist/components/Utilities/useAnySourcePressed.js +61 -0
- package/dist/components/ViroQuestEntryPoint.d.ts +13 -0
- package/dist/components/ViroQuestEntryPoint.js +104 -0
- package/dist/components/ViroVRSceneNavigator.d.ts +24 -10
- package/dist/components/ViroVRSceneNavigator.js +21 -18
- package/dist/components/ViroXRSceneNavigator.d.ts +54 -0
- package/dist/components/ViroXRSceneNavigator.js +173 -0
- package/dist/components/VisionOS/ViroVisionOSModule.d.ts +65 -0
- package/dist/components/VisionOS/ViroVisionOSModule.js +91 -0
- package/dist/index.d.ts +15 -2
- package/dist/index.js +32 -2
- package/dist/plugins/withViro.d.ts +17 -1
- package/dist/plugins/withViroAndroid.js +312 -7
- package/dist/plugins/withViroIos.js +5 -0
- package/dist/plugins/withViroVisionOS.d.ts +24 -0
- package/dist/plugins/withViroVisionOS.js +265 -0
- package/index.ts +58 -0
- package/ios/ViroReact.podspec +13 -4
- package/ios/dist/ViroRenderer/ViroKit.framework/ARCoreCoreMLSemanticsResources.bundle/Info.plist +0 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/ARCoreResources.bundle/Info.plist +0 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARSession.h +10 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARSessioniOS.h +4 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROInputControllerBase.h +74 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROInputType.h +11 -3
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROPlatformUtil.h +13 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VRORenderer.h +8 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Info.plist +0 -0
- package/ios/dist/ViroRenderer/ViroKit.framework/Shaders.dat +1 -1
- package/ios/dist/ViroRenderer/ViroKit.framework/ViroKit +0 -0
- package/ios/dist/ViroRenderer/ViroKit.podspec +5 -0
- package/ios/dist/include/VRTARSceneNavigator.h +3 -0
- package/ios/dist/include/VRTStudioModule.h +6 -0
- package/ios/dist/lib/libViroReact.a +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
<p align="center" style="background-colour: #CCCCCC;">
|
|
3
2
|
<a href="https://www.reactvision.xyz/">
|
|
4
3
|
<img src="https://avatars.githubusercontent.com/u/74572641?s=200&v=4" alt="ReactVision logo" width="120px" height="120px">
|
|
@@ -17,78 +16,118 @@
|
|
|
17
16
|
</a>
|
|
18
17
|
</p>
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
# ViroReact, By ReactVision
|
|
21
20
|
|
|
22
|
-
ViroReact is
|
|
21
|
+
ViroReact is the most widely used open-source library for building Augmented Reality (AR) and Virtual Reality (VR) experiences with React Native. Write your app once in TypeScript and ship it natively across mobile AR and VR headsets — no new engine, no new language, no months of ramp-up.
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
<tr>
|
|
26
|
-
<td align="centre">
|
|
27
|
-
<img height="200" src="https://raw.githubusercontent.com/viromedia/viro/master/code-samples/js/ARCarDemo/viro_car_marker_demo.gif" alt="AR car demo">
|
|
28
|
-
</td>
|
|
29
|
-
<td align="centre">
|
|
30
|
-
<img height="200" src="https://github.com/ViroCommunity/viro/assets/430272/b153b8e4-7b40-4197-b05b-dd1eb1566102" alt="Viro example">
|
|
31
|
-
</td>
|
|
32
|
-
</tr>
|
|
33
|
-
</table>
|
|
23
|
+
ViroReact is MIT licensed and free forever.
|
|
34
24
|
|
|
35
|
-
##
|
|
25
|
+
## Supported Platforms
|
|
26
|
+
|
|
27
|
+
| Platform | Support |
|
|
28
|
+
| ---------------- | ------------ |
|
|
29
|
+
| iOS (ARKit) | ✅ Supported |
|
|
30
|
+
| Android (ARCore) | ✅ Supported |
|
|
31
|
+
| Meta Horizon OS | ✅ Supported |
|
|
32
|
+
|
|
33
|
+
ViroReact works with both **React Native CLI** and **Expo** projects.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install @reactvision/react-viro
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
For Expo projects, the easiest way to start is to clone the official starter kit:
|
|
42
|
+
|
|
43
|
+
- **Expo + TypeScript starter kit:** <https://github.com/ReactVision/expo-starter-kit-typescript>
|
|
44
|
+
- **React Native CLI starter kit:** <https://github.com/ReactVision/starter-kit>
|
|
45
|
+
|
|
46
|
+
For step-by-step setup instructions, including platform-specific permissions and build configuration, see the full installation guide in the docs: <https://viro-community.readme.io/docs/installation-instructions>
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
ViroReact ships with a complete spatial computing toolkit out of the box — no third-party plugins, no paid add-ons.
|
|
51
|
+
|
|
52
|
+
**Tracking and anchoring**
|
|
53
|
+
|
|
54
|
+
- AR plane detection with horizontal and vertical surface anchors
|
|
55
|
+
- Image and object recognition triggers
|
|
56
|
+
- Cloud Anchors for persistent, multi-user shared AR content _(Platform feature)_
|
|
57
|
+
- Geospatial Anchors that pin content to real-world latitude, longitude, and altitude _(Platform feature)_
|
|
36
58
|
|
|
37
|
-
|
|
59
|
+
**Rendering**
|
|
38
60
|
|
|
39
|
-
|
|
61
|
+
- PBR lighting, HDR environment maps, and real-time shadow casting
|
|
62
|
+
- 360° photo and video environments
|
|
63
|
+
- Portal rendering for immersive pass-through experiences
|
|
64
|
+
- OBJ, FBX, and GLTF/GLB model loading with embedded animations
|
|
65
|
+
- Custom procedural geometry and custom GPU shaders
|
|
40
66
|
|
|
41
|
-
|
|
67
|
+
**Interaction and motion**
|
|
42
68
|
|
|
43
|
-
|
|
69
|
+
- Built-in physics engine with dynamic and static bodies, collision callbacks
|
|
70
|
+
- Particle system for fire, smoke, rain, snow, confetti, and other effects
|
|
71
|
+
- Declarative animation system with sequencing and chaining
|
|
72
|
+
- Full input event system: tap, drag, pinch, rotate, fuse, hover
|
|
44
73
|
|
|
45
|
-
|
|
46
|
-
- React Native: https://github.com/ReactVision/starter-kit
|
|
47
|
-
- Expo + JavaScript: https://github.com/ReactVision/expo-starter-kit
|
|
74
|
+
**Audio**
|
|
48
75
|
|
|
49
|
-
|
|
76
|
+
- Spatial audio, 360° sound fields, and positioned 3D audio
|
|
50
77
|
|
|
51
|
-
|
|
78
|
+
## Platform Features
|
|
52
79
|
|
|
53
|
-
|
|
54
|
-
These are a little old (~2019), but they’re still a useful reference for many parts of the library.
|
|
80
|
+
Cloud Anchors, Geospatial Anchors, and AI-powered 3D asset creation are powered by **ReactVision Platform** — managed cloud infrastructure built directly into ViroReact. Add your `rvApiKey` and `rvProjectId` and the platform handles hosting, resolution, and geospatial infrastructure for you.
|
|
55
81
|
|
|
56
|
-
|
|
82
|
+
You can get a Studio account, which includes Platform access, for free at <https://studio.reactvision.xyz>.
|
|
57
83
|
|
|
58
|
-
|
|
84
|
+
- Cloud Anchors guide: <https://viro-community.readme.io/docs/cloud-anchors>
|
|
85
|
+
- Geospatial Anchors guide: <https://viro-community.readme.io/docs/geospatial-anchors>
|
|
86
|
+
|
|
87
|
+
## Documentation
|
|
88
|
+
|
|
89
|
+
- Full API reference and guides: <https://viro-community.readme.io/docs/overview>
|
|
90
|
+
- Getting started tutorial: <https://updates.reactvision.xyz/get-started-with-the-viroreact-and-expo-starter-kit-a9ca88803e5a>
|
|
91
|
+
|
|
92
|
+
## Community
|
|
93
|
+
|
|
94
|
+
Discord is the best place to find the team and other developers building with ViroReact:
|
|
59
95
|
|
|
60
96
|
<a href="https://discord.gg/A6TaFNqwVc">
|
|
61
|
-
<img src="https://discordapp.com/api/guilds/774471080713781259/widget.png?style=banner2"
|
|
97
|
+
<img src="https://discordapp.com/api/guilds/774471080713781259/widget.png?style=banner2" />
|
|
62
98
|
</a>
|
|
63
99
|
|
|
64
|
-
##
|
|
100
|
+
## Enterprise Support and Partners
|
|
65
101
|
|
|
66
|
-
|
|
67
|
-
https://viro-community.readme.io/docs/hire-a-viro-react-expert
|
|
102
|
+
For teams adopting XR at scale, the ReactVision team works directly with you on architecture, migrations from 8th Wall or Unity, performance audits, and shipping production experiences. <https://reactvision.xyz/contact>
|
|
68
103
|
|
|
69
|
-
|
|
104
|
+
For independent agencies and consultants vetted by the ReactVision team: <https://reactvision.xyz/partners>
|
|
70
105
|
|
|
71
|
-
##
|
|
106
|
+
## Supporters
|
|
72
107
|
|
|
73
|
-
|
|
108
|
+
A huge thank you to everyone who supports ongoing development by sponsoring us on GitHub: <https://github.com/sponsors/ReactVision>
|
|
74
109
|
|
|
75
|
-
|
|
110
|
+
- [Device Cloud](https://devicecloud.dev/)
|
|
111
|
+
- [Looking Glass](http://looking-glass.space)
|
|
112
|
+
- [@lentesta](https://github.com/lentesta)
|
|
113
|
+
|
|
114
|
+
## Powered by
|
|
76
115
|
|
|
77
|
-
|
|
78
|
-
https://github.com/sponsors/ReactVision
|
|
116
|
+
[](https://jb.gg/OpenSource)
|
|
79
117
|
|
|
80
|
-
|
|
81
|
-
- https://github.com/lentesta
|
|
82
|
-
- Looking Glass: http://looking-glass.space
|
|
118
|
+
JetBrains supports ViroReact development through their [Open Source program](https://jb.gg/OpenSource).
|
|
83
119
|
|
|
84
|
-
##
|
|
120
|
+
## Find Out More
|
|
85
121
|
|
|
86
|
-
|
|
122
|
+
- Website: <https://reactvision.xyz>
|
|
123
|
+
- ViroReact: <https://reactvision.xyz/viro-react>
|
|
124
|
+
- ReactVision Studio: <https://studio.reactvision.xyz>
|
|
125
|
+
- Blog: <https://updates.reactvision.xyz>
|
|
87
126
|
|
|
88
|
-
|
|
127
|
+
## A little history…
|
|
89
128
|
|
|
90
|
-
|
|
129
|
+
ViroReact was originally developed by Viro Media and open-sourced in 2019. In late 2020, the Viro Community formed to maintain and modernise the project, keeping it compatible with current React Native versions. In January 2025, Morrow Digital acquired the project to invest in its future, and in late 2025 ReactVision was spun out as an independent company with a full-time team building the next generation of XR tooling.
|
|
91
130
|
|
|
92
|
-
|
|
131
|
+
---
|
|
93
132
|
|
|
94
|
-
|
|
133
|
+
MIT licensed. © ReactVision, Inc.
|
|
Binary file
|
|
Binary file
|
|
@@ -14,11 +14,16 @@
|
|
|
14
14
|
import * as React from "react";
|
|
15
15
|
import { ViewProps } from "react-native";
|
|
16
16
|
import { ViroCamera } from "../ViroCamera";
|
|
17
|
+
import { isQuest } from "../Utilities/ViroPlatform";
|
|
17
18
|
|
|
18
19
|
export class ViroARCamera extends React.Component<ViewProps> {
|
|
19
20
|
_component: ViroCamera | null = null;
|
|
20
21
|
|
|
21
22
|
render() {
|
|
23
|
+
if (isQuest) {
|
|
24
|
+
console.warn("[Viro] ViroARCamera is not supported on Quest and will not render.");
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
22
27
|
// Uncomment this to check props
|
|
23
28
|
return (
|
|
24
29
|
<ViroCamera
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
ViroARAnchorUpdatedEvent,
|
|
20
20
|
} from "../Types/ViroEvents";
|
|
21
21
|
import { ViroBase } from "../ViroBase";
|
|
22
|
+
import { isQuest } from "../Utilities/ViroPlatform";
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Container for Viro Components anchored to a detected image.
|
|
@@ -47,6 +48,10 @@ export class ViroARImageMarker extends ViroBase<{}> {
|
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
render() {
|
|
51
|
+
if (isQuest) {
|
|
52
|
+
console.warn("[Viro] ViroARImageMarker is not supported on Quest and will not render.");
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
50
55
|
// Uncomment this line to check for misnamed props
|
|
51
56
|
//checkMisnamedProps("ViroARImageMarker", this.props);
|
|
52
57
|
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import { ViroBase } from "../ViroBase";
|
|
15
15
|
import * as React from "react";
|
|
16
16
|
import { NativeSyntheticEvent, requireNativeComponent } from "react-native";
|
|
17
|
+
import { isQuest } from "../Utilities/ViroPlatform";
|
|
17
18
|
import {
|
|
18
19
|
ViroARAnchorFoundEvent,
|
|
19
20
|
ViroARAnchorRemovedEvent,
|
|
@@ -45,6 +46,10 @@ export class ViroARObjectMarker extends ViroBase<Props> {
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
render() {
|
|
49
|
+
if (isQuest) {
|
|
50
|
+
console.warn("[Viro] ViroARObjectMarker is not supported on Quest and will not render.");
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
48
53
|
// Uncomment this line to check for misnamed props
|
|
49
54
|
//checkMisnamedProps("ViroARObjectMarker", this.props);
|
|
50
55
|
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
import { ViroBase } from "../ViroBase";
|
|
20
20
|
import * as React from "react";
|
|
21
21
|
import { NativeSyntheticEvent, requireNativeComponent } from "react-native";
|
|
22
|
+
import { isQuest } from "../Utilities/ViroPlatform";
|
|
22
23
|
|
|
23
24
|
type Props = {
|
|
24
25
|
anchorId?: string;
|
|
@@ -58,6 +59,10 @@ export class ViroARPlane extends ViroBase<Props> {
|
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
render() {
|
|
62
|
+
if (isQuest) {
|
|
63
|
+
console.warn("[Viro] ViroARPlane is not supported on Quest and will not render.");
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
61
66
|
// Uncomment this line to check for misnamed props
|
|
62
67
|
//checkMisnamedProps("ViroARPlane", this.props);
|
|
63
68
|
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
import { ViroAnchor, ViroPlaneUpdatedMap } from "../Types/ViroEvents";
|
|
15
15
|
import * as React from "react";
|
|
16
|
+
import { isQuest } from "../Utilities/ViroPlatform";
|
|
16
17
|
import { ViroMaterials } from "../Material/ViroMaterials";
|
|
17
18
|
import { ViroNode } from "../ViroNode";
|
|
18
19
|
import { ViroQuad } from "../ViroQuad";
|
|
@@ -416,6 +417,10 @@ export class ViroARPlaneSelector extends React.Component<Props, State> {
|
|
|
416
417
|
// ---------------------------------------------------------------------------
|
|
417
418
|
|
|
418
419
|
render() {
|
|
420
|
+
if (isQuest) {
|
|
421
|
+
console.warn("[Viro] ViroARPlaneSelector is not supported on Quest and will not render.");
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
419
424
|
return <ViroNode>{this._renderPlanes()}</ViroNode>;
|
|
420
425
|
}
|
|
421
426
|
|
|
@@ -50,6 +50,7 @@ import { ViroCamera } from "../ViroCamera";
|
|
|
50
50
|
import { ViroTrackingStateConstants } from "../ViroConstants";
|
|
51
51
|
import { ViroCommonProps } from "./ViroCommonProps";
|
|
52
52
|
import { ViroOrbitCamera } from "components/ViroOrbitCamera";
|
|
53
|
+
import { isQuest } from "../Utilities/ViroPlatform";
|
|
53
54
|
|
|
54
55
|
const ViroCameraModule = NativeModules.ViroCameraModule;
|
|
55
56
|
|
|
@@ -413,6 +414,10 @@ export class ViroARScene extends ViroBase<Props> {
|
|
|
413
414
|
};
|
|
414
415
|
|
|
415
416
|
render() {
|
|
417
|
+
if (isQuest) {
|
|
418
|
+
console.warn("[Viro] ViroARScene is not supported on Quest and will not render. Use ViroScene instead.");
|
|
419
|
+
return null;
|
|
420
|
+
}
|
|
416
421
|
// Uncomment this line to check for misnamed props
|
|
417
422
|
//checkMisnamedProps("ViroARScene", this.props);
|
|
418
423
|
|
|
@@ -18,8 +18,11 @@ import {
|
|
|
18
18
|
NativeModules,
|
|
19
19
|
requireNativeComponent,
|
|
20
20
|
StyleSheet,
|
|
21
|
+
Text,
|
|
22
|
+
View,
|
|
21
23
|
ViewProps,
|
|
22
24
|
} from "react-native";
|
|
25
|
+
import { isQuest } from "../Utilities/ViroPlatform";
|
|
23
26
|
import {
|
|
24
27
|
ViroWorldOrigin,
|
|
25
28
|
ViroProvider,
|
|
@@ -75,6 +78,13 @@ type Props = ViewProps & {
|
|
|
75
78
|
};
|
|
76
79
|
initialSceneKey?: string;
|
|
77
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Optional fallback rendered when this navigator is mounted on a Meta Quest
|
|
83
|
+
* device (where AR is not supported). When omitted, a default message view
|
|
84
|
+
* is rendered. Pass `null` to render nothing.
|
|
85
|
+
*/
|
|
86
|
+
questFallback?: React.ReactNode;
|
|
87
|
+
|
|
78
88
|
autofocus?: boolean;
|
|
79
89
|
/**
|
|
80
90
|
* iOS only props! Note: these props may change as the underlying platforms coalesce in features.
|
|
@@ -232,6 +242,7 @@ type State = {
|
|
|
232
242
|
* ViroARSceneNavigator is used to transition between multiple AR Scenes.
|
|
233
243
|
*/
|
|
234
244
|
export class ViroARSceneNavigator extends React.Component<Props, State> {
|
|
245
|
+
static _questWarningLogged = false;
|
|
235
246
|
_component: ViroNativeRef = null;
|
|
236
247
|
|
|
237
248
|
constructor(props: Props) {
|
|
@@ -1127,6 +1138,16 @@ export class ViroARSceneNavigator extends React.Component<Props, State> {
|
|
|
1127
1138
|
);
|
|
1128
1139
|
};
|
|
1129
1140
|
|
|
1141
|
+
_rvGetProject = async (): Promise<any> => {
|
|
1142
|
+
return await ViroARSceneNavigatorModule.rvGetProject(findNodeHandle(this));
|
|
1143
|
+
};
|
|
1144
|
+
|
|
1145
|
+
_rvGetScene = async (sceneId: string): Promise<any> => {
|
|
1146
|
+
return await ViroARSceneNavigatorModule.rvGetScene(
|
|
1147
|
+
findNodeHandle(this), sceneId
|
|
1148
|
+
);
|
|
1149
|
+
};
|
|
1150
|
+
|
|
1130
1151
|
_rvGetSceneAssets = async (sceneId: string): Promise<any> => {
|
|
1131
1152
|
return await ViroARSceneNavigatorModule.rvGetSceneAssets(
|
|
1132
1153
|
findNodeHandle(this), sceneId
|
|
@@ -1422,6 +1443,8 @@ export class ViroARSceneNavigator extends React.Component<Props, State> {
|
|
|
1422
1443
|
rvAttachAssetToCloudAnchor: this._rvAttachAssetToCloudAnchor,
|
|
1423
1444
|
rvRemoveAssetFromCloudAnchor: this._rvRemoveAssetFromCloudAnchor,
|
|
1424
1445
|
rvTrackCloudAnchorResolution: this._rvTrackCloudAnchorResolution,
|
|
1446
|
+
rvGetProject: this._rvGetProject,
|
|
1447
|
+
rvGetScene: this._rvGetScene,
|
|
1425
1448
|
rvGetSceneAssets: this._rvGetSceneAssets,
|
|
1426
1449
|
// Assets API
|
|
1427
1450
|
rvUploadAsset: this._rvUploadAsset,
|
|
@@ -1481,6 +1504,8 @@ export class ViroARSceneNavigator extends React.Component<Props, State> {
|
|
|
1481
1504
|
rvAttachAssetToCloudAnchor: this._rvAttachAssetToCloudAnchor,
|
|
1482
1505
|
rvRemoveAssetFromCloudAnchor: this._rvRemoveAssetFromCloudAnchor,
|
|
1483
1506
|
rvTrackCloudAnchorResolution: this._rvTrackCloudAnchorResolution,
|
|
1507
|
+
rvGetProject: this._rvGetProject,
|
|
1508
|
+
rvGetScene: this._rvGetScene,
|
|
1484
1509
|
rvGetSceneAssets: this._rvGetSceneAssets,
|
|
1485
1510
|
// Assets API
|
|
1486
1511
|
rvUploadAsset: this._rvUploadAsset,
|
|
@@ -1502,6 +1527,26 @@ export class ViroARSceneNavigator extends React.Component<Props, State> {
|
|
|
1502
1527
|
// Uncomment this line to check for misnamed props
|
|
1503
1528
|
//checkMisnamedProps("ViroARSceneNavigator", this.props);
|
|
1504
1529
|
|
|
1530
|
+
if (isQuest) {
|
|
1531
|
+
if (!ViroARSceneNavigator._questWarningLogged) {
|
|
1532
|
+
console.warn(
|
|
1533
|
+
"[Viro] ViroARSceneNavigator is not supported on Meta Quest. " +
|
|
1534
|
+
"Use ViroXRSceneNavigator (auto-detects Quest) or ViroVRSceneNavigator instead."
|
|
1535
|
+
);
|
|
1536
|
+
ViroARSceneNavigator._questWarningLogged = true;
|
|
1537
|
+
}
|
|
1538
|
+
if ("questFallback" in this.props) {
|
|
1539
|
+
return <>{this.props.questFallback}</>;
|
|
1540
|
+
}
|
|
1541
|
+
return (
|
|
1542
|
+
<View style={[styles.container, styles.questFallback]}>
|
|
1543
|
+
<Text style={styles.questFallbackText}>
|
|
1544
|
+
AR is not supported on Meta Quest.
|
|
1545
|
+
</Text>
|
|
1546
|
+
</View>
|
|
1547
|
+
);
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1505
1550
|
const items = this._renderSceneStackItems();
|
|
1506
1551
|
|
|
1507
1552
|
// update the arSceneNavigator with the latest given props on every render
|
|
@@ -1550,6 +1595,15 @@ const styles = StyleSheet.create({
|
|
|
1550
1595
|
justifyContent: "center",
|
|
1551
1596
|
alignItems: "center",
|
|
1552
1597
|
},
|
|
1598
|
+
questFallback: {
|
|
1599
|
+
backgroundColor: "#000",
|
|
1600
|
+
padding: 24,
|
|
1601
|
+
},
|
|
1602
|
+
questFallbackText: {
|
|
1603
|
+
color: "#fff",
|
|
1604
|
+
fontSize: 16,
|
|
1605
|
+
textAlign: "center",
|
|
1606
|
+
},
|
|
1553
1607
|
});
|
|
1554
1608
|
|
|
1555
1609
|
const VRTARSceneNavigator = requireNativeComponent<any>(
|