@reactvision/react-viro 2.53.1 → 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.
Files changed (153) hide show
  1. package/README.md +85 -46
  2. package/android/react_viro/react_viro-release.aar +0 -0
  3. package/android/viro_renderer/viro_renderer-release.aar +0 -0
  4. package/components/AR/ViroARCamera.tsx +5 -0
  5. package/components/AR/ViroARImageMarker.tsx +5 -0
  6. package/components/AR/ViroARObjectMarker.tsx +5 -0
  7. package/components/AR/ViroARPlane.tsx +5 -0
  8. package/components/AR/ViroARPlaneSelector.tsx +5 -0
  9. package/components/AR/ViroARScene.tsx +5 -0
  10. package/components/AR/ViroARSceneNavigator.tsx +84 -0
  11. package/components/AR/ViroCommonProps.ts +11 -0
  12. package/components/Material/ViroMaterials.ts +51 -0
  13. package/components/Studio/StudioARScene.tsx +368 -0
  14. package/components/Studio/StudioSceneNavigator.tsx +191 -0
  15. package/components/Studio/VRTStudioModule.ts +40 -0
  16. package/components/Studio/domain/animationRegistry.ts +86 -0
  17. package/components/Studio/domain/collisionBindingsRuntime.ts +93 -0
  18. package/components/Studio/domain/collisionPairKey.ts +15 -0
  19. package/components/Studio/domain/dragConfiguration.ts +48 -0
  20. package/components/Studio/domain/materialConfig.ts +276 -0
  21. package/components/Studio/domain/physicsConfig.ts +204 -0
  22. package/components/Studio/domain/sceneNavigationHandler.ts +150 -0
  23. package/components/Studio/domain/studioMaterials.ts +33 -0
  24. package/components/Studio/domain/triggerImageRegistry.ts +64 -0
  25. package/components/Studio/domain/useStudioShaderTimeUniforms.ts +51 -0
  26. package/components/Studio/domain/useStudioShaderViewportUniforms.ts +52 -0
  27. package/components/Studio/domain/viroNodeFactory.tsx +323 -0
  28. package/components/Studio/index.ts +18 -0
  29. package/components/Studio/types.ts +164 -0
  30. package/components/Types/ViroEvents.ts +53 -0
  31. package/components/Utilities/VRModuleOpenXR.ts +50 -0
  32. package/components/Utilities/VRQuestNavigatorBridge.ts +168 -0
  33. package/components/Utilities/ViroPlatform.ts +52 -0
  34. package/components/Utilities/ViroUtils.tsx +48 -0
  35. package/components/Utilities/ViroVersion.ts +1 -1
  36. package/components/Utilities/useAnySourceHover.ts +55 -0
  37. package/components/Utilities/useAnySourcePressed.ts +70 -0
  38. package/components/Viro360Image.tsx +7 -0
  39. package/components/ViroQuestEntryPoint.tsx +79 -0
  40. package/components/ViroVRSceneNavigator.tsx +44 -19
  41. package/components/ViroXRSceneNavigator.tsx +217 -0
  42. package/components/VisionOS/ViroVisionOSModule.ts +93 -0
  43. package/dist/components/AR/ViroARCamera.d.ts +1 -1
  44. package/dist/components/AR/ViroARCamera.js +5 -0
  45. package/dist/components/AR/ViroARImageMarker.d.ts +1 -1
  46. package/dist/components/AR/ViroARImageMarker.js +5 -0
  47. package/dist/components/AR/ViroARObjectMarker.d.ts +1 -1
  48. package/dist/components/AR/ViroARObjectMarker.js +5 -0
  49. package/dist/components/AR/ViroARPlane.d.ts +1 -1
  50. package/dist/components/AR/ViroARPlane.js +5 -0
  51. package/dist/components/AR/ViroARPlaneSelector.d.ts +1 -1
  52. package/dist/components/AR/ViroARPlaneSelector.js +5 -0
  53. package/dist/components/AR/ViroARScene.d.ts +1 -1
  54. package/dist/components/AR/ViroARScene.js +5 -0
  55. package/dist/components/AR/ViroARSceneNavigator.d.ts +36 -0
  56. package/dist/components/AR/ViroARSceneNavigator.js +41 -0
  57. package/dist/components/AR/ViroCommonProps.d.ts +11 -0
  58. package/dist/components/Material/ViroMaterials.d.ts +12 -0
  59. package/dist/components/Material/ViroMaterials.js +25 -0
  60. package/dist/components/ReactVisionClient.d.ts +25 -0
  61. package/dist/components/ReactVisionClient.js +11 -0
  62. package/dist/components/Studio/StudioARScene.d.ts +15 -0
  63. package/dist/components/Studio/StudioARScene.js +299 -0
  64. package/dist/components/Studio/StudioSceneNavigator.d.ts +31 -0
  65. package/dist/components/Studio/StudioSceneNavigator.js +174 -0
  66. package/dist/components/Studio/VRTStudioModule.d.ts +15 -0
  67. package/dist/components/Studio/VRTStudioModule.js +31 -0
  68. package/dist/components/Studio/domain/animationRegistry.d.ts +11 -0
  69. package/dist/components/Studio/domain/animationRegistry.js +67 -0
  70. package/dist/components/Studio/domain/collisionBindingsRuntime.d.ts +21 -0
  71. package/dist/components/Studio/domain/collisionBindingsRuntime.js +54 -0
  72. package/dist/components/Studio/domain/collisionPairKey.d.ts +8 -0
  73. package/dist/components/Studio/domain/collisionPairKey.js +15 -0
  74. package/dist/components/Studio/domain/dragConfiguration.d.ts +20 -0
  75. package/dist/components/Studio/domain/dragConfiguration.js +37 -0
  76. package/dist/components/Studio/domain/materialConfig.d.ts +56 -0
  77. package/dist/components/Studio/domain/materialConfig.js +239 -0
  78. package/dist/components/Studio/domain/physicsConfig.d.ts +69 -0
  79. package/dist/components/Studio/domain/physicsConfig.js +165 -0
  80. package/dist/components/Studio/domain/sceneNavigationHandler.d.ts +12 -0
  81. package/dist/components/Studio/domain/sceneNavigationHandler.js +112 -0
  82. package/dist/components/Studio/domain/studioMaterials.d.ts +6 -0
  83. package/dist/components/Studio/domain/studioMaterials.js +30 -0
  84. package/dist/components/Studio/domain/triggerImageRegistry.d.ts +13 -0
  85. package/dist/components/Studio/domain/triggerImageRegistry.js +47 -0
  86. package/dist/components/Studio/domain/useStudioShaderTimeUniforms.d.ts +6 -0
  87. package/dist/components/Studio/domain/useStudioShaderTimeUniforms.js +48 -0
  88. package/dist/components/Studio/domain/useStudioShaderViewportUniforms.d.ts +6 -0
  89. package/dist/components/Studio/domain/useStudioShaderViewportUniforms.js +48 -0
  90. package/dist/components/Studio/domain/viroNodeFactory.d.ts +28 -0
  91. package/dist/components/Studio/domain/viroNodeFactory.js +193 -0
  92. package/dist/components/Studio/index.d.ts +3 -0
  93. package/dist/components/Studio/index.js +7 -0
  94. package/dist/components/Studio/types.d.ts +149 -0
  95. package/dist/components/Studio/types.js +4 -0
  96. package/dist/components/Types/ViroEvents.d.ts +49 -1
  97. package/dist/components/Types/ViroEvents.js +1 -0
  98. package/dist/components/Utilities/VRModuleOpenXR.d.ts +32 -0
  99. package/dist/components/Utilities/VRModuleOpenXR.js +44 -0
  100. package/dist/components/Utilities/VRQuestNavigatorBridge.d.ts +85 -0
  101. package/dist/components/Utilities/VRQuestNavigatorBridge.js +124 -0
  102. package/dist/components/Utilities/ViroPlatform.d.ts +10 -0
  103. package/dist/components/Utilities/ViroPlatform.js +43 -0
  104. package/dist/components/Utilities/ViroUtils.d.ts +19 -0
  105. package/dist/components/Utilities/ViroUtils.js +34 -0
  106. package/dist/components/Utilities/ViroVersion.d.ts +1 -1
  107. package/dist/components/Utilities/ViroVersion.js +1 -1
  108. package/dist/components/Utilities/useAnySourceHover.d.ts +36 -0
  109. package/dist/components/Utilities/useAnySourceHover.js +48 -0
  110. package/dist/components/Utilities/useAnySourcePressed.d.ts +37 -0
  111. package/dist/components/Utilities/useAnySourcePressed.js +61 -0
  112. package/dist/components/Viro360Image.d.ts +7 -0
  113. package/dist/components/ViroQuestEntryPoint.d.ts +13 -0
  114. package/dist/components/ViroQuestEntryPoint.js +104 -0
  115. package/dist/components/ViroVRSceneNavigator.d.ts +24 -10
  116. package/dist/components/ViroVRSceneNavigator.js +21 -18
  117. package/dist/components/ViroXRSceneNavigator.d.ts +54 -0
  118. package/dist/components/ViroXRSceneNavigator.js +173 -0
  119. package/dist/components/VisionOS/ViroVisionOSModule.d.ts +65 -0
  120. package/dist/components/VisionOS/ViroVisionOSModule.js +91 -0
  121. package/dist/index.d.ts +16 -3
  122. package/dist/index.js +34 -2
  123. package/dist/plugins/withViro.d.ts +28 -1
  124. package/dist/plugins/withViroAndroid.js +312 -7
  125. package/dist/plugins/withViroIos.js +17 -8
  126. package/dist/plugins/withViroVisionOS.d.ts +24 -0
  127. package/dist/plugins/withViroVisionOS.js +265 -0
  128. package/index.ts +66 -0
  129. package/ios/ViroReact.podspec +15 -5
  130. package/ios/dist/ViroRenderer/ViroKit.framework/ARCoreCoreMLSemanticsResources.bundle/Info.plist +0 -0
  131. package/ios/dist/ViroRenderer/ViroKit.framework/ARCoreResources.bundle/Info.plist +0 -0
  132. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARSession.h +30 -1
  133. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARSessioniOS.h +16 -0
  134. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROGLTFLoader.h +34 -0
  135. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROInputControllerBase.h +74 -0
  136. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROInputType.h +11 -3
  137. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROMaterial.h +29 -0
  138. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROMorpher.h +4 -0
  139. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROPlatformUtil.h +13 -0
  140. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROPortal.h +17 -0
  141. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VRORenderContext.h +41 -0
  142. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VRORenderer.h +23 -0
  143. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROSemantics.h +14 -0
  144. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROViewAR.h +11 -0
  145. package/ios/dist/ViroRenderer/ViroKit.framework/Info.plist +0 -0
  146. package/ios/dist/ViroRenderer/ViroKit.framework/Shaders.dat +1 -1
  147. package/ios/dist/ViroRenderer/ViroKit.framework/ViroKit +0 -0
  148. package/ios/dist/ViroRenderer/ViroKit.podspec +5 -0
  149. package/ios/dist/include/VRT360Image.h +1 -0
  150. package/ios/dist/include/VRTARSceneNavigator.h +7 -0
  151. package/ios/dist/include/VRTStudioModule.h +6 -0
  152. package/ios/dist/lib/libViroReact.a +0 -0
  153. package/package.json +8 -8
