Chrysolites Tech Academy

Short-Video App with React Native and Supabase · Course book

Chapter 11: The Overlay

Pairs with Lesson 11: Video Overlays, Sharing and Navigation

A video alone is not a social feed. What makes the feed interactive is the thin layer drawn over each clip: the creator's picture and name, the title, and a column of icons for liking, commenting and sharing, each with a count. This overlay has to stay readable over any video, leave the video itself visible, respond to taps without interfering with scrolling, and lead to other screens such as comments and profiles. This chapter explains how to build it: positioning layers with absolute layout, keeping text legible with gradients, formatting counts compactly, sharing through the phone's native share sheet, and navigating to comments and profiles with dynamic routes and custom headers.

Layering an overlay over video

Each feed item is a container exactly one screen tall. The video fills it, and the overlay is a second layer placed on top with absolute positioning: a view styled with position: "absolute" and offsets such as bottom, left and right is taken out of the normal flow and pinned to the edges of its parent. Two absolutely positioned groups make up the overlay: a caption area at the bottom left with the username and title, and an action column at the bottom right with the creator's avatar and the icons.

video, cover mode @creatorSunset by the harbour ♥12.4K✉318➦ avatarlike + countcommentssharecaption areagradient
Figure 11.1 — The overlay's layout. Absolutely positioned groups sit at the bottom left and right, over a gradient that keeps white text readable on any video.

An important detail is touch handling. A full-screen overlay view can intercept every touch, stopping swipes from reaching the list and taps from reaching the video. Setting pointerEvents="box-none" on the overlay's container makes the container itself ignore touches while its children, the icons and names, still receive them. Swipes then pass through to the feed, and only the icons react to taps.

Readable text over any video

Videos can be bright, dark or busy, so white text placed directly on them is often unreadable. The standard solution is a gradient behind the overlay: a layer that fades from transparent at the top to black at around 60 to 75 percent opacity at the bottom, covering the lower third of the screen where the caption sits. It darkens only the area that needs it, so the rest of the video keeps its colours. A subtle text shadow on the username and counts adds further separation for the moments when bright areas appear under the icons.

Readable also means sized for thumbs and eyes. The icons in the action column should be around 30 to 36 points with tap areas of at least 44 points, spaced so that a tap on the comment icon never lands on the like icon. Captions should be limited to a couple of lines with an ellipsis, expanding on tap, so long titles do not cover the video.

Screen-reader users need the overlay too. Each icon button should have an accessibility label that says what it does and, where relevant, the count in words, such as "Like, 12.4 thousand likes" or "Comments, 318", and an accessibility role of button. The like button can also report its state, liked or not, so that the change is announced when it is tapped. Because the icons sit over a moving video, it is also kind to respect the phone's "reduce motion" setting by toning down animations for users who have asked for that.

Animation is a large part of what makes the overlay feel alive. A quick scale-up and bounce of the heart when it is tapped, a burst of hearts where a user double-taps the video to like it, and a spinning record icon for the soundtrack are familiar touches. React Native's animation libraries can run these on the native side, so they stay smooth even while the video decodes. Double-tap needs care, because a single tap already pauses the video: the app waits a moment after the first tap to see whether a second one follows, and treats the pair as a like and a lone tap as a pause.

Finally, the overlay is drawn for every mounted item, so it should be light. Keep it a pure component that receives the video, the user and the counts as props and re-renders only when they change, and avoid running network requests inside it; the feed or a data hook should fetch counts and pass them down.

Formatting counts compactly

Counts under each icon must fit a narrow column. Social apps abbreviate large numbers: thousands become K and millions M, with one decimal place when it adds information. JavaScript's Intl.NumberFormat does this with the notation: "compact" option, using the conventions of the user's language.

Raw countCompact formHow it is calculated
318318Below 1,000: shown in full
1,2341.2K1,234 / 1,000 = 1.234, rounded to one decimal place
12,40012.4K12,400 / 1,000 = 12.4
999,9991MRounds to 1,000K, which is shown as the next unit
1,250,0001.3M1,250,000 / 1,000,000 = 1.25, rounded to 1.3
Worked example. A hand-written formatter might divide by 1,000 or 1,000,000 and round to one decimal: 12,400 becomes 12.4K and 1,250,000 becomes 1.3M, since 1.25 rounds up. The boundary needs care: 999,950 divided by 1,000 is 999.95, which rounds to 1,000.0K, an awkward result; a correct formatter checks whether rounding reached 1,000 and switches to 1.0M instead. Built-in compact formatting handles these boundaries and the user's language for you, which is why it is the better choice; the exact number of decimals it shows depends on the options and the language.

Sharing with the native share sheet

The share icon opens the phone's own share sheet, the system panel listing messaging apps, email, copy link and more. React Native's built-in Share.share({ message, url }) opens it with a message and a link, and reports whether the user completed the action or dismissed it. Using the system sheet means users see the apps they already use, in the order they prefer, without the app integrating each one.

What to share needs thought. A signed storage address expires and exposes the raw file, so it is a poor link to share. A better link is a web address for the video's page, such as one including the video's id, which can show a preview and invite people to open the app; with deep linking configured, the same address can open the app directly at that video on phones where it is installed. For a first version, sharing a message with the video's title and the app's name is a reasonable start. Counting shares is optional, but if the app shows a share count, increment it only when the share sheet reports that the user actually shared, not merely opened the sheet, so the number stays honest.

Navigating to comments and profiles

Tapping the comment icon opens the comments for that video, and tapping the avatar or username opens the creator's profile. Both need to know which video or user to show, so they use dynamic routes with parameters. Pushing { pathname: "/comments", params: { videoId: video.id, videoUserId: video.user_id } } opens the comments screen, which reads the values with useLocalSearchParams; a profile route such as /user/[id] takes the user's id from the path itself.

Parameters arrive as strings, so the receiving screen should validate them and handle missing values gracefully, for example by showing a message if the video was deleted. Passing only ids, rather than whole objects, keeps routes simple and means the screen always loads fresh data. It also keeps addresses short and shareable, and avoids stale copies of data travelling between screens, which can show out-of-date counts after the user has liked or commented.

These screens open on top of the tabs, so they need their own headers. A comments screen might be presented as a sheet sliding up from the bottom with a title showing the number of comments, while a profile screen has a back button and the username as its title. Expo Router lets each screen set its header options, and a custom header component can match the app's dark style. Because the feed is paused when its screen loses focus, opening comments pauses the video, and closing them lets it continue, which feels natural to anyone used to social apps.

The like icon, finally, is drawn here but given its full behaviour, with counts that update instantly and a record in the database, in a later chapter, once the comment section is in place. Building the overlay first, with placeholder handlers, makes it easy to see the whole interaction design before any back-end work.

Practice tasks

  1. Format 845, 7,890, 45,600, 2,400,000 and 999,950 compactly with one decimal place, handling the boundary correctly.
  2. Explain what pointerEvents="box-none" does and what would go wrong without it.
  3. Design the gradient for the overlay: where it starts, where it ends and the opacity at the bottom.
  4. Write the navigation call that opens a creator's profile using a dynamic route.
  5. Why is a signed storage address a poor choice for a shared link, and what should be shared instead?
  6. List the checks the comments screen should make on the parameters it receives.

Install Chrysolites Tech Academy

Android / Chrome / Edge: open the browser menu and choose Install app or Add to Home screen.

iPhone / iPad (Safari): tap the Share button, then Add to Home Screen.