suiss/uim · React Native Component

Screen

A full-screen container that pads for safe area insets and sets the status bar style.

Screen is an open-source mobile component from suiss/uim for React Native and Expo, with SwiftUI and Jetpack Compose versions built from the same design tokens. The @esuiss/uim CLI copies its source into your project, so you own the code.

iOS
Screen on iOS in light mode

Screen is a View that fills the screen, paints the surface background and adds padding for the safe area insets on the edges you choose. It also renders a StatusBar with light or dark content to match the color scheme.

ScreenContent lays out the body with padding and gaps. With scrollable, it renders a KeyboardScrollView so content scrolls and stays above the keyboard.

Installation

$ pnpm dlx @esuiss/uim@latest add screen

The CLI also adds what it builds on: Keyboard Scroll View.

Manual

  1. Install the dependencies:
npx expo install cn react-native-safe-area-context
  1. Add the pieces it builds on: Keyboard Scroll View.

  2. Copy the source into components/ui/screen.tsx:

uniwind/components/ui/screen.tsx
import { cn } from "cn"
import * as React from "react"
import { StatusBar, useColorScheme, View, type ViewProps } from "react-native"
import { useSafeAreaInsets } from "react-native-safe-area-context"
import { KeyboardScrollView } from "@/components/ui/keyboard-scroll-view"

type ScreenEdge = "top" | "right" | "bottom" | "left"

const ALL_EDGES: readonly ScreenEdge[] = ["top", "right", "bottom", "left"]

const ScreenContext = React.createContext<{
  edges: readonly ScreenEdge[]
} | null>(null)

function Screen({
  edges = ALL_EDGES,
  1. Update the import paths to match your project.

Usage

import { Screen, ScreenContent } from "@/components/ui/screen"
<Screen className="-m-4">
  <ScreenContent>
    <Text variant="h2">Account</Text>
    <Text variant="muted">
      The screen pads every safe-area edge and sets the status bar style
      from the color scheme.
    </Text>
    <Rows />
  </ScreenContent>
</Screen>

Wrap each screen in Screen and put the body in ScreenContent. Use variant="secondary" for grouped screens such as settings.

Pass edges to pad only some sides, for example ["top"] when a tab bar or bottom bar handles the bottom inset. Set scrollable on ScreenContent for content taller than the screen or for forms.

The app must be wrapped in a SafeAreaProvider from react-native-safe-area-context. ScreenContext exposes the active edges to children.

Examples

Secondary

A screen with the secondary background.

iOS
Screen (secondary) on iOS in light mode

Scrollable

A screen whose content scrolls.

iOS
Screen (scrollable) on iOS in light mode

Top edge only

A screen that pads only the top inset.

iOS
Screen (top edge only) on iOS in light mode

With bottom bar

A scrollable form with a bottom bar holding the main action.

iOS
Screen (with bottom bar) on iOS in light mode

API Reference

Screen

The root view that pads for safe area insets.

ExtendsViewProps
PropType
About
Which sides get safe area padding: any of top, right, bottom, left. Defaults to all four.
Type
readonly ScreenEdge[]
Default
ALL_EDGES
About
Background: default or secondary.
Type
"default""secondary"
Default
"default"

ScreenContent

The padded body, optionally scrollable.

ExtendsViewProps
PropType
About
Renders a KeyboardScrollView instead of a View. Defaults to false.
Type
boolean
Default
false

Notes

  • Uses the bg-surface and bg-surface-secondary tokens.
  • The status bar uses light-content in dark mode and dark-content in light mode, following the system appearance.
  • Requires react-native-safe-area-context and the Keyboard Scroll View component.