fixed
ViroReact 3.2.2: web catches up with native and a fix for Android VR release builds
about 2 hours ago by ReadMe API
Viro on the web catches up with native: pinch, rotate and fuse, drag in live AR, styled text, material effects, node transform reads, camera reads and AR hit tests, a light estimate from the camera, sound that mixes with video on iPhone, and recovery from a lost WebGL context. On Android, a minified VR build keeps the GVR classes its native library needs. Renderer binaries are rebuilt on virocore 3.2.2. The web build needs @reactvision/viro-web-renderer 1.2.0. 3.2.2 includes everything in 3.2.1.
Web
Everything in this section is web platform support: it is new on the web and already worked on iOS and Android. See the Web Setup Guide.
- Gestures.
onPinch,onRotateandonFusework, from two fingers on a touch screen or the centre of the screen resting on a node. Drag works in live AR and in the 3D navigators, following the node every frame in its parent's space, withFixedToPlanein the Editor scene host. A press that a second finger cancels ends its drag. See ViroNode. - Node refs.
getTransformAsync,getBoundingBoxAsyncandgetMorphTargetsread a node, andsetNativePropssets its transform, opacity and visibility. See ViroNode. - Text.
ViroTexttakesfontWeight,fontStyle,extrusionDepthandouterStroke. The web carries Roboto only, as Android's sans-serif, so another family draws in Roboto at the weight and style you ask for. See ViroText. - Materials. Alpha, bloom threshold, colour write mask and chroma key work. An alpha under 1 turns depth writing off unless the material sets it, as on native. See ViroMaterials.
- AR.
onAmbientLightUpdatereports a light estimate from the camera feed, which also scales the Editor scene host's light rig.onCameraTransformUpdate,getCameraOrientationAsyncandgetCameraPositionAsyncread the camera. Hit tests returnViroARHitTestResult, throughperformARHitTestWithPoint,performARHitTestWithRay,performARHitTestWithWorldPointsandperformARHitTestWithPosition.resetARSession(true, …)restarts tracking. See ViroARScene and ViroARSceneNavigator. - Navigation and animation.
Viro3DSceneNavigatorsupportspush,pop,popN,jumpandreplace, and AR scenes get the navigator asarSceneNavigatortoo. A declarative animation'sonStartandonFinishfire, a relative animation starts from where the node is, and model clips honourdelay. See Viro3DSceneNavigator. - Capabilities. The web host lists what it drops: cloud anchors report themselves unsupported,
isARSupportedOnDeviceanswers from what the browser offers, and Editor scenes now report photo capture, video recording and occlusion as unsupported. - Editor scenes on web. Animations follow the native host's rules,
ALERTfunctions show in a dialog over the canvas,onSceneChangefires once a navigation has loaded, a scene with no plane detection holds its assets until tracking settles, and tap-to-place waits for the AR session. See StudioSceneNavigator. - Sound mixes with video on iPhone. Sounds play from decoded buffers on one audio context; on iOS a sound beside a video with sound used to go quiet. Media the browser holds back plays at the first gesture, and the page asks for a playback audio session.
- A lost WebGL context recovers. When the browser gives it back, the navigators create a new renderer and mount the scene again, and live AR shows its Start button again.
Android
- A minified VR (GVR) build keeps the classes
libgvr.solooks up by name. GVR's own rules keep only the classes marked@UsedByNative, while its native library also findsVrParamsProviderJni,GvrApi$PoseTracker,ExternalSurfaceManagerand others by name, which R8 could remove. Viro's consumer rules now keepcom.google.vr.**. Expo SDK 58 turns R8 on for release builds by default, so a VR app upgrading to it would minify GVR without opting in. AR-only apps were not affected. See Integrating with Expo.
Check when upgrading
- Web: install
@reactvision/viro-web-renderer1.2.0. The peer range is now^1.2.0. Copy its wholewasm/folder, which now carries the Roboto faces styled text uses. On an older renderer at runtime, styled text, material effects, two-finger gestures and node reads fall back with a warning. - Android on Expo SDK 58: R8 is on for release builds by default. Build a minified release APK and open it on a device before you ship. With the ONNX detector, use
@reactvision/react-viro-onnx1.0.3, whose rules keep ONNX Runtime.
See Upgrading to 3.2.0 for the upgrade notes, and the GitHub release.