Skip to content

API Coverage ​

vitest-native's mock engine covers every stable React Native public export; the unstable and experimental internals listed under Not covered are intentionally skipped. Parity isn't a one-time claim: a CI-gated check-compat script resolves the exact installed RN package, diffs its runtime export list against the mock weekly, and opens a tracking issue on any gap. The native engine runs real React Native, so coverage there is simply all of RN.

Components (27) ​

View, Text, TextInput, Image, ScrollView, FlatList, SectionList, VirtualizedList, VirtualizedSectionList, Modal, Pressable, Touchable, TouchableOpacity, TouchableHighlight, TouchableWithoutFeedback, TouchableNativeFeedback, ActivityIndicator, Button, Switch, RefreshControl, StatusBar, SafeAreaView, KeyboardAvoidingView, ImageBackground, InputAccessoryView, DrawerLayoutAndroid, ProgressBarAndroid

Component instance methods are supported via refs: TextInput (focus, blur, clear, isFocused), ScrollView (scrollTo, scrollToEnd), FlatList (scrollToIndex, scrollToOffset, scrollToEnd, recordInteraction), SectionList (scrollToIndex, scrollToLocation, scrollToEnd, recordInteraction).

APIs (30) ​

Platform, StyleSheet, Dimensions, Animated, Alert, Linking, Keyboard, AppState, BackHandler, Vibration, PermissionsAndroid, Appearance, PixelRatio, LayoutAnimation, Share, AccessibilityInfo, InteractionManager, PanResponder, ToastAndroid, ActionSheetIOS, LogBox, Easing, I18nManager, DeviceEventEmitter, Clipboard, AppRegistry, Settings, DevSettings, Systrace, PushNotificationIOS

Animated ​

Full animation API including timing, spring, decay, sequence, parallel, stagger, loop, delay, event, and arithmetic operators (add, subtract, multiply, divide, modulo, diffClamp). Animated.View, Animated.Text, Animated.Image, Animated.ScrollView are real React components (not string literals) compatible with RNTL.

Hooks (3) ​

useColorScheme, useWindowDimensions, useAnimatedValue

Native internals (8) ​

NativeModules, TurboModuleRegistry, UIManager, NativeEventEmitter, NativeAppEventEmitter, NativeComponentRegistry, NativeDialogManagerAndroid, requireNativeComponent

Utilities (11) ​

processColor, findNodeHandle, PlatformColor, DynamicColorIOS, RootTagContext, ReactNativeVersion, UTFSequence, codegenNativeCommands, codegenNativeComponent, registerCallableModule, unstable_batchedUpdates

Not covered ​

The following unstable / experimental / private exports are intentionally not mocked. These are React Native internals not intended for use in application code:

ExportReason
DevMenuPrivate dev tooling, not used in production code
experimental_LayoutConformanceExperimental API, subject to change without notice
unstable_NativeTextInternal renderer primitive
unstable_NativeViewInternal renderer primitive
unstable_TextAncestorContextInternal context for Text nesting detection
unstable_VirtualViewPrivate experimental component
VirtualViewModePrivate experimental enum
unstable_DEFAULT_INITIAL_NUM_TO_RENDERExperimental virtualized-collection API (RN 0.86+)
unstable_VirtualArrayExperimental virtualized-collection API (RN 0.86+)
unstable_VirtualColumnExperimental virtualized-collection API (RN 0.86+)
unstable_VirtualColumnGeneratorExperimental virtualized-collection API (RN 0.86+)
unstable_VirtualRowExperimental virtualized-collection API (RN 0.86+)
unstable_createVirtualCollectionViewExperimental virtualized-collection API (RN 0.86+)
unstable_getScrollParentExperimental virtualized-collection API (RN 0.86+)

If your code imports any of these, provide one with vi.mock in a setup file:

ts
// vitest.setup.ts
vi.mock('react-native', async (importOriginal) => ({
  ...(await importOriginal<typeof import('react-native')>()),
  unstable_NativeText: MyCustomMock,
}))

Released under the MIT License.