iTranslated by AI
Supporting SafeArea in Lynx
Lynx is currently quite hot, but since there was no information regarding SafeArea support, I'll leave it here.
Unless you're doing something like PWA support, you rarely need to worry about SafeArea in web app development, but when developing mobile apps, you need to be mindful of it.
What is SafeArea
Even when you open an app on iOS or Android devices, the OS UI basically remains.
- Top of screen: Notch, status bar (current time, notification icons, Dynamic Island, etc.)
- Bottom of screen: Home bar, navigation bar
The SafeArea is the safe area provided so that the app's UI does not interfere with these regions.
👇 In fact, if you design without being conscious of the SafeArea, it will look like this.

The iPhone's time display and the header text are overlapping.
Then, you might think, "Can't I just use padding-top?", but the size of this area varies by device, so you have to get the value from somewhere.
Implementation
In CSS, you can handle it by using the env() function.
top: env(safe-area-inset-top)
left: env(safe-area-inset-left)
right: env(safe-area-inset-right)
bottom: env(safe-area-inset-bottom)
env(safe-area-inset-*) returns values like px, rem, etc.
Therefore, you can also perform calculations by combining it with calc().

CSS only👍
Sample Code
import "./App.css"
export function App() {
return (
<page className="app-container">
<view className="app-header">
<text className="brand">SafeHeader</text>
</view>
<view className="app-body">
<text>Hello world!</text>
</view>
</page>
)
}
.app-container {
/* SafeArea support for the bottom of the device */
padding-bottom: env(safe-area-inset-bottom);
}
.app-header {
/* SafeArea support for the top of the device (extending the top of the header) */
padding-top: env(safe-area-inset-top);
height: calc(env(safe-area-inset-top) + 50px);
/* Header style */
padding-left: 20px;
padding-right: 20px;
display: flex;
align-items: center;
background-color: #e7e9ec;
.brand {
font-size: 18px;
}
}
.app-body {
padding: 16px;
}
Shockingly small amount of code 😲
Closing
What I thought after using Lynx is that it is overwhelmingly low-code and blazingly fast compared to React Native (especially the startup).
I'm impressed that the startup is so fast that it feels like running npm run dev with Vite.
While it's still unstable and information is limited, it is very attractive, so I hope that Lynx's development and its community will become even more active.
Discussion