Skip to Content

Layout Components

Structural components for page composition, safe area management, and visual separation.

import { ScreenContainer, Divider } from '@/common/components';

ScreenContainer

A safe area wrapper that serves as the foundation for every screen in the app. Handles safe area insets, optional scrolling, and consistent padding.

Basic Usage

<ScreenContainer> <Text variant="h1">Welcome</Text> <Text>Your screen content goes here.</Text> </ScreenContainer>

Scrollable Screen

<ScreenContainer scrollable> <Text variant="h1">Long Content</Text> {items.map((item) => ( <Card key={item.id}> <Text>{item.title}</Text> </Card> ))} </ScreenContainer>

Without Padding

<ScreenContainer padded={false}> <Image source={heroImage} style={{ width: '100%', height: 200 }} /> </ScreenContainer>

Custom Safe Area Edges

By default, only the top edge is respected. You can add the bottom edge or customize as needed.

<ScreenContainer edges={['top', 'bottom']}> <Text>Protected from both top and bottom insets</Text> </ScreenContainer>

Props

PropTypeDefaultDescription
childrenReactNoderequiredContent to render
scrollablebooleanfalseWrap content in a ScrollView
paddedbooleantrueApply horizontal and vertical padding
edges('top' | 'bottom')[]['top']Safe area edges to respect
styleViewStyleAdditional styles applied to the container

ScreenContainer uses react-native-safe-area-context under the hood. The edges prop controls which system bars (status bar, home indicator) are accounted for in the layout.


Divider

A thin separator line for visually dividing content sections. Supports horizontal and vertical orientations.

Horizontal (Default)

<Text>Section A</Text> <Divider /> <Text>Section B</Text>

Vertical

Useful for separating inline elements like toolbar buttons.

<View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}> <IconButton icon="copy-outline" accessibilityLabel="Copy" /> <Divider orientation="vertical" /> <IconButton icon="share-outline" accessibilityLabel="Share" /> </View>

Bold

A thicker divider for stronger visual separation.

<Divider bold />

Inset

Adds horizontal margin to the divider — useful inside lists to align with content that has left icons or avatars.

<ListItem title="First Item" /> <Divider inset /> <ListItem title="Second Item" />

Props

PropTypeDefaultDescription
orientation'horizontal' | 'vertical''horizontal'Direction of the divider line
boldbooleanfalseRender a thicker divider
insetbooleanfalseAdd horizontal margin (inset)
Last updated on