Provider
Configure ARCUI theme mode, design tokens, strings, icons, safe area, back behavior, and shared runtime infrastructure.
ARCUI is the public root provider for the library runtime.
import { ARCUI } from "react-native-arc-ui";
export default function App() {
return <ARCUI>{/* application */}</ARCUI>;
}Most applications should mount one provider near the application root.
Theme mode
<ARCUI theme="system">{/* application */}</ARCUI>
<ARCUI theme="light">{/* application */}</ARCUI>
<ARCUI theme="dark">{/* application */}</ARCUI>system is the default. ARCUI resolves it to light or dark, then animates the shared theme progress when the system Reduced Motion preference allows it.
Static theme meaning and animated visual progress are deliberately separate public concepts.
Tokens are mount-time design-system configuration
import { ARCUI, defaultTokens, type TTokensOverride } from "react-native-arc-ui";
const tokens = {
spacing: {
...defaultTokens.spacing,
l: 24,
},
} satisfies TTokensOverride;
<ARCUI tokens={tokens}>{/* application */}</ARCUI>;Token configuration is resolved once per provider mount.
Overrides are shallow at the top level: providing spacing, typography, radius, or any other built-in namespace replaces that complete namespace. Compose nested changes explicitly with normal object spread.
Strings are runtime-reactive
Reusable ARCUI-owned behavior and accessibility strings are configured separately from design tokens:
<ARCUI
strings={{
headerBackAccessibilityLabel: "Back",
modalCloseAccessibilityLabel: "Close",
selectSearchPlaceholder: "Search",
}}
>
{/* application */}
</ARCUI>strings may update without remounting the provider.
Icon registry
iconSet configures the provider-wide icon registry used by Icon and ARCUI-owned icon consumers.
import { ARCUI, defaultIcons, type TIconSet } from "react-native-arc-ui";
const iconSet = {
...defaultIcons,
// application icons
} satisfies TIconSet;
<ARCUI iconSet={iconSet}>{/* application */}</ARCUI>;The registry is resolved once per provider mount.
ARCUI's required default icon names must still exist in the configured registry. Missing required icons are a configuration invariant and fail clearly rather than silently degrading.
Shared back behavior
Provide onBack when supported components such as Header should share an application-level back action:
<ARCUI onBack={() => navigation.goBack()}>
{/* application */}
</ARCUI>A component-level back callback remains the local override where the component contract exposes one.
Gesture Handler ownership
ARCUI wraps its subtree in GestureHandlerRootView by default:
<ARCUI gestureHandlerRootView>{/* application */}</ARCUI>If the application already owns a higher Gesture Handler root, disable ARCUI's wrapper:
<ARCUI gestureHandlerRootView={false}>{/* application */}</ARCUI>This is ownership configuration, not a performance switch.
Safe-area information
ARCUI accepts runtime device insets from the application:
<ARCUI
safeAreaInsets={{
top: insets.top,
right: insets.right,
bottom: insets.bottom,
left: insets.left,
}}
>
{/* application */}
</ARCUI>Missing edges default to 0; negative values are clamped to 0.
Safe-area-aware ARCUI components combine these runtime values with the policy in tokens.safeArea.
Provider-owned overlays
The root provider owns one predictable floating-UI hierarchy:
Application
-> Modal
-> Dropdown
-> Toast
-> Dialog backdrop
-> DialogDo not mount ARCUI's private overlay providers yourself.
Modal, Dropdown, and Dialog also manage accessibility isolation so background application content does not remain reachable as though it were active foreground UI.
Lifecycle summary
| Provider input | Lifecycle |
|---|---|
theme | Runtime-reactive. |
tokens | Resolved once per provider mount. |
strings | Runtime-reactive. |
iconSet | Resolved once per provider mount. |
onBack | Runtime-reactive through provider context. |
safeAreaInsets | Runtime-reactive and normalized per edge. |
gestureHandlerRootView | Structural provider ownership choice. |
Public props
| Prop | Type | Default | Purpose |
|---|---|---|---|
children | ReactNode | required | Application subtree. |
theme | "system" | "light" | "dark" | "system" | Theme ownership mode. |
tokens | TTokensOverride<TCustom> | defaults | Complete top-level token namespaces plus optional custom namespaces. |
strings | TARCUIStringsOverride | defaults | Partial runtime-reactive ARCUI-owned strings. |
iconSet | TIconSet | defaultIcons | Provider-wide icon registry. |
onBack | () => void | — | Shared back action used by supported controls. |
gestureHandlerRootView | boolean | true | Whether ARCUI owns GestureHandlerRootView. |
safeAreaInsets | Partial<TSafeAreaInsets> | all 0 | Runtime device insets supplied by the application. |