/** * useForgeBottomTabScreenOptions * * Returns a `screenOptions` object for **React Navigation bottom tab navigators** * (`@react-navigation/bottom-tabs` v7+), populated with CDX UI design-system * token values. * * CDX UI does not import `@react-navigation` — the consumer passes the returned * object to their own navigator. This keeps the dependency out of * `@cdx-ui/components` and works with any React Navigation tab variant: * `createNativeBottomTabNavigator` (iOS/Android) or `createBottomTabNavigator` * (web/JS). * * **Not compatible with:** * - Expo Router `` — uses different prop names * - React Router or DOM tab components — these are not React Navigation * * ## Basic usage * * ```tsx * import { useForgeBottomTabScreenOptions } from '@cdx-ui/components'; * import { createNativeBottomTabNavigator } from '@react-navigation/bottom-tabs/unstable'; * * const Tab = createNativeBottomTabNavigator(); * * function AppTabs() { * const screenOptions = useForgeBottomTabScreenOptions(); * return ( * * * * ); * } * ``` * * ## Overriding individual tokens * * Spread the returned object and override only the keys you need. * Nested style objects (`tabBarLabelStyle`, `tabBarStyle`, `tabBarBadgeStyle`) * must be spread individually to preserve unrelated DS defaults: * * ```tsx * const dsOptions = useForgeBottomTabScreenOptions(); * const screenOptions = { * ...dsOptions, * tabBarActiveTintColor: '#custom', * tabBarLabelStyle: { ...dsOptions.tabBarLabelStyle, fontFamily: 'MyFont' }, * }; * ``` * * ## Token variable names * * | screenOption | CSS variable | * | ---------------------------------- | ---------------------------------- | * | tabBarActiveTintColor | --color-content-action | * | tabBarInactiveTintColor | --color-content-secondary | * | tabBarStyle.backgroundColor | --color-surface-primary | * | tabBarLabelStyle.fontFamily | --font-body | * | tabBarLabelStyle.fontSize | --text-xs (via `text-xs` class) | * | tabBarLabelStyle.fontWeight | --font-weight-medium | * | tabBarBadgeStyle.backgroundColor | --color-surface-danger-strong | * * ## Platform notes * * - `tabBarInactiveTintColor` has no effect on iOS — inactive items always use * system grey. * - `tabBarStyle.backgroundColor` is ignored on iOS 26+ (liquid glass takes * over). It is honoured on iOS ≤18 and all Android versions. * - The hook resolves CSS variables via Uniwind's `useCSSVariable`. If the * Uniwind runtime is not set up (e.g. in a plain Jest test without a CSS * context), each variable resolves to `undefined` and the hardcoded fallback * is used instead — fallbacks intentionally match the CDX UI light-theme * values. * - `tabBarLabelStyle.fontSize` is resolved via Uniwind's * `useResolveClassNames('text-xs')` rather than reading the rem-valued * `--text-xs` variable directly. React Navigation v7 requires a numeric * `fontSize`, and letting Uniwind resolve the class means the rem→px * conversion uses the consumer's configured rem base (default 16px, * overridable via the `polyfills.rem` Metro option) instead of a constant * hardcoded here. */ import type { TextStyle } from 'react-native'; /** * The `screenOptions` shape returned by `useForgeBottomTabScreenOptions`. * * These are concrete types (not the broad `StyleProp<…>` React Navigation * uses internally) so consumers get precise IDE completion. The compile-time * drift guard below ensures this type stays assignable to * `BottomTabNavigationOptions` — the TypeScript compiler will error if CDX UI * adds a key or value that React Navigation no longer accepts. * * Pass directly as `screenOptions` on a `createNativeBottomTabNavigator` or * `createBottomTabNavigator` navigator, or spread and override individual keys. */ export interface ForgeReactNavigationBottomTabScreenOptions { tabBarActiveTintColor: string; tabBarInactiveTintColor: string; tabBarStyle: { backgroundColor: string; }; tabBarLabelStyle: { fontFamily: string; /** Pixel size — React Navigation requires a number for tab label fontSize. */ fontSize: number; fontWeight: TextStyle['fontWeight']; }; tabBarBadgeStyle: { backgroundColor: string; }; } /** * Returns a `screenOptions` object for **React Navigation bottom tab * navigators** (`@react-navigation/bottom-tabs` v7+), populated with CDX UI * design-system token values. * * Must be called inside a React component or custom hook (React hook rules * apply). */ /** * Deep-merges consumer overrides into a base `ForgeReactNavigationBottomTabScreenOptions` * object. Nested style objects (`tabBarLabelStyle`, `tabBarStyle`, * `tabBarBadgeStyle`) are merged property-by-property so consumers can override * individual style properties without losing unrelated DS defaults. * * Use with `useForgeBottomTabScreenOptions` to apply targeted overrides: * * ```tsx * const dsOptions = useForgeBottomTabScreenOptions(); * const screenOptions = mergeForgeBottomTabScreenOptions(dsOptions, { * tabBarActiveTintColor: '#custom', * tabBarLabelStyle: { fontFamily: 'MyFont' }, // fontSize + fontWeight preserved * }); * ``` */ export declare function mergeForgeBottomTabScreenOptions(base: ForgeReactNavigationBottomTabScreenOptions, overrides: Partial): ForgeReactNavigationBottomTabScreenOptions; export declare function useForgeBottomTabScreenOptions(): ForgeReactNavigationBottomTabScreenOptions; //# sourceMappingURL=useForgeBottomTabScreenOptions.d.ts.map