-
-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage with React Native Web? #290
Comments
I've been interested in using Jest Preview with React Native for some time now, and I've been exploring different ways to make it work. I did try using react-native-web, but I ran into some issues related to the I've been working on a solution that involves transforming React Native JSX into HTML. This would enable developers to visualize their components in Jest Preview more easily and would eliminate the need for the jsdom environment altogether. I'm still working on some of the details of this solution, but I believe it could be a valuable addition to the project |
I have an idea for how this transformation could be used in practice. I envision that the react-native-to-html package (WIP) could be integrated into the Jest Preview interface as a replacement for the current implementation of the preview function in With this implementation, the debug function in Jest Preview would accept a parameter that replaces the use of document.documentElement.outerHTML. For example, in a React Native project, developers could use the toJSON function from react-test-renderer to generate a JSON representation of a component, and then pass that JSON to the debug function to generate the corresponding HTML output. Here's an example of how this could work in practice: import { render } from '@testing-library/react-native';
import { toHtml } from 'react-native-to-html';
const { toJSON } = render(...);
const html = toHtml(toJSON());
preview.debug(html); |
Hi @vicky-carbon @antoniel. I am not familiar with Thanks. |
Yo @nvh95, I'll be happy to help creating the repo. I should be able to have it set up by tomorrow |
What is the framework/ technology you want to integrate Jest Preview to?
React Native Web.
Useful links
Styling
Do you want to add this example by your own?
I need help integrating jest-preview to my project that uses react-native-web and Next.js. I followed the example for Next.js with babel but the styles aren't working (RNW did not inject the CSS rules at runtime).
The text was updated successfully, but these errors were encountered: