@reactvision/react-viro 2.43.3 → 2.43.4

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 (47) hide show
  1. package/README.md +18 -13
  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/ViroARPlaneSelector.tsx +1 -1
  5. package/components/AR/ViroARSceneNavigator.tsx +16 -17
  6. package/components/Utilities/ViroVersion.ts +1 -1
  7. package/components/ViroVRSceneNavigator.tsx +1 -1
  8. package/dist/components/AR/ViroARPlaneSelector.d.ts +1 -1
  9. package/dist/components/AR/ViroARSceneNavigator.d.ts +9 -9
  10. package/dist/components/AR/ViroARSceneNavigator.js +11 -11
  11. package/dist/components/Utilities/ViroVersion.d.ts +1 -1
  12. package/dist/components/Utilities/ViroVersion.js +1 -1
  13. package/dist/components/ViroVRSceneNavigator.d.ts +1 -1
  14. package/dist/dynamic-index.d.ts +11 -0
  15. package/dist/dynamic-index.js +28 -0
  16. package/dist/plugins/withViro.d.ts +3 -0
  17. package/dist/plugins/withViro.js +19 -0
  18. package/dist/plugins/withViroAndroid.js +33 -69
  19. package/dist/plugins/withViroIos.js +20 -2
  20. package/ios/ViroReact.podspec +49 -11
  21. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROBodyMesher.h +1 -0
  22. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROVideoTextureCache.h +1 -0
  23. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/ViroKit.h +11 -0
  24. package/ios/dist/ViroRenderer/ViroKit.framework/Info.plist +0 -0
  25. package/ios/dist/ViroRenderer/ViroKit.framework/ViroKit +0 -0
  26. package/ios/dist/ViroRenderer/ViroKit.framework/bodymesh.mlmodelc/metadata.json +14 -11
  27. package/ios/dist/ViroRenderer/ViroKit.framework/hourglass_2_1.mlmodelc/metadata.json +12 -9
  28. package/ios/dist/ViroRenderer/ViroKit.framework/hourglass_2_1_ds_t.mlmodelc/metadata.json +12 -9
  29. package/ios/dist/ViroRenderer/ViroKit.framework/hourglass_2_1_t.mlmodelc/metadata.json +12 -9
  30. package/ios/dist/ViroRenderer/ViroKit.podspec +4 -4
  31. package/ios/dist/ViroRenderer/armv7_arm64/ViroKit.framework/Headers/VROBodyMesher.h +1 -0
  32. package/ios/dist/ViroRenderer/armv7_arm64/ViroKit.framework/Headers/VROVideoTextureCache.h +1 -0
  33. package/ios/dist/ViroRenderer/armv7_arm64/ViroKit.framework/Headers/ViroKit.h +11 -0
  34. package/ios/dist/ViroRenderer/armv7_arm64/ViroKit.framework/Info.plist +0 -0
  35. package/ios/dist/ViroRenderer/armv7_arm64/ViroKit.framework/ViroKit +0 -0
  36. package/ios/dist/ViroRenderer/armv7_arm64/ViroKit.framework/bodymesh.mlmodelc/metadata.json +14 -11
  37. package/ios/dist/ViroRenderer/armv7_arm64/ViroKit.framework/hourglass_2_1.mlmodelc/metadata.json +12 -9
  38. package/ios/dist/ViroRenderer/armv7_arm64/ViroKit.framework/hourglass_2_1_ds_t.mlmodelc/metadata.json +12 -9
  39. package/ios/dist/ViroRenderer/armv7_arm64/ViroKit.framework/hourglass_2_1_t.mlmodelc/metadata.json +12 -9
  40. package/ios/dist/armv7_arm64/libViroReact.a +0 -0
  41. package/ios/dist/lib/libViroReact.a +0 -0
  42. package/package.json +15 -9
  43. package/scripts/copy-types.js +46 -0
  44. package/dist/components/Telemetry/ViroTelemetry.d.ts +0 -16
  45. package/dist/components/Telemetry/ViroTelemetry.js +0 -87
  46. package/dist/components/Telemetry/index.d.ts +0 -16
  47. package/dist/components/Telemetry/index.js +0 -97
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/@reactvision/react-viro)](https://www.npmjs.com/package/@reactvision/react-viro)
8
8
  [![downloads](https://img.shields.io/npm/dm/@reactvision/react-viro?color=purple)](https://www.npmjs.com/package/@reactvision/react-viro)
9
- [![Discord](https://img.shields.io/discord/774471080713781259?label=Discord)](https://discord.gg/H3ksm5NhzT)
9
+ [![Discord](https://img.shields.io/discord/774471080713781259?label=Discord)](https://discord.gg/yqqEGUjK)
10
10
 
11
11
  # ViroReact
12
12
 
@@ -37,28 +37,33 @@ If you are starting a fresh project with ViroReact, consider cloning one of our
37
37
 
38
38
  # Examples
39
39
 
40
- See our [Example projects](https://viro-community.readme.io/docs/examples) page. These are a little old (~2019) but are a great reference point for how to use bits of the library.
40
+ Check out the [examples](./examples) directory for sample code demonstrating how to use ViroReact with automatic architecture detection and other features.
41
41
 
42
- # Need help? Or want to contribute?
42
+ You can also see our [Example projects](https://viro-community.readme.io/docs/examples) page. These are a little old (~2019) but are a great reference point for how to use bits of the library.
43
43
 
44
- Whether you're looking for support with building your AR or VR application or you want to contribute to ViroReact, the best way to contact our team is via Discord. If you need more hands-on support with a project, you can visit our documentation site, where we have a [list of trusted partners whom you can hire to help with your project](https://viro-community.readme.io/docs/hire-a-viro-react-expert).
44
+ # Connect with the ReactVision Community
45
45
 
46
- <a href="https://discord.gg/H3ksm5NhzT">
46
+ Whether you're looking for support with building your AR or VR application or you want to contribute to ViroReact, the best way to contact our team and connect with the ReactVision Community is via Discord.
47
+
48
+ <a href="https://discord.gg/yqqEGUjK">
47
49
  <img src="https://discordapp.com/api/guilds/774471080713781259/widget.png?style=banner2" alt="Discord Banner 2"/>
48
50
  </a>
49
51
 
52
+ # External Support
53
+
54
+ If you need hands-on support with a project, you can visit our documentation site, where we have a [list of trusted partners whom you can hire to help with your project](https://viro-community.readme.io/docs/hire-a-viro-react-expert). All partners are vetted by the ReactVision team and all have experience creating production-grade apps with Viro.
55
+
56
+ # Supporters
57
+ A huge thank you to everyone who supports the ongoing development of ReactVision and Viro by [sponsoring us on GitHub](https://github.com/sponsors/ReactVision).
58
+ - [devicecloud-dev](https://github.com/devicecloud-dev) - [Device Cloud](https://devicecloud.dev/)
59
+ - [lentesta](https://github.com/lentesta)
60
+ - [Looking Glass](http://looking-glass.space)
61
+
50
62
  # A little history...
51
63
 
52
64
  ViroReact was originally developed by the [Viro Media](http://www.viromedia.com/), but was open-sourced in 2019. In late 2020, the Viro Community was formed to help maintain and move the project onwards, updating it so it could run with modern versions of React Native, and start to add in new features.
53
65
 
54
- Following years of support, in 2025, [Morrow acquired ReactVision](https://www.themorrow.digital/blog/morrow-acquires-reactvision-and-viroreact-library) to help accelerate its development and give it the resources needed to enable ReactVision to capture the rapidly growing demand for ViroReact. ReactVision now has a team working full-time to help ensure the codebase is updated and ready for the future of XR / Spatial Computing. Our vision is to enable React Native developers to build AR and VR applications that can run across all XR devices (smartphones, smart glasses, and headsets) off of a single React Native codebase.
66
+ Following years of support, in 2025, [Morrow acquired ReactVision](https://www.themorrow.digital/blog/morrow-acquires-reactvision-and-viroreact-library) to help accelerate its development and give it the resources needed to enable ReactVision to capture the rapidly growing demand for ViroReact. ReactVision now has a team working full-time to help ensure the codebase is updated and ready for the future of XR / Spatial Computing. Our vision is to enable React Native developers to build AR and VR applications that can run across all XR devices (smartphones, smart glasses, and headsets) off of a single React Native codebase.
55
67
 
56
68
  We, as a community, owe a great debt to Viro Media and the people who developed this library originally. We hope to make them proud as it continues to develop and grow within ReactVision.
57
69
 
58
- # Supporters
59
-
60
- <p align="center">
61
- <a href="https://themorrow.digital/">
62
- <img src="readmes/morrow-supporter.png" alt="Morrow">
63
- </a>
64
- </p>
@@ -69,7 +69,7 @@ export class ViroARPlaneSelector extends React.Component<Props, State> {
69
69
 
70
70
  _getARPlanes() {
71
71
  // Always render a fixed number of planes, controlling visibility instead of conditional rendering
72
- let arPlanes: JSX.Element[] = [];
72
+ let arPlanes: React.JSX.Element[] = [];
73
73
  let numPlanes = this.props.maxPlanes || _maxPlanes;
74
74
 
75
75
  // Create all plane slots (both detected and placeholder)
@@ -28,7 +28,6 @@ import {
28
28
  ViroSceneDictionary,
29
29
  } from "../Types/ViroUtils";
30
30
 
31
-
32
31
  const ViroARSceneNavigatorModule = NativeModules.VRTARSceneNavigatorModule;
33
32
 
34
33
  let mathRandomOffset = 0;
@@ -42,7 +41,7 @@ type Props = ViewProps & {
42
41
  /**
43
42
  * The React Class to render for this scene.
44
43
  */
45
- scene: () => JSX.Element;
44
+ scene: () => React.JSX.Element;
46
45
  };
47
46
  initialSceneKey?: string;
48
47
 
@@ -152,12 +151,25 @@ export class ViroARSceneNavigator extends React.Component<Props, State> {
152
151
  * @param point
153
152
  * @returns
154
153
  */
155
- async _project(point: Viro3DPoint) {
154
+ _project = async (point: Viro3DPoint) => {
156
155
  return await ViroARSceneNavigatorModule.project(
157
156
  findNodeHandle(this),
158
157
  point
159
158
  );
160
- }
159
+ };
160
+
161
+ /**
162
+ * TODO: Document _unproject
163
+ *
164
+ * @param point
165
+ * @returns
166
+ */
167
+ _unproject = async (point: Viro3DPoint) => {
168
+ return await ViroARSceneNavigatorModule.unproject(
169
+ findNodeHandle(this),
170
+ point
171
+ );
172
+ };
161
173
 
162
174
  /**
163
175
  * Gets a random tag string.
@@ -506,19 +518,6 @@ export class ViroARSceneNavigator extends React.Component<Props, State> {
506
518
  return -1;
507
519
  };
508
520
 
509
- /**
510
- * TODO: Document _unproject
511
- *
512
- * @param point
513
- * @returns
514
- */
515
- _unproject = async (point: Viro3DPoint) => {
516
- return await ViroARSceneNavigatorModule.unproject(
517
- findNodeHandle(this),
518
- point
519
- );
520
- };
521
-
522
521
  /**
523
522
  * [iOS Only]
524
523
  *
@@ -1 +1 @@
1
- export const VIRO_VERSION = "2.43.3";
1
+ export const VIRO_VERSION = "2.43.4";
@@ -59,7 +59,7 @@ type Props = ViewProps & {
59
59
  * describe a scene.
60
60
  */
61
61
  initialScene?: {
62
- scene: () => JSX.Element;
62
+ scene: () => React.JSX.Element;
63
63
  };
64
64
 
65
65
  /**
@@ -37,7 +37,7 @@ export declare class ViroARPlaneSelector extends React.Component<Props, State> {
37
37
  arPlaneSizes: number[];
38
38
  };
39
39
  render(): React.JSX.Element;
40
- _getARPlanes(): JSX.Element[];
40
+ _getARPlanes(): React.JSX.Element[];
41
41
  _getOnClickSurface: (index: number, event: ViroClickStateEvent) => void;
42
42
  _onARPlaneUpdated: (index: number) => (updateMap: ViroPlaneUpdatedMap) => void;
43
43
  _onPlaneSelected: (updateMap: ViroPlaneUpdatedMap) => void;
@@ -22,7 +22,7 @@ type Props = ViewProps & {
22
22
  /**
23
23
  * The React Class to render for this scene.
24
24
  */
25
- scene: () => JSX.Element;
25
+ scene: () => React.JSX.Element;
26
26
  };
27
27
  initialSceneKey?: string;
28
28
  autofocus?: boolean;
@@ -83,7 +83,14 @@ export declare class ViroARSceneNavigator extends React.Component<Props, State>
83
83
  * @param point
84
84
  * @returns
85
85
  */
86
- _project(point: Viro3DPoint): Promise<any>;
86
+ _project: (point: Viro3DPoint) => Promise<any>;
87
+ /**
88
+ * TODO: Document _unproject
89
+ *
90
+ * @param point
91
+ * @returns
92
+ */
93
+ _unproject: (point: Viro3DPoint) => Promise<any>;
87
94
  /**
88
95
  * Gets a random tag string.
89
96
  *
@@ -190,13 +197,6 @@ export declare class ViroARSceneNavigator extends React.Component<Props, State>
190
197
  * @returns the index of the scene
191
198
  */
192
199
  getSceneIndex: (sceneTag: string) => number;
193
- /**
194
- * TODO: Document _unproject
195
- *
196
- * @param point
197
- * @returns
198
- */
199
- _unproject: (point: Viro3DPoint) => Promise<any>;
200
200
  /**
201
201
  * [iOS Only]
202
202
  *
@@ -110,9 +110,18 @@ class ViroARSceneNavigator extends React.Component {
110
110
  * @param point
111
111
  * @returns
112
112
  */
113
- async _project(point) {
113
+ _project = async (point) => {
114
114
  return await ViroARSceneNavigatorModule.project((0, react_native_1.findNodeHandle)(this), point);
115
- }
115
+ };
116
+ /**
117
+ * TODO: Document _unproject
118
+ *
119
+ * @param point
120
+ * @returns
121
+ */
122
+ _unproject = async (point) => {
123
+ return await ViroARSceneNavigatorModule.unproject((0, react_native_1.findNodeHandle)(this), point);
124
+ };
116
125
  /**
117
126
  * Gets a random tag string.
118
127
  *
@@ -403,15 +412,6 @@ class ViroARSceneNavigator extends React.Component {
403
412
  // Unable to find the given sceneTag, return -1
404
413
  return -1;
405
414
  };
406
- /**
407
- * TODO: Document _unproject
408
- *
409
- * @param point
410
- * @returns
411
- */
412
- _unproject = async (point) => {
413
- return await ViroARSceneNavigatorModule.unproject((0, react_native_1.findNodeHandle)(this), point);
414
- };
415
415
  /**
416
416
  * [iOS Only]
417
417
  *
@@ -1 +1 @@
1
- export declare const VIRO_VERSION = "2.43.3";
1
+ export declare const VIRO_VERSION = "2.43.4";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VIRO_VERSION = void 0;
4
- exports.VIRO_VERSION = "2.43.3";
4
+ exports.VIRO_VERSION = "2.43.4";
@@ -37,7 +37,7 @@ type Props = ViewProps & {
37
37
  * describe a scene.
38
38
  */
39
39
  initialScene?: {
40
- scene: () => JSX.Element;
40
+ scene: () => React.JSX.Element;
41
41
  };
42
42
  /**
43
43
  * Called when either the user physically decides to exit vr (hits
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Viro React Native - New Architecture Required
3
+ *
4
+ * This library requires React Native's New Architecture (Fabric) to be enabled.
5
+ * Legacy architecture support has been removed as of version 2.43.1.
6
+ */
7
+ declare global {
8
+ var nativeFabricUIManager: any;
9
+ var __turboModuleProxy: any;
10
+ }
11
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * Viro React Native - New Architecture Required
4
+ *
5
+ * This library requires React Native's New Architecture (Fabric) to be enabled.
6
+ * Legacy architecture support has been removed as of version 2.43.1.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ // Strict New Architecture validation
10
+ function validateNewArchitecture() {
11
+ // Check for New Architecture indicators
12
+ const hasFabricUIManager = !!global.nativeFabricUIManager;
13
+ const hasTurboModules = !!global.__turboModuleProxy;
14
+ if (!hasFabricUIManager && !hasTurboModules) {
15
+ throw new Error("ViroReact: New Architecture (Fabric) is required but not detected.\n\n" +
16
+ "This library requires React Native 0.76.9+ with New Architecture enabled.\n" +
17
+ "Please enable New Architecture in your app:\n\n" +
18
+ "1. Set 'newArchEnabled=true' in android/gradle.properties\n" +
19
+ "2. Set 'RCT_NEW_ARCH_ENABLED=1' in ios/.xcode.env\n" +
20
+ "3. Ensure you're using React Native 0.76.9 or higher\n\n" +
21
+ "For more information, visit: https://reactnative.dev/docs/new-architecture-intro");
22
+ }
23
+ console.log("ViroReact: New Architecture (Fabric) detected ✓");
24
+ }
25
+ // Validate New Architecture on module load
26
+ validateNewArchitecture();
27
+ // Export main components
28
+ module.exports = require("./index");
@@ -51,6 +51,9 @@ export declare const DEFAULTS: {
51
51
  /**
52
52
  * Configures Viro to work with Expo projects.
53
53
  *
54
+ * IMPORTANT: This plugin requires React Native New Architecture (Fabric) to be enabled.
55
+ * ViroReact 2.43.1+ only supports New Architecture.
56
+ *
54
57
  * @param config Expo ConfigPlugin
55
58
  * @returns expo configuration
56
59
  */
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEFAULTS = void 0;
4
+ const config_plugins_1 = require("@expo/config-plugins");
4
5
  const withViroAndroid_1 = require("./withViroAndroid");
5
6
  const withViroIos_1 = require("./withViroIos");
6
7
  const CAMERA_USAGE = "Allow $(PRODUCT_NAME) to use your camera";
@@ -24,10 +25,28 @@ exports.DEFAULTS = {
24
25
  /**
25
26
  * Configures Viro to work with Expo projects.
26
27
  *
28
+ * IMPORTANT: This plugin requires React Native New Architecture (Fabric) to be enabled.
29
+ * ViroReact 2.43.1+ only supports New Architecture.
30
+ *
27
31
  * @param config Expo ConfigPlugin
28
32
  * @returns expo configuration
29
33
  */
30
34
  const withViro = (config, props) => {
35
+ // Validate New Architecture is enabled
36
+ const newArchEnabled = config.plugins?.some((plugin) => Array.isArray(plugin) &&
37
+ plugin[0] === "expo-dev-client" &&
38
+ plugin[1]?.newArchEnabled === true) || config.newArchEnabled === true;
39
+ if (!newArchEnabled) {
40
+ config_plugins_1.WarningAggregator.addWarningAndroid("withViro", "ViroReact requires React Native New Architecture (Fabric) to be enabled. " +
41
+ "Please enable New Architecture in your app configuration. " +
42
+ 'Add "newArchEnabled": true to your app.json/app.config.js expo configuration, ' +
43
+ "or ensure your React Native project has New Architecture enabled.");
44
+ config_plugins_1.WarningAggregator.addWarningIOS("withViro", "ViroReact requires React Native New Architecture (Fabric) to be enabled. " +
45
+ "Please enable New Architecture in your app configuration. " +
46
+ 'Add "newArchEnabled": true to your app.json/app.config.js expo configuration, ' +
47
+ "or ensure your React Native project has New Architecture enabled.");
48
+ }
49
+ // Apply platform-specific configurations
31
50
  config = (0, withViroIos_1.withViroIos)(config, props);
32
51
  config = (0, withViroAndroid_1.withViroAndroid)(config, props);
33
52
  return config;
@@ -54,72 +54,36 @@ const withBranchAndroid = (config) => {
54
54
  ` packages.add(new ReactViroPackage(ReactViroPackage.ViroPlatform.${viroConfig}))\n`;
55
55
  }
56
56
  else {
57
+ // Use proper Kotlin syntax for newer formats
57
58
  target =
58
59
  target +
59
- ` packages.add(ReactViroPackage(ReactViroPackage.ViroPlatform.${viroConfig}))\n`;
60
+ ` packages.add(ReactViroPackage(ReactViroPackage.ViroPlatform.${viroConfig}))\n`;
60
61
  }
61
62
  }
62
63
  if (isJava) {
63
64
  data = (0, insertLinesHelper_1.insertLinesHelper)(target, "List<ReactPackage> packages = new PackageList(this).getPackages();", data);
64
65
  }
65
66
  else {
67
+ // Handle various MainApplication.kt formats
66
68
  if (data.includes("// packages.add(new MyReactNativePackage());")) {
67
- // console.log("[VIRO]: \n" + target);
68
- /**
69
- * ================================================================
70
- * HACK/EXPO PREBIULD BUG
71
- * ================================================================
72
- *
73
- * ```
74
- * // DOESN'T WORK - EXPO SDK 50 `npx expo prebuild` RESULT
75
- * override fun getPackages(): List<ReactPackage> {
76
- * // Packages that cannot be autolinked yet can be added manually here, for example:
77
- * // packages.add(new MyReactNativePackage());
78
- * PackageList(this).packages.apply {
79
- * add(ReactViroPackage(ReactViroPackage.ViroPlatform.GVR))
80
- * }
81
- * return PackageList(this).packages
82
- * }
83
- *
84
- * // DOES WORK - REACT NATIVE STARTER KIT 0.73.4
85
- * override fun getPackages(): List<ReactPackage> =
86
- * PackageList(this).packages.apply {
87
- * // Packages that cannot be autolinked yet can be added manually here, for example:
88
- * // add(MyReactNativePackage())
89
- * // https://viro-community.readme.io/docs/installation-instructions#5-now-add-the-viro-package-to-your-mainapplication
90
- * // add(ReactViroPackage(ReactViroPackage.ViroPlatform.OVR_MOBILE))
91
- * add(ReactViroPackage(ReactViroPackage.ViroPlatform.GVR))
92
- * // add(ReactViroPackage(ReactViroPackage.ViroPlatform.AR))
93
- * }
94
- * ```
95
- */
96
- /*
97
- data = data.replace(
98
- `override fun getPackages(): List<ReactPackage> {
99
- // Packages that cannot be autolinked yet can be added manually here, for example:
100
- // packages.add(new MyReactNativePackage());
101
- return PackageList(this).packages
102
- }`,
103
- `override fun getPackages(): List<ReactPackage> =
104
- PackageList(this).packages.apply {
105
- // Packages that cannot be autolinked yet can be added manually here, for example:
106
- // add(MyReactNativePackage())
107
- }`
108
- );*/
109
69
  data = (0, insertLinesHelper_1.insertLinesHelper)(target, "// packages.add(new MyReactNativePackage());", data);
110
70
  }
111
71
  else if (data.includes("// add(MyReactNativePackage())")) {
112
- // console.log("[VIRO]: \n" + target);
113
72
  data = (0, insertLinesHelper_1.insertLinesHelper)(target, "// add(MyReactNativePackage())", data);
114
73
  }
74
+ else if (data.includes("// packages.add(MyReactNativePackage())")) {
75
+ // Handle newer Expo format: // packages.add(MyReactNativePackage())
76
+ data = (0, insertLinesHelper_1.insertLinesHelper)(target, "// packages.add(MyReactNativePackage())", data);
77
+ }
78
+ else if (data.includes("val packages = PackageList(this).packages")) {
79
+ // Handle newer format where packages is declared as val
80
+ data = (0, insertLinesHelper_1.insertLinesHelper)(target, "val packages = PackageList(this).packages", data);
81
+ }
115
82
  else {
116
- throw new Error("Unable to insert Android packages into package list. Please create a new issue on GitHub and reference this message!");
83
+ throw new Error("Unable to insert Android packages into package list. Please create a new issue on GitHub and reference this message! " +
84
+ "Expected to find one of: '// packages.add(new MyReactNativePackage());', '// add(MyReactNativePackage())', " +
85
+ "'// packages.add(MyReactNativePackage())', or 'val packages = PackageList(this).packages'");
117
86
  }
118
- // data = insertLinesHelper(
119
- // target,
120
- // "// packages.add(new MyReactNativePackage());",
121
- // data
122
- // );
123
87
  }
124
88
  fs_1.default.writeFile(mainApplicationPath, data, "utf-8", function (err) {
125
89
  if (err)
@@ -131,15 +95,26 @@ const withBranchAndroid = (config) => {
131
95
  ]);
132
96
  };
133
97
  const withViroProjectBuildGradle = (config) => (0, config_plugins_1.withProjectBuildGradle)(config, async (newConfig) => {
98
+ // Enforce New Architecture requirement
99
+ if (!newConfig.modResults.contents.includes("newArchEnabled=true")) {
100
+ config_plugins_1.WarningAggregator.addWarningAndroid("withViroAndroid", "ViroReact requires New Architecture to be enabled. " +
101
+ 'Please add "newArchEnabled=true" to your android/gradle.properties file.');
102
+ }
134
103
  newConfig.modResults.contents = newConfig.modResults.contents.replace(/minSdkVersion.*/, `minSdkVersion = 24`);
104
+ // Ensure New Architecture is enabled
105
+ //if (!newConfig.modResults.contents.includes("newArchEnabled=true")) {
106
+ // newConfig.modResults.contents +=
107
+ // "\n// ViroReact requires New Architecture\nnewArchEnabled=true\n";
108
+ //}
135
109
  newConfig.modResults.contents = newConfig.modResults.contents.replace(/classpath\("com.android.tools.build:gradle.*/, `classpath('com.android.tools.build:gradle:4.1.1')`);
136
110
  return newConfig;
137
111
  });
138
112
  const withViroAppBuildGradle = (config) => (0, config_plugins_1.withAppBuildGradle)(config, async (config) => {
139
- config.modResults.contents = config.modResults.contents.replace(/implementation "com.facebook.react:react-native:\+" \/\/ From node_modules/, `implementation "com.facebook.react:react-native:+" // From node_modules
140
-
113
+ // ViroReact New Architecture (Fabric) Dependencies
114
+ const viroNewArchDependencies = `
141
115
  // ========================================================================
142
- // https://viro-community.readme.io/docs/installation-instructions#2-in-your-androidappbuildgradle-add-the-following-lines-to-the-dependencies-section
116
+ // ViroReact New Architecture (Fabric) Dependencies
117
+ // https://viro-community.readme.io/docs/installation-instructions
143
118
  implementation project(':gvr_common')
144
119
  implementation project(':arcore_client')
145
120
  implementation project(path: ':react_viro')
@@ -149,22 +124,11 @@ const withViroAppBuildGradle = (config) => (0, config_plugins_1.withAppBuildGrad
149
124
  implementation 'androidx.media3:media3-exoplayer-hls:1.1.1'
150
125
  implementation 'androidx.media3:media3-exoplayer-smoothstreaming:1.1.1'
151
126
  implementation 'com.google.protobuf.nano:protobuf-javanano:3.1.0'
152
- // ========================================================================`);
153
- config.modResults.contents = config.modResults.contents.replace(/implementation\("com.facebook.react:react-android"\)/, `implementation("com.facebook.react:react-android")
154
-
155
- // =====================================r===================================
156
- // https://viro-community.readme.io/docs/installation-instructions#2-in-your-androidappbuildgradle-add-the-following-lines-to-the-dependencies-section
157
- implementation project(':gvr_common')
158
- implementation project(':arcore_client')
159
- implementation project(path: ':react_viro')
160
- implementation project(path: ':viro_renderer')
161
- implementation 'androidx.media3:media3-exoplayer:1.1.1'
162
- implementation 'androidx.media3:media3-exoplayer-dash:1.1.1'
163
- implementation 'androidx.media3:media3-exoplayer-hls:1.1.1'
164
- implementation 'androidx.media3:media3-exoplayer-smoothstreaming:1.1.1'
165
- implementation 'com.google.protobuf.nano:protobuf-javanano:3.1.0'
166
- // ========================================================================
167
- `);
127
+ // ========================================================================`;
128
+ // Add Viro dependencies for legacy architecture (fallback)
129
+ config.modResults.contents = config.modResults.contents.replace(/implementation "com.facebook.react:react-native:\+" \/\/ From node_modules/, `implementation "com.facebook.react:react-native:+" // From node_modules${viroNewArchDependencies}`);
130
+ // Add Viro dependencies for new architecture (primary)
131
+ config.modResults.contents = config.modResults.contents.replace(/implementation\("com.facebook.react:react-android"\)/, `implementation("com.facebook.react:react-android")${viroNewArchDependencies}`);
168
132
  return config;
169
133
  });
170
134
  const withViroSettingsGradle = (config) => (0, config_plugins_1.withSettingsGradle)(config, async (config) => {
@@ -14,8 +14,26 @@ const withViroPods = (config) => {
14
14
  async (newConfig) => {
15
15
  const root = newConfig.modRequest.platformProjectRoot;
16
16
  fs_1.default.readFile(`${root}/Podfile`, "utf-8", (err, data) => {
17
- data = (0, insertLinesHelper_1.insertLinesHelper)(` pod 'ViroReact', :path => '../node_modules/@reactvision/react-viro/ios'\n` +
18
- ` pod 'ViroKit', :path => '../node_modules/@reactvision/react-viro/ios/dist/ViroRenderer/'\n`, "post_install do |installer|", data, -1);
17
+ // Check for New Architecture environment variable
18
+ if (!data.includes('ENV["RCT_NEW_ARCH_ENABLED"]') &&
19
+ !data.includes("RCT_NEW_ARCH_ENABLED=1")) {
20
+ config_plugins_1.WarningAggregator.addWarningIOS("withViroIos", "ViroReact requires New Architecture to be enabled. " +
21
+ "Please set RCT_NEW_ARCH_ENABLED=1 in your ios/.xcode.env file.");
22
+ }
23
+ // ViroReact with integrated Fabric support
24
+ let viroPods = ` # ViroReact with integrated New Architecture (Fabric) support\n` +
25
+ ` # Automatically includes Fabric components when RCT_NEW_ARCH_ENABLED=1\n` +
26
+ ` pod 'ViroReact', :path => '../node_modules/@reactvision/react-viro/ios'\n` +
27
+ ` pod 'ViroKit', :path => '../node_modules/@reactvision/react-viro/ios/dist/ViroRenderer/'`;
28
+ // Add New Architecture enforcement
29
+ viroPods +=
30
+ `\n\n # Enforce New Architecture requirement\n` +
31
+ ` # ViroReact 2.43.1+ requires React Native New Architecture\n` +
32
+ ` if ENV['RCT_NEW_ARCH_ENABLED'] != '1'\n` +
33
+ ` raise "ViroReact requires New Architecture to be enabled. Please set RCT_NEW_ARCH_ENABLED=1 in ios/.xcode.env"\n` +
34
+ ` end`;
35
+ // Insert the pods into the Podfile
36
+ data = (0, insertLinesHelper_1.insertLinesHelper)(viroPods, "post_install do |installer|", data, -1);
19
37
  fs_1.default.writeFile(`${root}/Podfile`, data, "utf-8", function (err) {
20
38
  if (err)
21
39
  console.log("Error writing Podfile");
@@ -4,16 +4,54 @@ package = JSON.parse(File.read(File.join(__dir__, '../package.json')))
4
4
 
5
5
  Pod::Spec.new do |s|
6
6
  s.name = 'ViroReact'
7
- s.version = '1.0'
8
- s.summary = 'Test description'
9
- s.source = { :http => 'https://s3-us-west-2.amazonaws.com/viro-docs/ViroReact.tar.gz'}
10
- s.source_files = 'dist/include'
11
- s.public_header_files = 'dist/include/*.h'
12
- s.vendored_libraries = 'dist/lib/libViroReact.a'
13
- s.homepage = 'http://viromedia.com'
14
- s.license = {:type => 'Copyright', :text => "Copyright 2018 ViroMedia, Inc" }
15
- s.author = 'Viro Media'
7
+ s.version = package['version']
8
+ s.summary = 'Viro React Native library for AR/VR applications'
9
+ s.source = { :git => 'https://github.com/ReactVision/viro.git', :tag => "v#{s.version}" }
10
+ s.homepage = 'https://github.com/ReactVision/viro'
11
+ s.license = { :type => 'MIT', :file => '../LICENSE' }
12
+ s.author = 'ReactVision'
16
13
  s.requires_arc = true
17
- s.platform = :ios, '10.0'
18
- s.dependency 'React'
14
+ s.platform = :ios, '12.0'
15
+ s.ios.deployment_target = '12.0'
16
+
17
+ # Base source files (always included)
18
+ source_files_array = ['ViroReact/**/*.{h,m,mm}']
19
+ header_files_array = ['ViroReact/**/*.h']
20
+
21
+ # Include dist files if they exist (for release builds)
22
+ if File.exist?(File.join(__dir__, 'dist/include'))
23
+ source_files_array << 'dist/include/**/*.{h,m,mm}'
24
+ header_files_array << 'dist/include/*.h'
25
+ end
26
+
27
+ s.source_files = source_files_array
28
+ s.public_header_files = header_files_array
29
+
30
+ if File.exist?(File.join(__dir__, 'dist/lib/libViroReact.a'))
31
+ s.vendored_libraries = 'dist/lib/libViroReact.a'
32
+ end
33
+
34
+ # React Native dependencies
35
+ s.dependency 'React-Core'
36
+
37
+ # Fabric dependencies
38
+ s.dependency 'React-RCTFabric'
39
+ s.dependency 'React-Fabric'
40
+ s.dependency 'React-FabricComponents'
41
+
42
+ # Fabric-specific build configuration
43
+ s.pod_target_xcconfig = {
44
+ 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
45
+ 'HEADER_SEARCH_PATHS' => [
46
+ '"$(PODS_TARGET_SRCROOT)/ViroReact"',
47
+ '"$(PODS_TARGET_SRCROOT)/dist/include"',
48
+ '"$(PODS_ROOT)/Headers/Public"',
49
+ '"$(PODS_ROOT)/Headers/Public/ViroKit"',
50
+ '"$(PODS_ROOT)/ViroKit/dist/include"',
51
+ '"$(PODS_ROOT)/ViroKit/Headers"'
52
+ ].join(' '),
53
+ 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) RCT_NEW_ARCH_ENABLED=1',
54
+ 'OTHER_CPLUSPLUSFLAGS' => '$(inherited) -std=c++17'
55
+ }
56
+
19
57
  end
@@ -27,6 +27,7 @@
27
27
  #ifndef VROBodyMesher_h
28
28
  #define VROBodyMesher_h
29
29
 
30
+ #include <vector>
30
31
  #include "VROVisionModel.h"
31
32
 
32
33
  enum class VROCameraPosition;
@@ -27,6 +27,7 @@
27
27
  #ifndef VROVideoTextureCache_hpp
28
28
  #define VROVideoTextureCache_hpp
29
29
 
30
+ #include <vector>
30
31
  #include <stdio.h>
31
32
  #include <memory>
32
33
  #import <AVFoundation/AVFoundation.h>
@@ -212,6 +212,17 @@ FOUNDATION_EXPORT const unsigned char ViroKitVersionString[];
212
212
  #import <ViroKit/VROARObjectTarget.h>
213
213
  #import <ViroKit/VROARObjectTargetiOS.h>
214
214
 
215
+ // Advanced AR Features (New)
216
+ #import <ViroKit/VROARGeospatialAnchor.h>
217
+ #import <ViroKit/VROARLocationAnchoriOS.h>
218
+ #import <ViroKit/VROARSceneSemantics.h>
219
+ #import <ViroKit/VROARSceneUnderstandingiOS.h>
220
+ #import <ViroKit/VROARAugmentedFace.h>
221
+ #import <ViroKit/VROARFaceTrackingiOS.h>
222
+ #import <ViroKit/VROARCloudAnchor.h>
223
+ #import <ViroKit/VROARMemoryManager.h>
224
+ #import <ViroKit/VROARPerformanceOptimizer.h>
225
+
215
226
  // Test
216
227
  #import <ViroKit/VRORendererTest.h>
217
228
  #import <ViroKit/VRORendererTestHarness.h>