ba-screen
Root of a React Native screen. Paints the theme background, sets the status bar, and applies safe-area insets
Airframe
Web Components
React
React Native
Props
| Prop | Description | Type | Default |
|---|---|---|---|
children |
ReactNode |
||
theme |
Surface palette for this screen. Omit to follow {@link BaModeProvider } ( default in light mode, midnight-700 in dark). With no provider, thisis default. |
BaTheme |
|
statusBarStyle |
Status bar content style. Omit to follow the resolved theme background. | StatusBarStyle |
|
safeAreaTop |
When false, top inset is not applied (e.g. hero under the status bar). | boolean |
true |
safeAreaBottom |
When false, bottom inset is not applied. Use with {@link BaScroll } on native bottom tab screens so the scroll view owns the bottom inset (home indicator + overlaying tab bar). Context insets alone do not include liquid glass tab bars. |
boolean |
true |
testID |
Used to locate this view in end-to-end tests. | string |
|
accessibilityLabel |
Overrides the text that's read by the screen reader when the user interacts with the element. By default, the label is constructed by traversing all the children and accumulating all the Text nodes separated by space. |
string |
|
accessibilityHint |
An accessibility hint helps users understand what will happen when they perform an action on the accessibility element when that result is not obvious from the accessibility label. | string |
|
accessibilityState |
Accessibility State tells a person using either VoiceOver on iOS or TalkBack on Android the state of the element currently focused on. | AccessibilityState |
Parent components
Put BaScreen inside <BaModeProvider>. It reads its insets from SafeAreaProvider.
Put the page in <BaPageSegment>. When the page scrolls, put <BaScroll> between the screen and the segments.
Usage
BaScreen fills the screen. It paints the theme background, sets the status bar, and applies safe-area insets.
Omit theme to use the mode theme. Light mode is default. Dark mode is midnight-700. Pass theme to keep this screen on one palette. The safe-area gutters use that palette. With no BaModeProvider, an omitted theme is default.
A segment resolves its own theme. Pass the same theme on the segment when the band should match the screen. Children inside the segment read the segment theme.
Leave statusBarStyle unset. A light background uses dark-content. A dark background uses light-content. On Android the status bar background uses the screen colour. Pass statusBarStyle when the icons should differ from that, for example over a photo.
Top and bottom insets are on by default. Left and right insets are always applied. Set safeAreaTop={false} when a hero should run under the status bar. Set safeAreaBottom={false} on a screen under native bottom tabs, and let BaScroll own the bottom inset.
Follow the mode
Omit theme and statusBarStyle. The background and the status bar follow the mode.
<BaScreen>
<BaPageSegment>
<BaContent>
<BaText variant="header28">Hello</BaText>
</BaContent>
</BaPageSegment>
</BaScreen>
One palette
Pass theme on the screen and on the segment. The safe area and the band then share one palette. Leave statusBarStyle unset. A dark background such as midnight-700 uses light-content.
<BaScreen theme="midnight-700">
<BaPageSegment theme="midnight-700">
<BaContent>
<BaText variant="header28">Hello</BaText>
</BaContent>
</BaPageSegment>
</BaScreen>
Hero under the status bar
Set safeAreaTop={false}. The segment draws from the top of the screen, under the status bar.
<BaScreen safeAreaTop={false}>
<BaPageSegment fill>
<BaContent>
<BaText variant="header28">Hello</BaText>
</BaContent>
</BaPageSegment>
</BaScreen>
Native bottom tabs
On a screen under native bottom tabs, set safeAreaBottom={false}. Put BaScroll inside the screen so the scroll view keeps the bottom inset. The rest of that setup is on ba-scroll.
<BaScreen safeAreaBottom={false}>
<BaScroll>
<BaPageSegment>
<BaContent>
<BaText variant="body16">Tab content</BaText>
</BaContent>
</BaPageSegment>
</BaScroll>
</BaScreen>
Guidelines
BaScreen keeps the resolved theme background, and the status bar that follows it. Increase Contrast on iOS, and High contrast text on Android, do not swap that background for a system colour.
Greyscale and Invert colours are painted by the system over the whole screen.
Keyboard navigation
State: BaScreen is a non-interactive container
Focus moves through the controls on the screen