Since the iPhone's Screen Recording feature shows everything going on on your screen, your notifications are visible to your viewers. The best way around this is to turn on "Do Not Disturb" from the control center.