Hooks
Public ARCUI hooks for theme, animated theme progress, system values, localization, Modal state, and input extension semantics.
ARCUI exposes a deliberately small public hook surface. If a hook is not exported from the package root, treat it as an implementation detail.
useARCUITheme
Use useARCUITheme for static React render-time theme information:
import { useARCUITheme } from "react-native-arc-ui";
const {
theme,
themeMode,
tokens,
iconSet,
onBack,
} = useARCUITheme();It returns:
theme: resolved"light" | "dark";themeMode: provider ownership mode"system" | "light" | "dark";tokens: the provider-resolved token object;iconSet: the provider-resolved global icon registry;onBack: optional provider-level shared back callback.
With custom token namespaces, carry the same generic type used by the provider:
const { tokens } = useARCUITheme<AppTokens>();useARCUIAnimatedTheme
Use useARCUIAnimatedTheme when a custom visual needs ARCUI's continuous theme transition:
import { useARCUIAnimatedTheme } from "react-native-arc-ui";
const { themeProgress } = useARCUIAnimatedTheme();themeProgress is a Reanimated SharedValue:
0 -> dark
1 -> lightUse .value in worklets, animated hooks, effects, gestures, or lifecycle callbacks. Do not read or write SharedValue .value during ordinary React render.
useARCUISystem
import { useARCUISystem } from "react-native-arc-ui";
const { fontScale, safeAreaInsets } = useARCUISystem();fontScale is ARCUI's centralized Reanimated SharedValue for library-managed typography.
safeAreaInsets is the normalized runtime inset object supplied through the root provider:
{
top: number;
right: number;
bottom: number;
left: number;
}useARCUIStrings
import { useARCUIStrings } from "react-native-arc-ui";
const strings = useARCUIStrings();Returns the complete resolved ARCUI string set after provider overrides are applied.
useModal
import { useModal } from "react-native-arc-ui";
const { activeCount } = useModal();activeCount is the public semantic count of currently mounted ARCUI Modals.
Internal Host IDs, stack entries, and owner objects are intentionally not public.
useInputState
useInputState is a public extension hook for application-specific input-like controls that want ARCUI's render-time modifier semantics without cloning an ARCUI input component.
import { useInputState } from "react-native-arc-ui";
const {
isFocused,
modifier,
handleFocus,
handleBlur,
} = useInputState({
disabled,
active,
error,
forceFocused,
});Modifier priority is fixed:
disabled -> inactive -> error -> focused -> normalforceFocused affects modifier resolution; it does not create native focus.
This hook intentionally uses React state because its result is designed for render-time composition. ARCUI's internal animated field visuals may use SharedValues separately.
Choosing the right hook
| Need | Public hook |
|---|---|
| Resolved theme, mode, tokens, icons, shared back action | useARCUITheme |
| Continuous dark/light visual interpolation | useARCUIAnimatedTheme |
| Font scale or normalized runtime safe-area insets | useARCUISystem |
| Resolved ARCUI-owned strings | useARCUIStrings |
| Number of mounted ARCUI Modals | useModal |
| Modifier semantics for a custom input-like control | useInputState |
Do not use hooks to reach private overlay hosts or internal component animation state.