API reference

useSpatialScene Hook

Returns whether the configured spatial feature is available. Call this hook beneath <SpatialSceneProvider>. Availability starts as false while the provider initializes and remains false on platforms that cannot initialize the feature, so cross-platform components can adapt without checking the operating system.
import {useSpatialScene} from '@metavr/layout-compat';

function SceneStatus() {
  const {isSpatialAvailable} = useSpatialScene();
  return <Text>{isSpatialAvailable ? 'Ready' : 'Unavailable'}</Text>;
}

Signature

useSpatialScene(): SpatialSceneContextValue

Returns