export function ARKit() { const nativeRef = useRef() const onCreated = ({ gl, scene, size, setDefaultCamera }) => { AR.setPlaneDetection(AR.PlaneDetectionTypes.Horizontal); gl.gammaInput = true; gl.gammaOutput = true; scene.background = new BackgroundTexture(gl); const camera = new Camera(size.width, size.height, 0.01, 1000) setDefaultCamera(camera) } const onContextCreated = async () => { const { TrackingConfiguration, TrackingConfigurations } = AR; const finalConfig = TrackingConfiguration || TrackingConfigurations; const trackingConfiguration = finalConfig.World; await AR.startAsync(findNodeHandle(nativeRef.current), trackingConfiguration); } return ( <Canvas onCreated={onCreated} onContextCreated={onContextCreated} nativeRef_EXPERIMENTAL={nativeRef} > <ambientLight intensity={0.5} /> <pointLight color="white" intensity={1} position={[10, 10, 10]} /> <Box /> </Canvas> ) }