When the camera cannot focus, you may check below items,
1. Make sure the camera is clean and scratch/crack-free.
2. This issue may occur if you are too close to the object. At the time of writing, the focus distance is 8.0cm for OnePlus mobile phone camera lens. Please shoot at this distance at minimum.
3. Check whether the light is weak or not. In weak lighting conditions, the camera may struggle to focus.
4. The camera may struggle to focus on a single object. Please move the focus to the edge or find an area of color contrast.
Also,
1. Check if a third-party camera app is installed. If yes, please uninstall third-party camera apps.
2. Check for third-party apps such as guard apps(for example 360). If these apps are found, it is recommended to close or uninstall third-party guard apps.
3. Update to the latest OS version. If the phone is already running latest OS version, please clear the cache and reflash to the latest OS version.
If the action listed above can not solve the problem, please contact with OnePlus Service.