@reactvision/react-viro 2.42.0 → 2.43.1

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 (475) hide show
  1. package/README.md +12 -6
  2. package/android/react_viro/react_viro-release.aar +0 -0
  3. package/components/AR/ViroARPlaneSelector.tsx +76 -37
  4. package/components/Utilities/ViroVersion.ts +1 -1
  5. package/dist/components/AR/ViroARPlaneSelector.d.ts +1 -1
  6. package/dist/components/AR/ViroARPlaneSelector.js +46 -18
  7. package/dist/components/Utilities/ViroVersion.d.ts +1 -1
  8. package/dist/components/Utilities/ViroVersion.js +1 -1
  9. package/dist/dynamic-index.d.ts +11 -0
  10. package/dist/dynamic-index.js +28 -0
  11. package/dist/examples/AutoDetectionExample.d.ts +10 -0
  12. package/dist/examples/AutoDetectionExample.js +91 -0
  13. package/dist/fabric-interop/NativeViro.d.ts +42 -0
  14. package/dist/fabric-interop/NativeViro.js +262 -0
  15. package/dist/fabric-interop/ViroEventsManager.d.ts +83 -0
  16. package/dist/fabric-interop/ViroEventsManager.js +222 -0
  17. package/dist/fabric-interop/ViroFabricContainer.d.ts +34 -0
  18. package/dist/fabric-interop/ViroFabricContainer.js +200 -0
  19. package/dist/fabric-interop/android/src/main/js/specs/ViroFabricContainerViewNativeComponent.d.ts +35 -0
  20. package/dist/fabric-interop/android/src/main/js/specs/ViroFabricContainerViewNativeComponent.js +20 -0
  21. package/dist/fabric-interop/components/AR/ViroARPlane.d.ts +22 -0
  22. package/dist/fabric-interop/components/AR/ViroARPlane.js +95 -0
  23. package/dist/fabric-interop/components/AR/ViroARPlaneSelector.d.ts +43 -0
  24. package/dist/fabric-interop/components/AR/ViroARPlaneSelector.js +152 -0
  25. package/dist/fabric-interop/components/AR/ViroARTrackingTargets.d.ts +55 -0
  26. package/dist/fabric-interop/components/AR/ViroARTrackingTargets.js +85 -0
  27. package/dist/fabric-interop/components/AR/ViroCommonProps.d.ts +91 -0
  28. package/dist/fabric-interop/components/AR/ViroCommonProps.js +7 -0
  29. package/dist/fabric-interop/components/Animation/ViroAnimations.d.ts +48 -0
  30. package/dist/fabric-interop/components/Animation/ViroAnimations.js +64 -0
  31. package/dist/fabric-interop/components/Material/ViroMaterials.d.ts +66 -0
  32. package/dist/fabric-interop/components/Material/ViroMaterials.js +85 -0
  33. package/dist/fabric-interop/components/Types/ViroEvents.d.ts +202 -0
  34. package/dist/fabric-interop/components/Types/ViroEvents.js +53 -0
  35. package/dist/fabric-interop/components/Types/ViroUtils.d.ts +137 -0
  36. package/dist/fabric-interop/components/Types/ViroUtils.js +7 -0
  37. package/dist/fabric-interop/components/Viro360Image.d.ts +23 -0
  38. package/dist/fabric-interop/components/Viro360Image.js +45 -0
  39. package/dist/fabric-interop/components/Viro360Video.d.ts +29 -0
  40. package/dist/fabric-interop/components/Viro360Video.js +47 -0
  41. package/dist/fabric-interop/components/Viro3DObject.d.ts +60 -0
  42. package/dist/fabric-interop/components/Viro3DObject.js +49 -0
  43. package/dist/fabric-interop/components/Viro3DSceneNavigator.d.ts +49 -0
  44. package/dist/fabric-interop/components/Viro3DSceneNavigator.js +388 -0
  45. package/dist/fabric-interop/components/ViroARCamera.d.ts +29 -0
  46. package/dist/fabric-interop/components/ViroARCamera.js +64 -0
  47. package/dist/fabric-interop/components/ViroARImageMarker.d.ts +21 -0
  48. package/dist/fabric-interop/components/ViroARImageMarker.js +71 -0
  49. package/dist/fabric-interop/components/ViroARObjectMarker.d.ts +21 -0
  50. package/dist/fabric-interop/components/ViroARObjectMarker.js +71 -0
  51. package/dist/fabric-interop/components/ViroARPlane.d.ts +24 -0
  52. package/dist/fabric-interop/components/ViroARPlane.js +88 -0
  53. package/dist/fabric-interop/components/ViroARScene.d.ts +29 -0
  54. package/dist/fabric-interop/components/ViroARScene.js +89 -0
  55. package/dist/fabric-interop/components/ViroARSceneNavigator.d.ts +29 -0
  56. package/dist/fabric-interop/components/ViroARSceneNavigator.js +76 -0
  57. package/dist/fabric-interop/components/ViroAmbientLight.d.ts +19 -0
  58. package/dist/fabric-interop/components/ViroAmbientLight.js +46 -0
  59. package/dist/fabric-interop/components/ViroAnimatedComponent.d.ts +24 -0
  60. package/dist/fabric-interop/components/ViroAnimatedComponent.js +63 -0
  61. package/dist/fabric-interop/components/ViroAnimatedImage.d.ts +28 -0
  62. package/dist/fabric-interop/components/ViroAnimatedImage.js +49 -0
  63. package/dist/fabric-interop/components/ViroBox.d.ts +20 -0
  64. package/dist/fabric-interop/components/ViroBox.js +47 -0
  65. package/dist/fabric-interop/components/ViroButton.d.ts +32 -0
  66. package/dist/fabric-interop/components/ViroButton.js +92 -0
  67. package/dist/fabric-interop/components/ViroCamera.d.ts +17 -0
  68. package/dist/fabric-interop/components/ViroCamera.js +30 -0
  69. package/dist/fabric-interop/components/ViroController.d.ts +19 -0
  70. package/dist/fabric-interop/components/ViroController.js +64 -0
  71. package/dist/fabric-interop/components/ViroDirectionalLight.d.ts +28 -0
  72. package/dist/fabric-interop/components/ViroDirectionalLight.js +55 -0
  73. package/dist/fabric-interop/components/ViroFlexView.d.ts +36 -0
  74. package/dist/fabric-interop/components/ViroFlexView.js +97 -0
  75. package/dist/fabric-interop/components/ViroGeometry.d.ts +23 -0
  76. package/dist/fabric-interop/components/ViroGeometry.js +50 -0
  77. package/dist/fabric-interop/components/ViroGlobal.d.ts +45 -0
  78. package/dist/fabric-interop/components/ViroGlobal.js +20 -0
  79. package/dist/fabric-interop/components/ViroImage.d.ts +29 -0
  80. package/dist/fabric-interop/components/ViroImage.js +52 -0
  81. package/dist/fabric-interop/components/ViroLightingEnvironment.d.ts +19 -0
  82. package/dist/fabric-interop/components/ViroLightingEnvironment.js +44 -0
  83. package/dist/fabric-interop/components/ViroMaterialVideo.d.ts +30 -0
  84. package/dist/fabric-interop/components/ViroMaterialVideo.js +48 -0
  85. package/dist/fabric-interop/components/ViroNode.d.ts +36 -0
  86. package/dist/fabric-interop/components/ViroNode.js +28 -0
  87. package/dist/fabric-interop/components/ViroOmniLight.d.ts +21 -0
  88. package/dist/fabric-interop/components/ViroOmniLight.js +48 -0
  89. package/dist/fabric-interop/components/ViroOrbitCamera.d.ts +17 -0
  90. package/dist/fabric-interop/components/ViroOrbitCamera.js +30 -0
  91. package/dist/fabric-interop/components/ViroParticleEmitter.d.ts +51 -0
  92. package/dist/fabric-interop/components/ViroParticleEmitter.js +50 -0
  93. package/dist/fabric-interop/components/ViroPolygon.d.ts +20 -0
  94. package/dist/fabric-interop/components/ViroPolygon.js +47 -0
  95. package/dist/fabric-interop/components/ViroPolyline.d.ts +19 -0
  96. package/dist/fabric-interop/components/ViroPolyline.js +46 -0
  97. package/dist/fabric-interop/components/ViroPortal.d.ts +16 -0
  98. package/dist/fabric-interop/components/ViroPortal.js +73 -0
  99. package/dist/fabric-interop/components/ViroPortalScene.d.ts +16 -0
  100. package/dist/fabric-interop/components/ViroPortalScene.js +29 -0
  101. package/dist/fabric-interop/components/ViroQuad.d.ts +39 -0
  102. package/dist/fabric-interop/components/ViroQuad.js +49 -0
  103. package/dist/fabric-interop/components/ViroScene.d.ts +29 -0
  104. package/dist/fabric-interop/components/ViroScene.js +103 -0
  105. package/dist/fabric-interop/components/ViroSceneNavigator.d.ts +23 -0
  106. package/dist/fabric-interop/components/ViroSceneNavigator.js +73 -0
  107. package/dist/fabric-interop/components/ViroSkyBox.d.ts +39 -0
  108. package/dist/fabric-interop/components/ViroSkyBox.js +44 -0
  109. package/dist/fabric-interop/components/ViroSound.d.ts +23 -0
  110. package/dist/fabric-interop/components/ViroSound.js +46 -0
  111. package/dist/fabric-interop/components/ViroSoundField.d.ts +24 -0
  112. package/dist/fabric-interop/components/ViroSoundField.js +47 -0
  113. package/dist/fabric-interop/components/ViroSpatialSound.d.ts +27 -0
  114. package/dist/fabric-interop/components/ViroSpatialSound.js +50 -0
  115. package/dist/fabric-interop/components/ViroSphere.d.ts +22 -0
  116. package/dist/fabric-interop/components/ViroSphere.js +49 -0
  117. package/dist/fabric-interop/components/ViroSpinner.d.ts +18 -0
  118. package/dist/fabric-interop/components/ViroSpinner.js +45 -0
  119. package/dist/fabric-interop/components/ViroSpotLight.d.ts +30 -0
  120. package/dist/fabric-interop/components/ViroSpotLight.js +57 -0
  121. package/dist/fabric-interop/components/ViroSurface.d.ts +38 -0
  122. package/dist/fabric-interop/components/ViroSurface.js +48 -0
  123. package/dist/fabric-interop/components/ViroText.d.ts +36 -0
  124. package/dist/fabric-interop/components/ViroText.js +59 -0
  125. package/dist/fabric-interop/components/ViroUtils.d.ts +63 -0
  126. package/dist/fabric-interop/components/ViroUtils.js +140 -0
  127. package/dist/fabric-interop/components/ViroVRSceneNavigator.d.ts +25 -0
  128. package/dist/fabric-interop/components/ViroVRSceneNavigator.js +73 -0
  129. package/dist/fabric-interop/components/ViroVideo.d.ts +32 -0
  130. package/dist/fabric-interop/components/ViroVideo.js +52 -0
  131. package/dist/fabric-interop/components/index.d.ts +62 -0
  132. package/dist/fabric-interop/components/index.js +144 -0
  133. package/dist/fabric-interop/examples/BasicSceneExample.d.ts +11 -0
  134. package/dist/fabric-interop/examples/BasicSceneExample.js +244 -0
  135. package/dist/fabric-interop/examples/ComprehensiveExample.d.ts +13 -0
  136. package/dist/fabric-interop/examples/ComprehensiveExample.js +327 -0
  137. package/dist/fabric-interop/examples/SimpleARExample.d.ts +8 -0
  138. package/dist/fabric-interop/examples/SimpleARExample.js +62 -0
  139. package/dist/fabric-interop/index.d.ts +14 -0
  140. package/dist/fabric-interop/index.js +117 -0
  141. package/dist/fabric-interop/specs/ViroEventsTurboModule.d.ts +19 -0
  142. package/dist/fabric-interop/specs/ViroEventsTurboModule.js +11 -0
  143. package/dist/fabric-interop/test/BasicFunctionalityTest.d.ts +9 -0
  144. package/dist/fabric-interop/test/BasicFunctionalityTest.js +222 -0
  145. package/dist/fabric.d.ts +13 -0
  146. package/dist/fabric.js +29 -0
  147. package/dist/plugins/withViro.d.ts +3 -0
  148. package/dist/plugins/withViro.js +19 -0
  149. package/dist/plugins/withViroAndroid.js +24 -20
  150. package/dist/plugins/withViroIos.js +20 -2
  151. package/dynamic-index-source.d.ts +77 -0
  152. package/dynamic-index.ts +41 -0
  153. package/fabric-interop/NativeViro.ts +335 -0
  154. package/fabric-interop/README.md +282 -0
  155. package/fabric-interop/ViroEventsManager.js +257 -0
  156. package/fabric-interop/ViroFabricContainer.tsx +273 -0
  157. package/fabric-interop/components/AR/ViroARPlane.tsx +108 -0
  158. package/fabric-interop/components/AR/ViroARPlaneSelector.tsx +185 -0
  159. package/fabric-interop/components/AR/ViroARTrackingTargets.ts +108 -0
  160. package/fabric-interop/components/AR/ViroCommonProps.ts +140 -0
  161. package/fabric-interop/components/Animation/ViroAnimations.ts +96 -0
  162. package/fabric-interop/components/Material/ViroMaterials.ts +127 -0
  163. package/fabric-interop/components/Resources/viro_spinner_1.png +0 -0
  164. package/fabric-interop/components/Resources/viro_spinner_1_w.png +0 -0
  165. package/fabric-interop/components/Resources/viro_spinner_1a.png +0 -0
  166. package/fabric-interop/components/Resources/viro_spinner_1a_w.png +0 -0
  167. package/fabric-interop/components/Types/ViroEvents.ts +285 -0
  168. package/fabric-interop/components/Types/ViroUtils.ts +160 -0
  169. package/fabric-interop/components/Viro360Image.tsx +70 -0
  170. package/fabric-interop/components/Viro360Video.tsx +78 -0
  171. package/fabric-interop/components/Viro3DObject.tsx +122 -0
  172. package/fabric-interop/components/Viro3DSceneNavigator.tsx +503 -0
  173. package/fabric-interop/components/ViroARCamera.tsx +105 -0
  174. package/fabric-interop/components/ViroARImageMarker.tsx +98 -0
  175. package/fabric-interop/components/ViroARObjectMarker.tsx +100 -0
  176. package/fabric-interop/components/ViroARPlane.tsx +120 -0
  177. package/fabric-interop/components/ViroARScene.tsx +127 -0
  178. package/fabric-interop/components/ViroARSceneNavigator.tsx +82 -0
  179. package/fabric-interop/components/ViroAmbientLight.tsx +62 -0
  180. package/fabric-interop/components/ViroAnimatedComponent.tsx +91 -0
  181. package/fabric-interop/components/ViroAnimatedImage.tsx +81 -0
  182. package/fabric-interop/components/ViroBox.tsx +72 -0
  183. package/fabric-interop/components/ViroButton.tsx +125 -0
  184. package/fabric-interop/components/ViroCamera.tsx +45 -0
  185. package/fabric-interop/components/ViroController.tsx +87 -0
  186. package/fabric-interop/components/ViroDirectionalLight.tsx +84 -0
  187. package/fabric-interop/components/ViroFlexView.tsx +146 -0
  188. package/fabric-interop/components/ViroGeometry.tsx +78 -0
  189. package/fabric-interop/components/ViroGlobal.ts +114 -0
  190. package/fabric-interop/components/ViroImage.tsx +85 -0
  191. package/fabric-interop/components/ViroLightingEnvironment.tsx +63 -0
  192. package/fabric-interop/components/ViroMaterialVideo.tsx +82 -0
  193. package/fabric-interop/components/ViroNode.tsx +62 -0
  194. package/fabric-interop/components/ViroOmniLight.tsx +66 -0
  195. package/fabric-interop/components/ViroOrbitCamera.tsx +45 -0
  196. package/fabric-interop/components/ViroParticleEmitter.tsx +111 -0
  197. package/fabric-interop/components/ViroPolygon.tsx +72 -0
  198. package/fabric-interop/components/ViroPolyline.tsx +71 -0
  199. package/fabric-interop/components/ViroPortal.tsx +91 -0
  200. package/fabric-interop/components/ViroPortalScene.tsx +43 -0
  201. package/fabric-interop/components/ViroQuad.tsx +82 -0
  202. package/fabric-interop/components/ViroScene.tsx +117 -0
  203. package/fabric-interop/components/ViroSceneNavigator.tsx +71 -0
  204. package/fabric-interop/components/ViroSkyBox.tsx +75 -0
  205. package/fabric-interop/components/ViroSound.tsx +71 -0
  206. package/fabric-interop/components/ViroSoundField.tsx +75 -0
  207. package/fabric-interop/components/ViroSpatialSound.tsx +81 -0
  208. package/fabric-interop/components/ViroSphere.tsx +75 -0
  209. package/fabric-interop/components/ViroSpinner.tsx +63 -0
  210. package/fabric-interop/components/ViroSpotLight.tsx +86 -0
  211. package/fabric-interop/components/ViroSurface.tsx +80 -0
  212. package/fabric-interop/components/ViroText.tsx +114 -0
  213. package/fabric-interop/components/ViroUtils.ts +208 -0
  214. package/fabric-interop/components/ViroVRSceneNavigator.tsx +75 -0
  215. package/fabric-interop/components/ViroVideo.tsx +91 -0
  216. package/fabric-interop/components/index.ts +94 -0
  217. package/fabric-interop/dist/NativeViro.d.ts +43 -0
  218. package/fabric-interop/dist/NativeViro.d.ts.map +1 -0
  219. package/fabric-interop/dist/NativeViro.js +263 -0
  220. package/fabric-interop/dist/NativeViro.js.map +1 -0
  221. package/fabric-interop/dist/ViroFabricContainer.d.ts +35 -0
  222. package/fabric-interop/dist/ViroFabricContainer.d.ts.map +1 -0
  223. package/fabric-interop/dist/ViroFabricContainer.js +201 -0
  224. package/fabric-interop/dist/ViroFabricContainer.js.map +1 -0
  225. package/fabric-interop/dist/components/AR/ViroARPlane.d.ts +23 -0
  226. package/fabric-interop/dist/components/AR/ViroARPlane.d.ts.map +1 -0
  227. package/fabric-interop/dist/components/AR/ViroARPlane.js +96 -0
  228. package/fabric-interop/dist/components/AR/ViroARPlane.js.map +1 -0
  229. package/fabric-interop/dist/components/AR/ViroARPlaneSelector.d.ts +44 -0
  230. package/fabric-interop/dist/components/AR/ViroARPlaneSelector.d.ts.map +1 -0
  231. package/fabric-interop/dist/components/AR/ViroARPlaneSelector.js +156 -0
  232. package/fabric-interop/dist/components/AR/ViroARPlaneSelector.js.map +1 -0
  233. package/fabric-interop/dist/components/AR/ViroARTrackingTargets.d.ts +56 -0
  234. package/fabric-interop/dist/components/AR/ViroARTrackingTargets.d.ts.map +1 -0
  235. package/fabric-interop/dist/components/AR/ViroARTrackingTargets.js +86 -0
  236. package/fabric-interop/dist/components/AR/ViroARTrackingTargets.js.map +1 -0
  237. package/fabric-interop/dist/components/AR/ViroCommonProps.d.ts +92 -0
  238. package/fabric-interop/dist/components/AR/ViroCommonProps.d.ts.map +1 -0
  239. package/fabric-interop/dist/components/AR/ViroCommonProps.js +8 -0
  240. package/fabric-interop/dist/components/AR/ViroCommonProps.js.map +1 -0
  241. package/fabric-interop/dist/components/Animation/ViroAnimations.d.ts +49 -0
  242. package/fabric-interop/dist/components/Animation/ViroAnimations.d.ts.map +1 -0
  243. package/fabric-interop/dist/components/Animation/ViroAnimations.js +65 -0
  244. package/fabric-interop/dist/components/Animation/ViroAnimations.js.map +1 -0
  245. package/fabric-interop/dist/components/Material/ViroMaterials.d.ts +67 -0
  246. package/fabric-interop/dist/components/Material/ViroMaterials.d.ts.map +1 -0
  247. package/fabric-interop/dist/components/Material/ViroMaterials.js +86 -0
  248. package/fabric-interop/dist/components/Material/ViroMaterials.js.map +1 -0
  249. package/fabric-interop/dist/components/Types/ViroEvents.d.ts +203 -0
  250. package/fabric-interop/dist/components/Types/ViroEvents.d.ts.map +1 -0
  251. package/fabric-interop/dist/components/Types/ViroEvents.js +54 -0
  252. package/fabric-interop/dist/components/Types/ViroEvents.js.map +1 -0
  253. package/fabric-interop/dist/components/Types/ViroUtils.d.ts +138 -0
  254. package/fabric-interop/dist/components/Types/ViroUtils.d.ts.map +1 -0
  255. package/fabric-interop/dist/components/Types/ViroUtils.js +8 -0
  256. package/fabric-interop/dist/components/Types/ViroUtils.js.map +1 -0
  257. package/fabric-interop/dist/components/Viro360Image.d.ts +24 -0
  258. package/fabric-interop/dist/components/Viro360Image.d.ts.map +1 -0
  259. package/fabric-interop/dist/components/Viro360Image.js +47 -0
  260. package/fabric-interop/dist/components/Viro360Image.js.map +1 -0
  261. package/fabric-interop/dist/components/Viro360Video.d.ts +30 -0
  262. package/fabric-interop/dist/components/Viro360Video.d.ts.map +1 -0
  263. package/fabric-interop/dist/components/Viro360Video.js +49 -0
  264. package/fabric-interop/dist/components/Viro360Video.js.map +1 -0
  265. package/fabric-interop/dist/components/Viro3DObject.d.ts +61 -0
  266. package/fabric-interop/dist/components/Viro3DObject.d.ts.map +1 -0
  267. package/fabric-interop/dist/components/Viro3DObject.js +51 -0
  268. package/fabric-interop/dist/components/Viro3DObject.js.map +1 -0
  269. package/fabric-interop/dist/components/Viro3DSceneNavigator.d.ts +50 -0
  270. package/fabric-interop/dist/components/Viro3DSceneNavigator.d.ts.map +1 -0
  271. package/fabric-interop/dist/components/Viro3DSceneNavigator.js +389 -0
  272. package/fabric-interop/dist/components/Viro3DSceneNavigator.js.map +1 -0
  273. package/fabric-interop/dist/components/ViroARCamera.d.ts +30 -0
  274. package/fabric-interop/dist/components/ViroARCamera.d.ts.map +1 -0
  275. package/fabric-interop/dist/components/ViroARCamera.js +65 -0
  276. package/fabric-interop/dist/components/ViroARCamera.js.map +1 -0
  277. package/fabric-interop/dist/components/ViroARImageMarker.d.ts +22 -0
  278. package/fabric-interop/dist/components/ViroARImageMarker.d.ts.map +1 -0
  279. package/fabric-interop/dist/components/ViroARImageMarker.js +72 -0
  280. package/fabric-interop/dist/components/ViroARImageMarker.js.map +1 -0
  281. package/fabric-interop/dist/components/ViroARObjectMarker.d.ts +22 -0
  282. package/fabric-interop/dist/components/ViroARObjectMarker.d.ts.map +1 -0
  283. package/fabric-interop/dist/components/ViroARObjectMarker.js +72 -0
  284. package/fabric-interop/dist/components/ViroARObjectMarker.js.map +1 -0
  285. package/fabric-interop/dist/components/ViroARPlane.d.ts +25 -0
  286. package/fabric-interop/dist/components/ViroARPlane.d.ts.map +1 -0
  287. package/fabric-interop/dist/components/ViroARPlane.js +89 -0
  288. package/fabric-interop/dist/components/ViroARPlane.js.map +1 -0
  289. package/fabric-interop/dist/components/ViroARScene.d.ts +30 -0
  290. package/fabric-interop/dist/components/ViroARScene.d.ts.map +1 -0
  291. package/fabric-interop/dist/components/ViroARScene.js +90 -0
  292. package/fabric-interop/dist/components/ViroARScene.js.map +1 -0
  293. package/fabric-interop/dist/components/ViroARSceneNavigator.d.ts +30 -0
  294. package/fabric-interop/dist/components/ViroARSceneNavigator.d.ts.map +1 -0
  295. package/fabric-interop/dist/components/ViroARSceneNavigator.js +78 -0
  296. package/fabric-interop/dist/components/ViroARSceneNavigator.js.map +1 -0
  297. package/fabric-interop/dist/components/ViroAmbientLight.d.ts +20 -0
  298. package/fabric-interop/dist/components/ViroAmbientLight.d.ts.map +1 -0
  299. package/fabric-interop/dist/components/ViroAmbientLight.js +48 -0
  300. package/fabric-interop/dist/components/ViroAmbientLight.js.map +1 -0
  301. package/fabric-interop/dist/components/ViroAnimatedComponent.d.ts +25 -0
  302. package/fabric-interop/dist/components/ViroAnimatedComponent.d.ts.map +1 -0
  303. package/fabric-interop/dist/components/ViroAnimatedComponent.js +65 -0
  304. package/fabric-interop/dist/components/ViroAnimatedComponent.js.map +1 -0
  305. package/fabric-interop/dist/components/ViroAnimatedImage.d.ts +29 -0
  306. package/fabric-interop/dist/components/ViroAnimatedImage.d.ts.map +1 -0
  307. package/fabric-interop/dist/components/ViroAnimatedImage.js +51 -0
  308. package/fabric-interop/dist/components/ViroAnimatedImage.js.map +1 -0
  309. package/fabric-interop/dist/components/ViroBox.d.ts +21 -0
  310. package/fabric-interop/dist/components/ViroBox.d.ts.map +1 -0
  311. package/fabric-interop/dist/components/ViroBox.js +49 -0
  312. package/fabric-interop/dist/components/ViroBox.js.map +1 -0
  313. package/fabric-interop/dist/components/ViroButton.d.ts +33 -0
  314. package/fabric-interop/dist/components/ViroButton.d.ts.map +1 -0
  315. package/fabric-interop/dist/components/ViroButton.js +94 -0
  316. package/fabric-interop/dist/components/ViroButton.js.map +1 -0
  317. package/fabric-interop/dist/components/ViroCamera.d.ts +18 -0
  318. package/fabric-interop/dist/components/ViroCamera.d.ts.map +1 -0
  319. package/fabric-interop/dist/components/ViroCamera.js +31 -0
  320. package/fabric-interop/dist/components/ViroCamera.js.map +1 -0
  321. package/fabric-interop/dist/components/ViroController.d.ts +20 -0
  322. package/fabric-interop/dist/components/ViroController.d.ts.map +1 -0
  323. package/fabric-interop/dist/components/ViroController.js +65 -0
  324. package/fabric-interop/dist/components/ViroController.js.map +1 -0
  325. package/fabric-interop/dist/components/ViroDirectionalLight.d.ts +29 -0
  326. package/fabric-interop/dist/components/ViroDirectionalLight.d.ts.map +1 -0
  327. package/fabric-interop/dist/components/ViroDirectionalLight.js +57 -0
  328. package/fabric-interop/dist/components/ViroDirectionalLight.js.map +1 -0
  329. package/fabric-interop/dist/components/ViroFlexView.d.ts +37 -0
  330. package/fabric-interop/dist/components/ViroFlexView.d.ts.map +1 -0
  331. package/fabric-interop/dist/components/ViroFlexView.js +98 -0
  332. package/fabric-interop/dist/components/ViroFlexView.js.map +1 -0
  333. package/fabric-interop/dist/components/ViroGeometry.d.ts +24 -0
  334. package/fabric-interop/dist/components/ViroGeometry.d.ts.map +1 -0
  335. package/fabric-interop/dist/components/ViroGeometry.js +52 -0
  336. package/fabric-interop/dist/components/ViroGeometry.js.map +1 -0
  337. package/fabric-interop/dist/components/ViroGlobal.d.ts +46 -0
  338. package/fabric-interop/dist/components/ViroGlobal.d.ts.map +1 -0
  339. package/fabric-interop/dist/components/ViroGlobal.js +21 -0
  340. package/fabric-interop/dist/components/ViroGlobal.js.map +1 -0
  341. package/fabric-interop/dist/components/ViroImage.d.ts +30 -0
  342. package/fabric-interop/dist/components/ViroImage.d.ts.map +1 -0
  343. package/fabric-interop/dist/components/ViroImage.js +54 -0
  344. package/fabric-interop/dist/components/ViroImage.js.map +1 -0
  345. package/fabric-interop/dist/components/ViroLightingEnvironment.d.ts +20 -0
  346. package/fabric-interop/dist/components/ViroLightingEnvironment.d.ts.map +1 -0
  347. package/fabric-interop/dist/components/ViroLightingEnvironment.js +46 -0
  348. package/fabric-interop/dist/components/ViroLightingEnvironment.js.map +1 -0
  349. package/fabric-interop/dist/components/ViroMaterialVideo.d.ts +31 -0
  350. package/fabric-interop/dist/components/ViroMaterialVideo.d.ts.map +1 -0
  351. package/fabric-interop/dist/components/ViroMaterialVideo.js +50 -0
  352. package/fabric-interop/dist/components/ViroMaterialVideo.js.map +1 -0
  353. package/fabric-interop/dist/components/ViroNode.d.ts +37 -0
  354. package/fabric-interop/dist/components/ViroNode.d.ts.map +1 -0
  355. package/fabric-interop/dist/components/ViroNode.js +29 -0
  356. package/fabric-interop/dist/components/ViroNode.js.map +1 -0
  357. package/fabric-interop/dist/components/ViroOmniLight.d.ts +22 -0
  358. package/fabric-interop/dist/components/ViroOmniLight.d.ts.map +1 -0
  359. package/fabric-interop/dist/components/ViroOmniLight.js +50 -0
  360. package/fabric-interop/dist/components/ViroOmniLight.js.map +1 -0
  361. package/fabric-interop/dist/components/ViroOrbitCamera.d.ts +18 -0
  362. package/fabric-interop/dist/components/ViroOrbitCamera.d.ts.map +1 -0
  363. package/fabric-interop/dist/components/ViroOrbitCamera.js +31 -0
  364. package/fabric-interop/dist/components/ViroOrbitCamera.js.map +1 -0
  365. package/fabric-interop/dist/components/ViroParticleEmitter.d.ts +52 -0
  366. package/fabric-interop/dist/components/ViroParticleEmitter.d.ts.map +1 -0
  367. package/fabric-interop/dist/components/ViroParticleEmitter.js +52 -0
  368. package/fabric-interop/dist/components/ViroParticleEmitter.js.map +1 -0
  369. package/fabric-interop/dist/components/ViroPolygon.d.ts +21 -0
  370. package/fabric-interop/dist/components/ViroPolygon.d.ts.map +1 -0
  371. package/fabric-interop/dist/components/ViroPolygon.js +49 -0
  372. package/fabric-interop/dist/components/ViroPolygon.js.map +1 -0
  373. package/fabric-interop/dist/components/ViroPolyline.d.ts +20 -0
  374. package/fabric-interop/dist/components/ViroPolyline.d.ts.map +1 -0
  375. package/fabric-interop/dist/components/ViroPolyline.js +48 -0
  376. package/fabric-interop/dist/components/ViroPolyline.js.map +1 -0
  377. package/fabric-interop/dist/components/ViroPortal.d.ts +17 -0
  378. package/fabric-interop/dist/components/ViroPortal.d.ts.map +1 -0
  379. package/fabric-interop/dist/components/ViroPortal.js +74 -0
  380. package/fabric-interop/dist/components/ViroPortal.js.map +1 -0
  381. package/fabric-interop/dist/components/ViroPortalScene.d.ts +17 -0
  382. package/fabric-interop/dist/components/ViroPortalScene.d.ts.map +1 -0
  383. package/fabric-interop/dist/components/ViroPortalScene.js +30 -0
  384. package/fabric-interop/dist/components/ViroPortalScene.js.map +1 -0
  385. package/fabric-interop/dist/components/ViroQuad.d.ts +40 -0
  386. package/fabric-interop/dist/components/ViroQuad.d.ts.map +1 -0
  387. package/fabric-interop/dist/components/ViroQuad.js +51 -0
  388. package/fabric-interop/dist/components/ViroQuad.js.map +1 -0
  389. package/fabric-interop/dist/components/ViroScene.d.ts +30 -0
  390. package/fabric-interop/dist/components/ViroScene.d.ts.map +1 -0
  391. package/fabric-interop/dist/components/ViroScene.js +105 -0
  392. package/fabric-interop/dist/components/ViroScene.js.map +1 -0
  393. package/fabric-interop/dist/components/ViroSceneNavigator.d.ts +24 -0
  394. package/fabric-interop/dist/components/ViroSceneNavigator.d.ts.map +1 -0
  395. package/fabric-interop/dist/components/ViroSceneNavigator.js +74 -0
  396. package/fabric-interop/dist/components/ViroSceneNavigator.js.map +1 -0
  397. package/fabric-interop/dist/components/ViroSkyBox.d.ts +40 -0
  398. package/fabric-interop/dist/components/ViroSkyBox.d.ts.map +1 -0
  399. package/fabric-interop/dist/components/ViroSkyBox.js +46 -0
  400. package/fabric-interop/dist/components/ViroSkyBox.js.map +1 -0
  401. package/fabric-interop/dist/components/ViroSound.d.ts +24 -0
  402. package/fabric-interop/dist/components/ViroSound.d.ts.map +1 -0
  403. package/fabric-interop/dist/components/ViroSound.js +48 -0
  404. package/fabric-interop/dist/components/ViroSound.js.map +1 -0
  405. package/fabric-interop/dist/components/ViroSoundField.d.ts +25 -0
  406. package/fabric-interop/dist/components/ViroSoundField.d.ts.map +1 -0
  407. package/fabric-interop/dist/components/ViroSoundField.js +49 -0
  408. package/fabric-interop/dist/components/ViroSoundField.js.map +1 -0
  409. package/fabric-interop/dist/components/ViroSpatialSound.d.ts +28 -0
  410. package/fabric-interop/dist/components/ViroSpatialSound.d.ts.map +1 -0
  411. package/fabric-interop/dist/components/ViroSpatialSound.js +52 -0
  412. package/fabric-interop/dist/components/ViroSpatialSound.js.map +1 -0
  413. package/fabric-interop/dist/components/ViroSphere.d.ts +23 -0
  414. package/fabric-interop/dist/components/ViroSphere.d.ts.map +1 -0
  415. package/fabric-interop/dist/components/ViroSphere.js +51 -0
  416. package/fabric-interop/dist/components/ViroSphere.js.map +1 -0
  417. package/fabric-interop/dist/components/ViroSpinner.d.ts +19 -0
  418. package/fabric-interop/dist/components/ViroSpinner.d.ts.map +1 -0
  419. package/fabric-interop/dist/components/ViroSpinner.js +47 -0
  420. package/fabric-interop/dist/components/ViroSpinner.js.map +1 -0
  421. package/fabric-interop/dist/components/ViroSpotLight.d.ts +31 -0
  422. package/fabric-interop/dist/components/ViroSpotLight.d.ts.map +1 -0
  423. package/fabric-interop/dist/components/ViroSpotLight.js +59 -0
  424. package/fabric-interop/dist/components/ViroSpotLight.js.map +1 -0
  425. package/fabric-interop/dist/components/ViroSurface.d.ts +39 -0
  426. package/fabric-interop/dist/components/ViroSurface.d.ts.map +1 -0
  427. package/fabric-interop/dist/components/ViroSurface.js +50 -0
  428. package/fabric-interop/dist/components/ViroSurface.js.map +1 -0
  429. package/fabric-interop/dist/components/ViroText.d.ts +37 -0
  430. package/fabric-interop/dist/components/ViroText.d.ts.map +1 -0
  431. package/fabric-interop/dist/components/ViroText.js +61 -0
  432. package/fabric-interop/dist/components/ViroText.js.map +1 -0
  433. package/fabric-interop/dist/components/ViroUtils.d.ts +64 -0
  434. package/fabric-interop/dist/components/ViroUtils.d.ts.map +1 -0
  435. package/fabric-interop/dist/components/ViroUtils.js +141 -0
  436. package/fabric-interop/dist/components/ViroUtils.js.map +1 -0
  437. package/fabric-interop/dist/components/ViroVRSceneNavigator.d.ts +26 -0
  438. package/fabric-interop/dist/components/ViroVRSceneNavigator.d.ts.map +1 -0
  439. package/fabric-interop/dist/components/ViroVRSceneNavigator.js +74 -0
  440. package/fabric-interop/dist/components/ViroVRSceneNavigator.js.map +1 -0
  441. package/fabric-interop/dist/components/ViroVideo.d.ts +33 -0
  442. package/fabric-interop/dist/components/ViroVideo.d.ts.map +1 -0
  443. package/fabric-interop/dist/components/ViroVideo.js +54 -0
  444. package/fabric-interop/dist/components/ViroVideo.js.map +1 -0
  445. package/fabric-interop/dist/components/index.d.ts +63 -0
  446. package/fabric-interop/dist/components/index.d.ts.map +1 -0
  447. package/fabric-interop/dist/components/index.js +145 -0
  448. package/fabric-interop/dist/components/index.js.map +1 -0
  449. package/fabric-interop/dist/index.d.ts +15 -0
  450. package/fabric-interop/dist/index.d.ts.map +1 -0
  451. package/fabric-interop/dist/index.js +118 -0
  452. package/fabric-interop/dist/index.js.map +1 -0
  453. package/fabric-interop/dist/specs/ViroEventsTurboModule.d.ts +20 -0
  454. package/fabric-interop/dist/specs/ViroEventsTurboModule.d.ts.map +1 -0
  455. package/fabric-interop/dist/specs/ViroEventsTurboModule.js +12 -0
  456. package/fabric-interop/dist/specs/ViroEventsTurboModule.js.map +1 -0
  457. package/fabric-interop/examples/BasicSceneExample.tsx +287 -0
  458. package/fabric-interop/examples/ComprehensiveExample.tsx +441 -0
  459. package/fabric-interop/examples/SimpleARExample.tsx +95 -0
  460. package/fabric-interop/global.d.ts +14 -0
  461. package/fabric-interop/index.ts +107 -0
  462. package/fabric-interop/metro.config.js +12 -0
  463. package/fabric-interop/package.json +40 -0
  464. package/fabric-interop/react-native.config.js +22 -0
  465. package/fabric-interop/scripts/validate-build.js +393 -0
  466. package/fabric-interop/scripts/validate-implementation.js +272 -0
  467. package/fabric-interop/specs/README.md +22 -0
  468. package/fabric-interop/specs/ViroEventsTurboModule.ts +27 -0
  469. package/fabric-interop/test/BasicFunctionalityTest.tsx +243 -0
  470. package/fabric-interop/tsconfig.json +38 -0
  471. package/fabric.d.ts +5 -0
  472. package/fabric.ts +14 -0
  473. package/ios/ViroReact.podspec +51 -11
  474. package/package.json +33 -20
  475. package/scripts/copy-types.js +46 -0
