Runtime Library
Runtime exports used by the Babel plugin and advanced integrations.
react-native-boost/runtime is used by the Babel plugin to apply optimizations safely across platforms.
Besides re-exporting optimized native components with web-safe fallbacks, it also exposes helper utilities.
Direct usage is supported but generally not recommended unless needed for advanced integrations (for example, Nativewind setup).
API Reference
This section is automatically generated from runtime exports.
Functions
processTextStyle
Normalizes Text style values for NativeText.
- Type:
(style: GenericStyleProp<TextStyle>) => Partial<TextProps>
Parameters
style:GenericStyleProp<TextStyle>- Style prop passed to a text-like component.
Returns
Partial<TextProps>: Native-friendly text props. Returns an empty object when style is falsy or cannot be normalized.
Notes
- Flattens style arrays via StyleSheet.flatten
- Converts numeric fontWeight values to string values
- Maps userSelect and verticalAlign to native-compatible props
processSelectionColor
Mirrors the selectionColor normalization Text performs before handing off to its native host: selectionColor != null ? processColor(selectionColor) : undefined (Text.js). Returns a spreadable prop bag so the plugin can inline it at the JSX call site like {@link processTextStyle}.
- Type:
(selectionColor: number | ColorValue | null | undefined) => { selectionColor?: ColorValue | ProcessedColorValue | null; }
Parameters
selectionColor:number | ColorValue | null | undefined- The rawselectionColorprop (CSS color string, int, orPlatformColor).
Returns
{ selectionColor?: ColorValue | ProcessedColorValue | null; }: { selectionColor } with the processed value, or an empty object when nothing should be
emitted: a null/undefined input collapses to {}, and a value processColor rejects (returns
undefined, e.g. an unparseable color string) is likewise omitted, mirroring Text's
if (_selectionColor !== undefined) guard. A null from processColor (a rejected PlatformColor)
is preserved, since Text forwards that.
Notes
No caching: keys are commonly primitives ('red', 0xff0000ff) that a WeakMap rejects, and
processColor is already cheap. When processColor is unavailable (a non-RN host) the raw value is
passed through rather than dropped, the least-surprising degradation.
processAccessibilityProps
Normalizes accessibility and ARIA props for runtime native components, mirroring the reconciliation Text performs before handing off to its native host.
- Type:
(props: Record<string, any>) => Record<string, any>
Parameters
props:Record<string, any>- Accessibility and ARIA props.
Returns
Record<string, any>: Props with normalized accessibility fields.
Notes
- Merges aria-label with accessibilityLabel
* - Merges ARIA state fields into accessibilityState
* - Reconciles disabled with accessibilityState.disabled (the explicit disabled prop wins)
* - Translates aria-hidden into accessibilityElementsHidden / importantForAccessibility (see
* {@link applyAriaHidden}); aria-hidden wins over an explicitly-passed value
* - Resolves the platform-specific accessible default (see {@link getDefaultTextAccessible})
processViewAccessibilityProps
Normalizes accessibility and ARIA props for an optimized NativeView, mirroring the reconciliation the View wrapper performs before handing off to its native host.
- Type:
(props: Record<string, any>) => Record<string, any>
Parameters
props:Record<string, any>- Accessibility and ARIA props.
Returns
Record<string, any>: Props with the ARIA cluster translated/aggregated into their native counterparts.
Notes
Unlike {@link processAccessibilityProps}(the Text helper) there is no accessible default and no
* disabled reconciliation — the View wrapper does neither. A static tabIndex is folded to
* focusable at build time; only a dynamic tabIndex reaches this helper.
* - aria-labelledby → accessibilityLabelledBy (comma-split into a string array)
* - aria-label → accessibilityLabel
* - aria-live → accessibilityLiveRegion ('off' → 'none')
* - aria-hidden → accessibilityElementsHidden (+ importantForAccessibility when strictly true)
* - tabIndex → focusable (!tabIndex)
* - ARIA state fields aggregated into accessibilityState (ariaX ?? accessibilityState?.x)
* - ARIA value fields aggregated into accessibilityValue (ariaX ?? accessibilityValue?.x)
Components
NativeText
Native Text component with graceful fallback.
- Type:
ComponentType<TextProps>
Notes
Uses unstable_NativeText on supported native runtimes and falls back to Text
on web or when the unstable export is unavailable.
NativeView
Native View component with graceful fallback.
- Type:
ComponentType<ViewProps>
Notes
Uses unstable_NativeView on supported native runtimes and falls back to View
on web or when the unstable export is unavailable.
Constants
getDefaultTextAccessible
The default value Text resolves for accessible when the prop is omitted: true on iOS (text is an accessibility element unless opted out), false on Android, and undefined elsewhere.
- Type:
() => boolean | undefined
Notes
Runtime fallback for the common optimized <Text> path (no accessibility props) when the target
platform is unknown at build time. When it is known (Metro reports it on the Babel caller), the
plugin inlines the literal instead and this is not emitted. Evaluated per render — like Text's own
Platform.select — rather than hoisted to a constant, so it always reflects the current platform.
userSelectToSelectableMap
Maps CSS-like userSelect values to React Native's selectable prop.
- Type:
{ auto: boolean; text: boolean; none: boolean; contain: boolean; all: boolean; }
verticalAlignToTextAlignVerticalMap
Maps CSS-like verticalAlign values to React Native's textAlignVertical.
- Type:
{ auto: string; top: string; bottom: string; middle: string; }
clampNumberOfLines
Clamps a numberOfLines value exactly as Text does at runtime: a negative number (or NaN) becomes 0, while null/undefined pass through untouched (!(value >= 0) is true for negatives and NaN, false otherwise). The plugin emits this only around a non-literal numberOfLines; literal negatives are clamped at build time, so it never runs for them.
- Type:
(value: number | null | undefined) => number | null | undefined
Types
GenericStyleProp
Recursive style prop shape accepted by runtime style helpers.
- Type:
null | void | T | false | '' | ReadonlyArray<GenericStyleProp<T>>
Additional Tags
- @template: - Style object type.