The Smart Stay feature, which Samsung debuted with the Galaxy S3 five years ago, is still present in the recently released Galaxy S8 and S8+. However, it's turned off by default. When activated, the Smart Stay feature keeps the screen on while you're looking at it.
The feature uses the front-facing camera of the smartphone to know whether you're looking at the screen. If it suits your use case and if you want to try it out, here's how you can enable the Smart Stay feature on your Galaxy S8 or S8+:
Step 1: Open the Settings menu either from the home screen, app drawer, or notifications shade.
Step 2: Locate and select the Advanced Features menu.
Step 3: And then activate the Smart Stay toggle, and it's done!
Note: This feature consumes additional battery power because the front-facing camera turned on to monitor whether you're looking at the screen, so your phone's battery life might reduce. Moreover, it works only in well-lit conditions, but not under direct sunlight.