@@ -0,0 +1,36 @@
1
+ import type { Viro3DPoint } from "../Types/ViroUtils";
2
+ /**
3
+ * Aggregate `onHover` state across all input sources.
4
+ *
5
+ * On Quest (and any other backend that supports multiple simultaneous
6
+ * pointers — e.g. left + right controllers, or controller + tracked hand),
7
+ * Viro fires the node's `onHover` callback **per source**. A second pointer
8
+ * sweeping over an already-hovered node would otherwise produce spurious
9
+ * enter/exit toggles in JS even though the visual hover should remain "on".
10
+ *
11
+ * This hook tracks each source ID independently and exposes a single
12
+ * aggregated boolean — `true` whenever **any** source is hovering the node.
13
+ * Apps that don't care about per-source distinction (the common case for
14
+ * UI buttons) can just consume the boolean.
15
+ *
16
+ * Usage:
17
+ * ```tsx
18
+ * function MyButton() {
19
+ * const [hovered, onHover] = useAnySourceHover();
20
+ * return (
21
+ * <ViroNode onHover={onHover}>
22
+ * <ViroQuad materials={[hovered ? "btnHover" : "btnIdle"]} ... />
23
+ * </ViroNode>
24
+ * );
25
+ * }
26
+ * ```
27
+ *
28
+ * The handler signature matches Viro's `onHover` prop directly — pass it as
29
+ * `onHover={onHover}` with no wrapper. Internally the hook deduplicates per
30
+ * source so a sequence of `(true, …, src=A)` events from the same source
31
+ * produces at most one re-render.
32
+ */
33
+ export declare function useAnySourceHover(): readonly [
34
+ boolean,
35
+ (isHovering: boolean, position: Viro3DPoint, source: unknown) => void
36
+ ];
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAnySourceHover = useAnySourceHover;
4
+ const react_1 = require("react");
5
+ /**
6
+ * Aggregate `onHover` state across all input sources.
7
+ *
8
+ * On Quest (and any other backend that supports multiple simultaneous
9
+ * pointers — e.g. left + right controllers, or controller + tracked hand),
10
+ * Viro fires the node's `onHover` callback **per source**. A second pointer
11
+ * sweeping over an already-hovered node would otherwise produce spurious
12
+ * enter/exit toggles in JS even though the visual hover should remain "on".
13
+ *
14
+ * This hook tracks each source ID independently and exposes a single
15
+ * aggregated boolean — `true` whenever **any** source is hovering the node.
16
+ * Apps that don't care about per-source distinction (the common case for
17
+ * UI buttons) can just consume the boolean.
18
+ *
19
+ * Usage:
20
+ * ```tsx
21
+ * function MyButton() {
22
+ * const [hovered, onHover] = useAnySourceHover();
23
+ * return (
24
+ * <ViroNode onHover={onHover}>
25
+ * <ViroQuad materials={[hovered ? "btnHover" : "btnIdle"]} ... />
26
+ * </ViroNode>
27
+ * );
28
+ * }
29
+ * ```
30
+ *
31
+ * The handler signature matches Viro's `onHover` prop directly — pass it as
32
+ * `onHover={onHover}` with no wrapper. Internally the hook deduplicates per
33
+ * source so a sequence of `(true, …, src=A)` events from the same source
34
+ * produces at most one re-render.
35
+ */
36
+ function useAnySourceHover() {
37
+ const sourcesRef = (0, react_1.useRef)({});
38
+ const [hovered, setHovered] = (0, react_1.useState)(false);
39
+ const onHover = (0, react_1.useCallback)((isHovering, _position, source) => {
40
+ const key = String(source ?? "default");
41
+ if (sourcesRef.current[key] === isHovering)
42
+ return;
43
+ sourcesRef.current[key] = isHovering;
44
+ const any = Object.values(sourcesRef.current).some(Boolean);
45
+ setHovered(any);
46
+ }, []);
47
+ return [hovered, onHover];
48
+ }
@@ -0,0 +1,37 @@
1
+ import { ViroClickState } from "../Types/ViroEvents";
2
+ import type { Viro3DPoint } from "../Types/ViroUtils";
3
+ /**
4
+ * Aggregate `onClickState` "is being pressed" state across all input sources.
5
+ *
6
+ * Mirror of `useAnySourceHover` for clicks. Tracks per-source `CLICK_DOWN` /
7
+ * `CLICK_UP` events from any input source (right + left controllers / hands)
8
+ * and returns a single aggregated boolean — `true` whenever **any** source
9
+ * is currently holding the trigger / pinch on this node.
10
+ *
11
+ * The fully-completed `CLICKED` event is intentionally ignored here: it is
12
+ * informational ("a complete click happened") and shouldn't toggle the
13
+ * held-state. Apps that need the click event itself can use the regular
14
+ * `onClick` prop — those callbacks already pass the `source`.
15
+ *
16
+ * Usage:
17
+ * ```tsx
18
+ * function MyButton() {
19
+ * const [pressed, onClickState] = useAnySourcePressed();
20
+ * return (
21
+ * <ViroNode onClickState={onClickState} onClick={...}>
22
+ * <ViroQuad
23
+ * scale={pressed ? [0.95, 0.95, 0.95] : [1, 1, 1]}
24
+ * materials={[pressed ? "btnPressed" : "btnIdle"]}
25
+ * />
26
+ * </ViroNode>
27
+ * );
28
+ * }
29
+ * ```
30
+ *
31
+ * Internally deduplicates per source so a sequence of `(CLICK_DOWN, src=A)`
32
+ * events from the same source produces at most one re-render.
33
+ */
34
+ export declare function useAnySourcePressed(): readonly [
35
+ boolean,
36
+ (clickState: ViroClickState, position: Viro3DPoint, source: unknown) => void
37
+ ];
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAnySourcePressed = useAnySourcePressed;
4
+ const react_1 = require("react");
5
+ const ViroEvents_1 = require("../Types/ViroEvents");
6
+ /**
7
+ * Aggregate `onClickState` "is being pressed" state across all input sources.
8
+ *
9
+ * Mirror of `useAnySourceHover` for clicks. Tracks per-source `CLICK_DOWN` /
10
+ * `CLICK_UP` events from any input source (right + left controllers / hands)
11
+ * and returns a single aggregated boolean — `true` whenever **any** source
12
+ * is currently holding the trigger / pinch on this node.
13
+ *
14
+ * The fully-completed `CLICKED` event is intentionally ignored here: it is
15
+ * informational ("a complete click happened") and shouldn't toggle the
16
+ * held-state. Apps that need the click event itself can use the regular
17
+ * `onClick` prop — those callbacks already pass the `source`.
18
+ *
19
+ * Usage:
20
+ * ```tsx
21
+ * function MyButton() {
22
+ * const [pressed, onClickState] = useAnySourcePressed();
23
+ * return (
24
+ * <ViroNode onClickState={onClickState} onClick={...}>
25
+ * <ViroQuad
26
+ * scale={pressed ? [0.95, 0.95, 0.95] : [1, 1, 1]}
27
+ * materials={[pressed ? "btnPressed" : "btnIdle"]}
28
+ * />
29
+ * </ViroNode>
30
+ * );
31
+ * }
32
+ * ```
33
+ *
34
+ * Internally deduplicates per source so a sequence of `(CLICK_DOWN, src=A)`
35
+ * events from the same source produces at most one re-render.
36
+ */
37
+ function useAnySourcePressed() {
38
+ const sourcesRef = (0, react_1.useRef)({});
39
+ const [pressed, setPressed] = (0, react_1.useState)(false);
40
+ const onClickState = (0, react_1.useCallback)((clickState, _position, source) => {
41
+ let next;
42
+ if (clickState === ViroEvents_1.ViroClickStateTypes.CLICK_DOWN) {
43
+ next = true;
44
+ }
45
+ else if (clickState === ViroEvents_1.ViroClickStateTypes.CLICK_UP) {
46
+ next = false;
47
+ }
48
+ else {
49
+ // CLICKED is fired between DOWN and UP for completed clicks —
50
+ // doesn't change held state, ignore.
51
+ return;
52
+ }
53
+ const key = String(source ?? "default");
54
+ if (sourcesRef.current[key] === next)
55
+ return;
56
+ sourcesRef.current[key] = next;
57
+ const any = Object.values(sourcesRef.current).some(Boolean);
58
+ setPressed(any);
59
+ }, []);
60
+ return [pressed, onClickState];
61
+ }
@@ -11,6 +11,13 @@ type Props = ViewProps & {
11
11
  format?: "RGBA8" | "RGB565";
12
12
  steroMode?: "LeftRight" | "RightLeft" | "TopBottom" | "BottomTop" | "None";
13
13
  isHdr?: boolean;
14
+ /**
15
+ * When true, the image is rendered as a sky-effect overlay: it appears only over pixels
16
+ * semantically labeled as sky by ARCore/ARKit scene semantics, using alpha blending via
17
+ * the confidence texture for smooth boundary transitions. Requires scene semantics to be
18
+ * enabled on the AR session. Has no effect in VR mode. Default false.
19
+ */
20
+ skyEffect?: boolean;
14
21
  /**
15
22
  * Callback triggered when we are processing the assets to be
16
23
  * displayed in this 360 Photo (either downloading / reading from file).
@@ -0,0 +1,13 @@
1
+ import * as React from "react";
2
+ /**
3
+ * Drop-in root component for VRActivity on Meta Quest.
4
+ *
5
+ * The library auto-registers this as 'VRQuestScene' when imported, so most
6
+ * apps need no manual setup. ViroXRSceneNavigator (panel side) calls
7
+ * setIntent() with the initial scene and renderer config before launching
8
+ * VRActivity. This component reads that intent, mounts ViroVRSceneNavigator
9
+ * with key={intentKey} (fresh stack per intent), and populates the bridge
10
+ * viewTag so VRModuleOpenXR ops (recenterTracking, setPassthroughEnabled)
11
+ * work without a direct ref to ViroVRSceneNavigator.
12
+ */
13
+ export declare function ViroQuestEntryPoint(): React.JSX.Element | null;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ViroQuestEntryPoint = ViroQuestEntryPoint;
37
+ const React = __importStar(require("react"));
38
+ const react_native_1 = require("react-native");
39
+ const VRQuestNavigatorBridge_1 = require("./Utilities/VRQuestNavigatorBridge");
40
+ const VRModuleOpenXR_1 = require("./Utilities/VRModuleOpenXR");
41
+ const ViroVRSceneNavigator_1 = require("./ViroVRSceneNavigator");
42
+ /**
43
+ * Drop-in root component for VRActivity on Meta Quest.
44
+ *
45
+ * The library auto-registers this as 'VRQuestScene' when imported, so most
46
+ * apps need no manual setup. ViroXRSceneNavigator (panel side) calls
47
+ * setIntent() with the initial scene and renderer config before launching
48
+ * VRActivity. This component reads that intent, mounts ViroVRSceneNavigator
49
+ * with key={intentKey} (fresh stack per intent), and populates the bridge
50
+ * viewTag so VRModuleOpenXR ops (recenterTracking, setPassthroughEnabled)
51
+ * work without a direct ref to ViroVRSceneNavigator.
52
+ */
53
+ function ViroQuestEntryPoint() {
54
+ const [intent, setIntent] = React.useState(() => VRQuestNavigatorBridge_1.VRQuestNavigatorBridge.getIntent());
55
+ const navRef = React.useRef(null);
56
+ React.useEffect(() => VRQuestNavigatorBridge_1.VRQuestNavigatorBridge.onIntent(setIntent), []);
57
+ // Wire hardware back button to exit VR. Apps that need custom back behaviour
58
+ // can call AppRegistry.registerComponent('VRQuestScene', ...) to override.
59
+ React.useEffect(() => {
60
+ const sub = react_native_1.BackHandler.addEventListener("hardwareBackPress", () => {
61
+ (0, VRModuleOpenXR_1.exitVRScene)();
62
+ return true;
63
+ });
64
+ return () => sub.remove();
65
+ }, []);
66
+ // Forward bridge ops (push/pop/etc.) to the live navigator.
67
+ React.useEffect(() => {
68
+ if (!intent)
69
+ return;
70
+ return VRQuestNavigatorBridge_1.VRQuestNavigatorBridge.subscribeOps((op) => {
71
+ const nav = navRef.current;
72
+ if (!nav)
73
+ return;
74
+ if (op.type === "push")
75
+ nav.push(op.scene);
76
+ else if (op.type === "pop")
77
+ nav.pop();
78
+ else if (op.type === "popN")
79
+ nav.popN(op.n);
80
+ else if (op.type === "replace")
81
+ nav.replace(op.scene);
82
+ else if (op.type === "jump")
83
+ nav.jump(op.scene);
84
+ });
85
+ }, [intent?.intentKey]);
86
+ // Publish the native view tag so VRModuleOpenXR callers can target this view.
87
+ React.useEffect(() => {
88
+ if (!intent)
89
+ return;
90
+ const t = setTimeout(() => {
91
+ const tag = (0, react_native_1.findNodeHandle)(navRef.current);
92
+ if (tag != null)
93
+ VRQuestNavigatorBridge_1.VRQuestNavigatorBridge.setViewTag(tag);
94
+ }, 100);
95
+ return () => {
96
+ clearTimeout(t);
97
+ VRQuestNavigatorBridge_1.VRQuestNavigatorBridge.setViewTag(null);
98
+ };
99
+ }, [intent?.intentKey]);
100
+ if (!intent)
101
+ return null;
102
+ const { initialScene, rendererConfig } = intent;
103
+ return (<ViroVRSceneNavigator_1.ViroVRSceneNavigator ref={navRef} key={intent.intentKey} initialScene={initialScene} {...rendererConfig} style={react_native_1.StyleSheet.absoluteFill}/>);
104
+ }
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import * as React from "react";
13
13
  import { NativeSyntheticEvent, ViewProps } from "react-native";
14
- import { ViroExitViroEvent } from "./Types/ViroEvents";
14
+ import { ViroExitViroEvent, ViroHandUpdateEvent } from "./Types/ViroEvents";
15
15
  import { Viro3DPoint, ViroNativeRef, ViroScene, ViroSceneDictionary } from "./Types/ViroUtils";
16
16
  type State = {
17
17
  sceneDictionary: ViroSceneDictionary;
@@ -54,9 +54,23 @@ type Props = ViewProps & {
54
54
  bloomEnabled?: boolean;
55
55
  shadowsEnabled?: boolean;
56
56
  multisamplingEnabled?: boolean;
57
+ /** Enable XR_FB_passthrough mixed-reality camera feed (Quest 3 / Quest Pro). */
58
+ passthroughEnabled?: boolean;
59
+ /**
60
+ * Enable skeletal hand tracking (Quest — requires com.oculus.permission.HAND_TRACKING in manifest).
61
+ * Pinch and grab gestures fire the same onClick/onDrag events as controller buttons.
62
+ */
63
+ handTrackingEnabled?: boolean;
64
+ /**
65
+ * Per-frame skeletal hand joint data. Fires at display refresh rate (72/90 Hz).
66
+ * null for a hand means it is not currently tracked.
67
+ */
68
+ onHandUpdate?: (event: NativeSyntheticEvent<ViroHandUpdateEvent>) => void;
57
69
  };
58
70
  /**
59
71
  * ViroVRSceneNavigator is used to transition between multiple scenes.
72
+ * Intended for OVR / Google Cardboard VR mode on non-Quest Android devices.
73
+ * On Meta Quest use ViroXRSceneNavigator instead.
60
74
  */
61
75
  export declare class ViroVRSceneNavigator extends React.Component<Props, State> {
62
76
  _component: ViroNativeRef;
@@ -64,7 +78,7 @@ export declare class ViroVRSceneNavigator extends React.Component<Props, State>
64
78
  * Called from native when either the user physically decides to exit vr (hits
65
79
  * the "X" buton).
66
80
  */
67
- _onExitViro(_event: NativeSyntheticEvent<ViroExitViroEvent>): void;
81
+ _onExitViro: (_event: NativeSyntheticEvent<ViroExitViroEvent>) => void;
68
82
  constructor(props: Props);
69
83
  getRandomTag(): string;
70
84
  /**
@@ -81,7 +95,7 @@ export declare class ViroVRSceneNavigator extends React.Component<Props, State>
81
95
  *
82
96
  * @todo: use Typescript function overloading rather than this inaccurate solution
83
97
  */
84
- push(param1?: ViroScene | string, param2?: ViroScene): void;
98
+ push: (param1?: ViroScene | string, param2?: ViroScene) => void;
85
99
  /**
86
100
  * Replace the top scene in the stack with the given scene. The remainder of the back
87
101
  * history is kept in the same order as before.
@@ -93,7 +107,7 @@ export declare class ViroVRSceneNavigator extends React.Component<Props, State>
93
107
  *
94
108
  * @todo: use Typescript function overloading rather than this inaccurate solution
95
109
  */
96
- replace(param1?: ViroScene | string, param2?: ViroScene): void;
110
+ replace: (param1?: ViroScene | string, param2?: ViroScene) => void;
97
111
  /**
98
112
  * Jumps to a given scene that had been previously pushed. If the scene was not pushed, we
99
113
  * then push and jump to it. The back history is re-ordered such that jumped to scenes are
@@ -106,9 +120,9 @@ export declare class ViroVRSceneNavigator extends React.Component<Props, State>
106
120
  *
107
121
  * @todo: use Typescript function overloading rather than this inaccurate solution
108
122
  */
109
- jump(param1?: ViroScene | string, param2?: ViroScene): void;
110
- pop(): void;
111
- popN(n: number): void;
123
+ jump: (param1?: ViroScene | string, param2?: ViroScene) => void;
124
+ pop: () => void;
125
+ popN: (n: number) => void;
112
126
  /**
113
127
  * Increments the reference count for a scene within sceneDictionary that is
114
128
  * mapped to the given sceneKey. If no scenes are found / mapped, we create
@@ -136,9 +150,9 @@ export declare class ViroVRSceneNavigator extends React.Component<Props, State>
136
150
  reorderHistory(sceneKey: string): void;
137
151
  popHistoryByN(n: number): void;
138
152
  getSceneIndex(sceneTag: string): number;
139
- _recenterTracking(): void;
140
- _project(point: Viro3DPoint): Promise<any>;
141
- _unproject(point: Viro3DPoint): Promise<any>;
153
+ _recenterTracking: () => void;
154
+ _project: (point: Viro3DPoint) => Promise<any>;
155
+ _unproject: (point: Viro3DPoint) => Promise<any>;
142
156
  _renderSceneStackItems(): React.JSX.Element[];
143
157
  sceneNavigator: {
144
158
  push: (param1?: ViroScene | string, param2?: ViroScene) => void;
@@ -48,9 +48,12 @@ exports.ViroVRSceneNavigator = void 0;
48
48
  const React = __importStar(require("react"));
49
49
  const react_native_1 = require("react-native");
50
50
  const ViroSceneNavigatorModule = react_native_1.NativeModules.VRTSceneNavigatorModule;
51
+ const VRModuleOpenXR = react_native_1.NativeModules.VRModuleOpenXR;
51
52
  var mathRandomOffset = 0;
52
53
  /**
53
54
  * ViroVRSceneNavigator is used to transition between multiple scenes.
55
+ * Intended for OVR / Google Cardboard VR mode on non-Quest Android devices.
56
+ * On Meta Quest use ViroXRSceneNavigator instead.
54
57
  */
55
58
  class ViroVRSceneNavigator extends React.Component {
56
59
  _component = null;
@@ -58,9 +61,9 @@ class ViroVRSceneNavigator extends React.Component {
58
61
  * Called from native when either the user physically decides to exit vr (hits
59
62
  * the "X" buton).
60
63
  */
61
- _onExitViro(_event) {
64
+ _onExitViro = (_event) => {
62
65
  this.props.onExitViro && this.props.onExitViro();
63
- }
66
+ };
64
67
  constructor(props) {
65
68
  super(props);
66
69
  let initialSceneTag = props.initialSceneKey;
@@ -99,7 +102,7 @@ class ViroVRSceneNavigator extends React.Component {
99
102
  *
100
103
  * @todo: use Typescript function overloading rather than this inaccurate solution
101
104
  */
102
- push(param1, param2) {
105
+ push = (param1, param2) => {
103
106
  var sceneKey = undefined;
104
107
  var scene = undefined;
105
108
  if (typeof param1 == "string") {
@@ -125,7 +128,7 @@ class ViroVRSceneNavigator extends React.Component {
125
128
  }
126
129
  this.incrementSceneReference(scene, sceneKey, false);
127
130
  this.addToHistory(sceneKey);
128
- }
131
+ };
129
132
  /**
130
133
  * Replace the top scene in the stack with the given scene. The remainder of the back
131
134
  * history is kept in the same order as before.
@@ -137,7 +140,7 @@ class ViroVRSceneNavigator extends React.Component {
137
140
  *
138
141
  * @todo: use Typescript function overloading rather than this inaccurate solution
139
142
  */
140
- replace(param1, param2) {
143
+ replace = (param1, param2) => {
141
144
  var sceneKey = undefined;
142
145
  var scene = undefined;
143
146
  if (typeof param1 == "string") {
@@ -167,7 +170,7 @@ class ViroVRSceneNavigator extends React.Component {
167
170
  this.popHistoryByN(1);
168
171
  this.incrementSceneReference(scene, sceneKey, false);
169
172
  this.addToHistory(sceneKey);
170
- }
173
+ };
171
174
  /**
172
175
  * Jumps to a given scene that had been previously pushed. If the scene was not pushed, we
173
176
  * then push and jump to it. The back history is re-ordered such that jumped to scenes are
@@ -180,7 +183,7 @@ class ViroVRSceneNavigator extends React.Component {
180
183
  *
181
184
  * @todo: use Typescript function overloading rather than this inaccurate solution
182
185
  */
183
- jump(param1, param2) {
186
+ jump = (param1, param2) => {
184
187
  var sceneKey = undefined;
185
188
  var scene = undefined;
186
189
  if (typeof param1 == "string") {
@@ -206,11 +209,11 @@ class ViroVRSceneNavigator extends React.Component {
206
209
  }
207
210
  this.incrementSceneReference(scene, sceneKey, true);
208
211
  this.reorderHistory(sceneKey);
209
- }
210
- pop() {
212
+ };
213
+ pop = () => {
211
214
  this.popN(1);
212
- }
213
- popN(n) {
215
+ };
216
+ popN = (n) => {
214
217
  if (n === 0) {
215
218
  return;
216
219
  }
@@ -220,7 +223,7 @@ class ViroVRSceneNavigator extends React.Component {
220
223
  }
221
224
  this.decrementReferenceForLastNScenes(n);
222
225
  this.popHistoryByN(n);
223
- }
226
+ };
224
227
  /**
225
228
  * Increments the reference count for a scene within sceneDictionary that is
226
229
  * mapped to the given sceneKey. If no scenes are found / mapped, we create
@@ -335,15 +338,15 @@ class ViroVRSceneNavigator extends React.Component {
335
338
  // Unable to find the given sceneTag, return -1
336
339
  return -1;
337
340
  }
338
- _recenterTracking() {
341
+ _recenterTracking = () => {
339
342
  ViroSceneNavigatorModule.recenterTracking((0, react_native_1.findNodeHandle)(this));
340
- }
341
- async _project(point) {
343
+ };
344
+ _project = async (point) => {
342
345
  return await ViroSceneNavigatorModule.project((0, react_native_1.findNodeHandle)(this), point);
343
- }
344
- async _unproject(point) {
346
+ };
347
+ _unproject = async (point) => {
345
348
  return await ViroSceneNavigatorModule.unproject((0, react_native_1.findNodeHandle)(this), point);
346
- }
349
+ };
347
350
  _renderSceneStackItems() {
348
351
  let views = [];
349
352
  var i = 0;
@@ -0,0 +1,54 @@
1
+ import * as React from "react";
2
+ import { ViewProps } from "react-native";
3
+ type SceneFactory = {
4
+ scene: () => React.JSX.Element;
5
+ };
6
+ /**
7
+ * Cross-reality scene navigator. Picks the right underlying navigator at runtime:
8
+ *
9
+ * - **iOS / non-Quest Android** → `ViroARSceneNavigator` (rendered inline)
10
+ * - **Meta Quest** → launches VRActivity via `VRLauncher.launchVRScene()` and
11
+ * forwards all navigator operations (push/pop/etc.) to the
12
+ * `ViroVRSceneNavigator` running there via `VRQuestNavigatorBridge`.
13
+ * Render output is null — VRActivity owns the display.
14
+ *
15
+ * Pass `arInitialScene` / `vrInitialScene` when the AR and VR scenes differ.
16
+ * When only `initialScene` is provided it is used for both modes.
17
+ *
18
+ * Renderer flags (`hdrEnabled`, `pbrEnabled`, `bloomEnabled`, `shadowsEnabled`,
19
+ * `passthroughEnabled`, etc.) are forwarded to ViroVRSceneNavigator on Quest
20
+ * via the intent bridge.
21
+ */
22
+ export declare const ViroXRSceneNavigator: React.ForwardRefExoticComponent<ViewProps & {
23
+ /**
24
+ * Scene used on both AR and VR platforms when no platform-specific scene is provided.
25
+ * Most apps want a different scene per platform — pass `arInitialScene` and
26
+ * `vrInitialScene` instead in that case.
27
+ */
28
+ initialScene?: SceneFactory;
29
+ /** Scene mounted on iOS / non-Quest Android (rendered via ViroARSceneNavigator). */
30
+ arInitialScene?: SceneFactory;
31
+ /**
32
+ * Scene mounted on Meta Quest (rendered via ViroVRSceneNavigator in VRActivity).
33
+ * On Quest, this scene is forwarded to VRActivity via VRQuestNavigatorBridge
34
+ * rather than rendered inline, because OpenXR exclusive display requires the
35
+ * VR intent category on the host Activity.
36
+ */
37
+ vrInitialScene?: SceneFactory;
38
+ worldAlignment?: "Gravity" | "GravityAndHeading" | "Camera";
39
+ autofocus?: boolean;
40
+ videoQuality?: "High" | "Low";
41
+ numberOfTrackedImages?: number;
42
+ vrModeEnabled?: boolean;
43
+ passthroughEnabled?: boolean;
44
+ handTrackingEnabled?: boolean;
45
+ onExitViro?: () => void;
46
+ viroAppProps?: any;
47
+ hdrEnabled?: boolean;
48
+ pbrEnabled?: boolean;
49
+ bloomEnabled?: boolean;
50
+ shadowsEnabled?: boolean;
51
+ multisamplingEnabled?: boolean;
52
+ debug?: boolean;
53
+ } & React.RefAttributes<unknown>>;
54
+ export {};