Skip to content

API Coverage

vitest-native's mock engine covers every stable React Native public export — 82/82 stable exports as of RN 0.84, with 7 unstable/experimental internals intentionally skipped (see Not covered). Parity isn't a one-time claim: a CI-gated check-compat script diffs the mock against real RN's export list 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

If your code imports any of these, provide a custom mock via the mocks option:

ts
reactNative({
  mocks: {
    unstable_NativeText: MyCustomMock,
  },
})

Released under the MIT License.