'How to open the camera(threejs) and run the animation(AR) in expo

I am trying to implement the AR in expo app by threejs. But Unable to open the camera. It shows only the black screen. Please help me to fix this issue. Thank you

        const Test = ()=>{
        const onContextCreate = async(gl) =>{
   const scene = new Scene();
         
          const camera = new THREE.PerspectiveCamera( 75, gl.drawingBufferWidth / gl.drawingBufferHeight, 0.1, 1000 );
gl.canvas = {width:gl.drawingBufferWidth, height:gl.drawingBufferHeight};
         camera.position.set(0.5, 0.2, 0.5);
         const renderer = new Renderer({gl});
         renderer.setSize(gl.drawingBufferWidth,gl.drawingBufferHeight);
         const geomentry = new BoxBufferGeometry(1,1,1)
         const material = new MeshBasicMaterial({
          color:'blue'
        })
        const cube = new Mesh(geomentry,material)
        scene.add(cube);
        const helper = new THREE.CameraHelper( camera );
        scene.add( helper );
      const render = ()=>{
          requestAnimationFrame(render);
          renderer.render(scene,camera);
          gl.endFrameEXP()
          }
          render()
        }  
        return(
        <View>
        <GLView 
          onContextCreate = {onContextCreate}
          style={{width:500,height:500}}
          />
        </View>
        )
        }
    export default Test;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source