JSX integration#170
Open
rams23 wants to merge 2 commits into
Open
Conversation
Contributor
|
Hi @rams23! Just a quick update for you. We're keeping this around because we really like the idea, and someone might want to use it before it gets merged. But right now, we're not sure where this fits on the Cavy roadmap. We're currently working through other bugs and issues, and if we get time we'll come back to this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As for #169 here is my implementation of
React.createElementwrapper that integrates cavy at jsx level.It adds a
cavyCreateElemementfunction that is a replacement forReact.createElement, auto wraps function component and add component refs intotestHookStore.The
testHookStoremust be set at startup in the index.test.js together with acavyIdPropNamethat let you configure how cavy takes identifier from props.It uses @wordpress/babel-plugin-import-jsx-pragma and @babel/plugin-transform-react-jsx to globally replace JSX transpilaton.
I'm experiencing some problem with the metro bundler so I have created a repo to show it react-native-custom-jsx. If you look at build/index.metro.js you can see that there are some
that should not be there, while somewhere else the code is transpiled correctly to
The import cause rn to crash at startup.
I'm investigating, I don't know if someone in the cavy team with a better knowledge of babel/metro can help me.
Thank you for your great job, I'm waiting for your comments and ready to answer your questions.
I'll eventually update docs and types if the feature will be merged.