Chosen Solution
My iPhone 7 have been dropped once and the camera shakes randomly but not all the time when I’m in video mode and in apps that use my camera such as instagram but does not effect photo mode.
Typically when I hear a camera is shaking on an iPhone, it’s usually a bad camera. The OIS or Optical Image Stabilization malfunctions, resulting in a twitchy or shaky camera like you’ve described. You can start by replacing the rear camera assembly. You should be able to order a kit here on ifixit or have an independent shop do it.