@@ -0,0 +1,100 @@
1
+ /**
2
+ * ViroARObjectMarker
3
+ *
4
+ * A component for detecting and tracking 3D objects in the real world.
5
+ */
6
+
7
+ import React from "react";
8
+ import {
9
+ ViroCommonProps,
10
+ useViroNode,
11
+ convertCommonProps,
12
+ ViroContextProvider,
13
+ useViroEventListeners,
14
+ } from "./ViroUtils";
15
+ import { getNativeViro } from "./ViroGlobal";
16
+
17
+ export interface ViroARObjectMarkerProps extends ViroCommonProps {
18
+ // Object marker properties
19
+ target: string;
20
+
21
+ // Visual properties
22
+ visible?: boolean;
23
+ opacity?: number;
24
+
25
+ // Events
26
+ onAnchorFound?: () => void;
27
+ onAnchorUpdated?: () => void;
28
+ onAnchorRemoved?: () => void;
29
+
30
+ // Children components
31
+ children?: React.ReactNode;
32
+ }
33
+
34
+ /**
35
+ * ViroARObjectMarker is a component for detecting and tracking 3D objects in the real world.
36
+ * It allows you to attach virtual content to real-world objects, such as toys, furniture, or other physical items.
37
+ */
38
+ export const ViroARObjectMarker: React.FC<ViroARObjectMarkerProps> = (
39
+ props
40
+ ) => {
41
+ // Convert common props to the format expected by the native code
42
+ const nativeProps = {
43
+ ...convertCommonProps(props),
44
+ target: props.target,
45
+ visible: props.visible,
46
+ opacity: props.opacity,
47
+ };
48
+
49
+ // Create the node (parent will be determined by context)
50
+ const nodeId = useViroNode("arObjectMarker", nativeProps);
51
+
52
+ // Register event handlers
53
+ React.useEffect(() => {
54
+ const nativeViro = getNativeViro();
55
+ if (!nativeViro) return;
56
+
57
+ const eventHandlers = [
58
+ { name: "onAnchorFound", handler: props.onAnchorFound },
59
+ { name: "onAnchorUpdated", handler: props.onAnchorUpdated },
60
+ { name: "onAnchorRemoved", handler: props.onAnchorRemoved },
61
+ ];
62
+
63
+ // Register all event handlers and store callback IDs for cleanup
64
+ const registeredCallbacks = eventHandlers
65
+ .filter(({ handler }) => !!handler)
66
+ .map(({ name, handler }) => {
67
+ const callbackId = `${nodeId}_${name}`;
68
+
69
+ // Register the callback in the global registry
70
+ if (typeof global !== "undefined" && global.registerViroEventCallback) {
71
+ global.registerViroEventCallback(callbackId, handler);
72
+ }
73
+
74
+ // Register with native code
75
+ nativeViro.registerEventCallback(nodeId, name, callbackId);
76
+ return { name, callbackId };
77
+ });
78
+
79
+ // Cleanup when unmounting
80
+ return () => {
81
+ const nativeViro = getNativeViro();
82
+ if (!nativeViro) return;
83
+
84
+ // Unregister all event handlers
85
+ registeredCallbacks.forEach(({ name, callbackId }) => {
86
+ nativeViro.unregisterEventCallback(nodeId, name, callbackId);
87
+ });
88
+ };
89
+ }, [
90
+ nodeId,
91
+ props.onAnchorFound,
92
+ props.onAnchorUpdated,
93
+ props.onAnchorRemoved,
94
+ ]);
95
+
96
+ // Render children with this AR object marker as their parent
97
+ return (
98
+ <ViroContextProvider value={nodeId}>{props.children}</ViroContextProvider>
99
+ );
100
+ };
@@ -0,0 +1,120 @@
1
+ /**
2
+ * ViroARPlane
3
+ *
4
+ * A component for rendering AR planes detected by the AR system.
5
+ */
6
+
7
+ import React from "react";
8
+ import {
9
+ ViroCommonProps,
10
+ useViroNode,
11
+ convertCommonProps,
12
+ ViroContextProvider,
13
+ useViroEventListeners,
14
+ } from "./ViroUtils";
15
+ import { getNativeViro } from "./ViroGlobal";
16
+
17
+ export interface ViroARPlaneProps extends ViroCommonProps {
18
+ // Plane properties
19
+ alignment?: "Horizontal" | "Vertical";
20
+ minHeight?: number;
21
+ minWidth?: number;
22
+
23
+ // Visual properties
24
+ visible?: boolean;
25
+ opacity?: number;
26
+
27
+ // Materials
28
+ materials?: string | string[];
29
+
30
+ // Events
31
+ onAnchorFound?: () => void;
32
+ onAnchorUpdated?: () => void;
33
+ onAnchorRemoved?: () => void;
34
+
35
+ // Children components
36
+ children?: React.ReactNode;
37
+ }
38
+
39
+ /**
40
+ * ViroARPlane is a component for rendering AR planes detected by the AR system.
41
+ * It represents a real-world surface detected by the AR system, such as a floor, table, or wall.
42
+ */
43
+ export const ViroARPlane: React.FC<ViroARPlaneProps> = (props) => {
44
+ // Convert common props to the format expected by the native code
45
+ const nativeProps = {
46
+ ...convertCommonProps(props),
47
+ alignment: props.alignment,
48
+ minHeight: props.minHeight,
49
+ minWidth: props.minWidth,
50
+ visible: props.visible,
51
+ opacity: props.opacity,
52
+ materials: props.materials,
53
+ };
54
+
55
+ // Create the node (parent will be determined by context)
56
+ const nodeId = useViroNode("arPlane", nativeProps);
57
+
58
+ // Register event handlers
59
+ React.useEffect(() => {
60
+ const nativeViro = getNativeViro();
61
+ if (!nativeViro) return;
62
+
63
+ const eventHandlers = [
64
+ { name: "onAnchorFound", handler: props.onAnchorFound },
65
+ { name: "onAnchorUpdated", handler: props.onAnchorUpdated },
66
+ { name: "onAnchorRemoved", handler: props.onAnchorRemoved },
67
+ { name: "onHover", handler: props.onHover },
68
+ { name: "onClick", handler: props.onClick },
69
+ { name: "onClickState", handler: props.onClickState },
70
+ { name: "onTouch", handler: props.onTouch },
71
+ { name: "onDrag", handler: props.onDrag },
72
+ { name: "onPinch", handler: props.onPinch },
73
+ { name: "onRotate", handler: props.onRotate },
74
+ ];
75
+
76
+ // Register all event handlers and store callback IDs for cleanup
77
+ const registeredCallbacks = eventHandlers
78
+ .filter(({ handler }) => !!handler)
79
+ .map(({ name, handler }) => {
80
+ const callbackId = `${nodeId}_${name}`;
81
+
82
+ // Register the callback in the global registry
83
+ if (typeof global !== "undefined" && global.registerViroEventCallback) {
84
+ global.registerViroEventCallback(callbackId, handler);
85
+ }
86
+
87
+ // Register with native code
88
+ nativeViro.registerEventCallback(nodeId, name, callbackId);
89
+ return { name, callbackId };
90
+ });
91
+
92
+ // Cleanup when unmounting
93
+ return () => {
94
+ const nativeViro = getNativeViro();
95
+ if (!nativeViro) return;
96
+
97
+ // Unregister all event handlers
98
+ registeredCallbacks.forEach(({ name, callbackId }) => {
99
+ nativeViro.unregisterEventCallback(nodeId, name, callbackId);
100
+ });
101
+ };
102
+ }, [
103
+ nodeId,
104
+ props.onAnchorFound,
105
+ props.onAnchorUpdated,
106
+ props.onAnchorRemoved,
107
+ props.onHover,
108
+ props.onClick,
109
+ props.onClickState,
110
+ props.onTouch,
111
+ props.onDrag,
112
+ props.onPinch,
113
+ props.onRotate,
114
+ ]);
115
+
116
+ // Render children with this AR plane as their parent
117
+ return (
118
+ <ViroContextProvider value={nodeId}>{props.children}</ViroContextProvider>
119
+ );
120
+ };
@@ -0,0 +1,127 @@
1
+ /**
2
+ * ViroARScene
3
+ *
4
+ * A specialized scene for AR content that uses the device's camera as a background.
5
+ */
6
+
7
+ import React from "react";
8
+ import {
9
+ ViroCommonProps,
10
+ useViroNode,
11
+ convertCommonProps,
12
+ useViroEventListeners,
13
+ } from "./ViroUtils";
14
+ import { getNativeViro } from "./ViroGlobal";
15
+
16
+ export interface ViroARSceneProps extends ViroCommonProps {
17
+ // AR-specific props
18
+ anchorDetectionTypes?: ("PlanesHorizontal" | "PlanesVertical" | "Faces")[];
19
+ planeDetectionEnabled?: boolean;
20
+
21
+ // Lighting props
22
+ lightReceivingBitMask?: number;
23
+ shadowCastingBitMask?: number;
24
+
25
+ // Physics props
26
+ physicsWorld?: {
27
+ gravity?: [number, number, number];
28
+ };
29
+
30
+ // Post-processing props
31
+ postProcessEffects?: string[];
32
+
33
+ // Event callbacks
34
+ onTrackingUpdated?: (event: any) => void;
35
+ onAmbientLightUpdate?: (event: any) => void;
36
+ onPlatformUpdate?: (event: any) => void;
37
+ onCameraTransformUpdate?: (event: any) => void;
38
+ onAnchorFound?: (event: any) => void;
39
+ onAnchorUpdated?: (event: any) => void;
40
+ onAnchorRemoved?: (event: any) => void;
41
+
42
+ // Children components
43
+ children?: React.ReactNode;
44
+ }
45
+
46
+ /**
47
+ * ViroARScene is a specialized scene for AR content that uses the device's camera as a background.
48
+ */
49
+ export const ViroARScene: React.FC<ViroARSceneProps> = (props) => {
50
+ // Convert common props to the format expected by the native code
51
+ const nativeProps = {
52
+ ...convertCommonProps(props),
53
+ anchorDetectionTypes: props.anchorDetectionTypes,
54
+ planeDetectionEnabled: props.planeDetectionEnabled,
55
+ lightReceivingBitMask: props.lightReceivingBitMask,
56
+ shadowCastingBitMask: props.shadowCastingBitMask,
57
+ physicsWorld: props.physicsWorld,
58
+ postProcessEffects: props.postProcessEffects,
59
+ onTrackingUpdated: props.onTrackingUpdated ? true : undefined,
60
+ onAmbientLightUpdate: props.onAmbientLightUpdate ? true : undefined,
61
+ onPlatformUpdate: props.onPlatformUpdate ? true : undefined,
62
+ onCameraTransformUpdate: props.onCameraTransformUpdate ? true : undefined,
63
+ onAnchorFound: props.onAnchorFound ? true : undefined,
64
+ onAnchorUpdated: props.onAnchorUpdated ? true : undefined,
65
+ onAnchorRemoved: props.onAnchorRemoved ? true : undefined,
66
+ };
67
+
68
+ // Create the AR scene node - this is a root node, so no parent
69
+ const nodeId = useViroNode("arScene", nativeProps);
70
+
71
+ // Register event handlers
72
+ React.useEffect(() => {
73
+ const nativeViro = getNativeViro();
74
+ if (!nativeViro) return;
75
+
76
+ // Register event handlers if provided
77
+ const eventHandlers = [
78
+ { name: "onTrackingUpdated", handler: props.onTrackingUpdated },
79
+ { name: "onAmbientLightUpdate", handler: props.onAmbientLightUpdate },
80
+ { name: "onPlatformUpdate", handler: props.onPlatformUpdate },
81
+ {
82
+ name: "onCameraTransformUpdate",
83
+ handler: props.onCameraTransformUpdate,
84
+ },
85
+ { name: "onAnchorFound", handler: props.onAnchorFound },
86
+ { name: "onAnchorUpdated", handler: props.onAnchorUpdated },
87
+ { name: "onAnchorRemoved", handler: props.onAnchorRemoved },
88
+ ];
89
+
90
+ // Register all event handlers
91
+ const registeredCallbacks = eventHandlers
92
+ .filter(({ handler }) => !!handler)
93
+ .map(({ name, handler }) => {
94
+ const callbackId = `${nodeId}_${name}`;
95
+ nativeViro.registerEventCallback(nodeId, name, callbackId);
96
+ return { name, callbackId };
97
+ });
98
+
99
+ // Cleanup when unmounting
100
+ return () => {
101
+ const nativeViro = getNativeViro();
102
+ if (!nativeViro) return;
103
+
104
+ // Unregister all event handlers
105
+ registeredCallbacks.forEach(({ name, callbackId }) => {
106
+ nativeViro.unregisterEventCallback(nodeId, name, callbackId);
107
+ });
108
+ };
109
+ }, [
110
+ nodeId,
111
+ props.onTrackingUpdated,
112
+ props.onAmbientLightUpdate,
113
+ props.onPlatformUpdate,
114
+ props.onCameraTransformUpdate,
115
+ props.onAnchorFound,
116
+ props.onAnchorUpdated,
117
+ props.onAnchorRemoved,
118
+ ]);
119
+
120
+ // Render children with this scene as their parent
121
+ return (
122
+ <ViroContextProvider value={nodeId}>{props.children}</ViroContextProvider>
123
+ );
124
+ };
125
+
126
+ // Import ViroContextProvider at the top level to avoid circular dependencies
127
+ import { ViroContextProvider } from "./ViroUtils";
@@ -0,0 +1,82 @@
1
+ /**
2
+ * ViroARSceneNavigator
3
+ *
4
+ * A component for rendering AR scenes.
5
+ */
6
+
7
+ import React, { useState, useEffect } from "react";
8
+ import { ViroFabricContainer } from "../ViroFabricContainer";
9
+ import { getNativeViro } from "./ViroGlobal";
10
+
11
+ export interface ViroARSceneNavigatorProps {
12
+ // Scene properties
13
+ initialScene: {
14
+ scene: React.ComponentType<any>;
15
+ };
16
+
17
+ // AR properties
18
+ autofocus?: boolean;
19
+ worldAlignment?: "Gravity" | "GravityAndHeading" | "Camera";
20
+ videoQuality?: "High" | "Low";
21
+
22
+ // Plane detection
23
+ planeDetection?: {
24
+ horizontal?: boolean;
25
+ vertical?: boolean;
26
+ };
27
+
28
+ // Events
29
+ onTrackingUpdated?: (event: { state: string; reason?: string }) => void;
30
+ onARSessionFailed?: (error: string) => void;
31
+
32
+ // Style
33
+ style?: React.CSSProperties;
34
+ }
35
+
36
+ /**
37
+ * ViroARSceneNavigator is a component for rendering AR scenes.
38
+ * It provides a container for AR scenes and handles the AR session lifecycle.
39
+ */
40
+ export const ViroARSceneNavigator: React.FC<ViroARSceneNavigatorProps> = (
41
+ props
42
+ ) => {
43
+ // Initialize AR session
44
+ useEffect(() => {
45
+ const nativeViro = getNativeViro();
46
+ if (!nativeViro) return;
47
+
48
+ // Initialize Viro (no API key needed)
49
+ nativeViro.initialize();
50
+
51
+ // Set plane detection
52
+ if (props.planeDetection) {
53
+ nativeViro.setViroARPlaneDetection({
54
+ horizontal: props.planeDetection.horizontal ?? false,
55
+ vertical: props.planeDetection.vertical ?? false,
56
+ });
57
+ }
58
+
59
+ // Cleanup when unmounting
60
+ return () => {
61
+ // Cleanup code here
62
+ };
63
+ }, [props.planeDetection]);
64
+
65
+ // Create the scene component
66
+ const SceneComponent = props.initialScene.scene;
67
+
68
+ // Render the AR scene
69
+ return (
70
+ <ViroFabricContainer
71
+ style={props.style}
72
+ arEnabled={true}
73
+ autofocus={props.autofocus}
74
+ worldAlignment={props.worldAlignment}
75
+ videoQuality={props.videoQuality}
76
+ onTrackingUpdated={props.onTrackingUpdated}
77
+ onARSessionFailed={props.onARSessionFailed}
78
+ >
79
+ <SceneComponent />
80
+ </ViroFabricContainer>
81
+ );
82
+ };
@@ -0,0 +1,62 @@
1
+ /**
2
+ * ViroAmbientLight
3
+ *
4
+ * A component for adding ambient lighting to a scene.
5
+ */
6
+
7
+ import React from "react";
8
+ import {
9
+ ViroCommonProps,
10
+ useViroNode,
11
+ useViroEventListeners,
12
+ convertCommonProps,
13
+ } from "./ViroUtils";
14
+
15
+ export interface ViroAmbientLightProps extends ViroCommonProps {
16
+ // Light properties
17
+ color?: string;
18
+ intensity?: number;
19
+ temperature?: number;
20
+ influenceBitMask?: number;
21
+ }
22
+
23
+ /**
24
+ * ViroAmbientLight is a component for adding ambient lighting to a scene.
25
+ * Ambient light is a type of light that illuminates all objects in the scene equally,
26
+ * regardless of their position or orientation.
27
+ */
28
+ export const ViroAmbientLight: React.FC<ViroAmbientLightProps> = (props) => {
29
+ // Convert common props to the format expected by the native code
30
+ const nativeProps = {
31
+ ...convertCommonProps(props),
32
+ color: props.color,
33
+ intensity: props.intensity,
34
+ temperature: props.temperature,
35
+ influenceBitMask: props.influenceBitMask,
36
+ };
37
+
38
+ // Create the node (parent will be determined by context)
39
+ const nodeId = useViroNode("ambientLight", nativeProps);
40
+
41
+ // Register event handlers using our new event system
42
+ useViroEventListeners(nodeId, {
43
+ onHover: props.onHover,
44
+ onClick: props.onClick,
45
+ onClickState: props.onClickState,
46
+ onTouch: props.onTouch,
47
+ onScroll: props.onScroll,
48
+ onSwipe: props.onSwipe,
49
+ onDrag: props.onDrag,
50
+ onPinch: props.onPinch,
51
+ onRotate: props.onRotate,
52
+ onFuse:
53
+ typeof props.onFuse === "function"
54
+ ? props.onFuse
55
+ : props.onFuse?.callback,
56
+ onCollision: props.onCollision,
57
+ onTransformUpdate: props.onTransformUpdate,
58
+ });
59
+
60
+ // Ambient light doesn't have children, so just return null
61
+ return null;
62
+ };
@@ -0,0 +1,91 @@
1
+ /**
2
+ * ViroAnimatedComponent
3
+ *
4
+ * A component wrapper for adding animations to Viro components.
5
+ */
6
+
7
+ import React from "react";
8
+ import {
9
+ ViroCommonProps,
10
+ useViroNode,
11
+ convertCommonProps,
12
+ ViroContextProvider,
13
+ useViroEventListeners,
14
+ } from "./ViroUtils";
15
+ import { getNativeViro } from "./ViroGlobal";
16
+
17
+ export interface ViroAnimatedComponentProps extends ViroCommonProps {
18
+ // Animation properties
19
+ animation?: {
20
+ name?: string;
21
+ delay?: number;
22
+ loop?: boolean;
23
+ onStart?: () => void;
24
+ onFinish?: () => void;
25
+ run?: boolean;
26
+ interruptible?: boolean;
27
+ };
28
+
29
+ // Children components
30
+ children?: React.ReactNode;
31
+ }
32
+
33
+ /**
34
+ * ViroAnimatedComponent is a wrapper for adding animations to Viro components.
35
+ * It provides animation capabilities to its children.
36
+ */
37
+ export const ViroAnimatedComponent: React.FC<ViroAnimatedComponentProps> = (
38
+ props
39
+ ) => {
40
+ // Convert common props to the format expected by the native code
41
+ const nativeProps = {
42
+ ...convertCommonProps(props),
43
+ animation: props.animation,
44
+ };
45
+
46
+ // Create the node (parent will be determined by context)
47
+ const nodeId = useViroNode("animatedComponent", nativeProps);
48
+
49
+ // Register animation event handlers
50
+ React.useEffect(() => {
51
+ const nativeViro = getNativeViro();
52
+ if (!nativeViro || !props.animation) return;
53
+
54
+ const eventHandlers = [
55
+ { name: "onAnimationStart", handler: props.animation.onStart },
56
+ { name: "onAnimationFinish", handler: props.animation.onFinish },
57
+ ];
58
+
59
+ // Register all event handlers and store callback IDs for cleanup
60
+ const registeredCallbacks = eventHandlers
61
+ .filter(({ handler }) => !!handler)
62
+ .map(({ name, handler }) => {
63
+ const callbackId = `${nodeId}_${name}`;
64
+
65
+ // Register the callback in the global registry
66
+ if (typeof global !== "undefined" && global.registerViroEventCallback) {
67
+ global.registerViroEventCallback(callbackId, handler);
68
+ }
69
+
70
+ // Register with native code
71
+ nativeViro.registerEventCallback(nodeId, name, callbackId);
72
+ return { name, callbackId };
73
+ });
74
+
75
+ // Cleanup when unmounting
76
+ return () => {
77
+ const nativeViro = getNativeViro();
78
+ if (!nativeViro) return;
79
+
80
+ // Unregister all event handlers
81
+ registeredCallbacks.forEach(({ name, callbackId }) => {
82
+ nativeViro.unregisterEventCallback(nodeId, name, callbackId);
83
+ });
84
+ };
85
+ }, [nodeId, props.animation?.onStart, props.animation?.onFinish]);
86
+
87
+ // Render children with this animated component as their parent
88
+ return (
89
+ <ViroContextProvider value={nodeId}>{props.children}</ViroContextProvider>
90
+ );
91
+ };
@@ -0,0 +1,81 @@
1
+ /**
2
+ * ViroAnimatedImage
3
+ *
4
+ * A component for displaying animated images.
5
+ */
6
+
7
+ import React from "react";
8
+ import {
9
+ ViroCommonProps,
10
+ useViroNode,
11
+ convertCommonProps,
12
+ useViroEventListeners,
13
+ } from "./ViroUtils";
14
+ import { getNativeViro } from "./ViroGlobal";
15
+
16
+ export interface ViroAnimatedImageProps extends ViroCommonProps {
17
+ // Image source
18
+ source: { uri: string }[] | number[];
19
+
20
+ // Animation properties
21
+ loop?: boolean;
22
+ delay?: number;
23
+ visible?: boolean;
24
+ opacity?: number;
25
+ width?: number;
26
+ height?: number;
27
+
28
+ // Material properties
29
+ materials?: string | string[];
30
+
31
+ // Events
32
+ onLoadStart?: () => void;
33
+ onLoadEnd?: () => void;
34
+ onError?: (error: string) => void;
35
+ onFinish?: () => void;
36
+ }
37
+
38
+ /**
39
+ * ViroAnimatedImage is a component for displaying animated images.
40
+ * It can be used to create simple animations by cycling through a series of images.
41
+ */
42
+ export const ViroAnimatedImage: React.FC<ViroAnimatedImageProps> = (props) => {
43
+ // Convert common props to the format expected by the native code
44
+ const nativeProps = {
45
+ ...convertCommonProps(props),
46
+ source: props.source,
47
+ loop: props.loop,
48
+ delay: props.delay,
49
+ visible: props.visible,
50
+ opacity: props.opacity,
51
+ width: props.width,
52
+ height: props.height,
53
+ materials: props.materials,
54
+ };
55
+
56
+ // Create the node (parent will be determined by context)
57
+ const nodeId = useViroNode("animatedImage", nativeProps);
58
+
59
+
60
+ // Register event handlers using our new event system
61
+ useViroEventListeners(nodeId, {
62
+ onHover: props.onHover,
63
+ onClick: props.onClick,
64
+ onClickState: props.onClickState,
65
+ onTouch: props.onTouch,
66
+ onScroll: props.onScroll,
67
+ onSwipe: props.onSwipe,
68
+ onDrag: props.onDrag,
69
+ onPinch: props.onPinch,
70
+ onRotate: props.onRotate,
71
+ onFuse:
72
+ typeof props.onFuse === "function"
73
+ ? props.onFuse
74
+ : props.onFuse?.callback,
75
+ onCollision: props.onCollision,
76
+ onTransformUpdate: props.onTransformUpdate,
77
+ });
78
+
79
+ // Component doesn't have children, so just return null
80
+ return null;
81
+ };