Have you tried to force stop and clear the cache in the camera app?
Navigate to your settings > apps > click the 3 dots in the top right corner > select "Show System Apps" > find and click on Camera app > force stop > storage > clear cache.
Does this happen when testing the camera in safe mode? This eliminates any third-party apps that may be causing this to happen.
To boot your phone into Safe mode, start by pressing and holding the power button until the power menu appears on your screen. From there, long-press the "Power Off" button until it turns into a "Safe Mode" button. Simply tap on "Safe Mode" once it appears and your device will automatically reboot to safe mode.
- Test camera.
To exit out of safe mode, reboot device as normal.