React Native

Experimental

React Native is not officially supported at this stage. Preview.js will only work for a subset of components.

Requirement: Preview.js v1.8.0 (VS Code / IntelliJ) or @previewjs/cli v1.2.0

You can preview React Native components, as long as they don't depend on expo packages. For example, if your component depends directly or indirectly on expo-web-browser, it will fail to preview.

This means that your root App component is unlikely to work with Preview.js.

Testing your components with dark theme

In order to force your components to be rendered with the dark color theme, insert the following code in your Wrapper file.

// __previewjs__/Wrapper.tsx

import { Appearance } from "react-native";

Appearance.getColorScheme = () => "dark";
Request for contributions

If you're familiar with Vite and find out how to make your React Native Web app with Expo compile, feel free to open an issue sharing your sample repo!

See https://github.com/vitejs/vite/issues/3195 for more context on the issue.