quokka
quokka copied to clipboard
Feature Request: Support for react-native
Background
Quokka.js files run in node.js
after applying any configured TypeScript/Babel transformations.
When react-native
runs, it has access to device-specific APIs that are not natively available in the node.js runtime. As a result, react-native
applications cannot simply "run" in node.js, even after babel transforms have been applied. There are some libraries that enhance the node.js runtime so that react-native
applications can run. Two examples of such libraries are jest
(natively in the react-native library) and @necolas' react-native-web
package.
For example, when using jest
to run react-native
tests, jest
creates mock implementations for many of the runtime libraries in order to provide a environment that can run tests.
Implementation
Support for react-native
should be provided via an open-source npm package that uses Quokka's plugin API. Any required global variables or mocked functions/libraries should be overridden using either the before
or beforeEach
extension points.
The resulting .quokka
configuration for a react-native
application should ultimately look something like:
{
"plugins": ["quokka-react-native-plugin"],
"babel": {
"presets": ["module:metro-react-native-babel-preset"],
"ignore": "node_modules\\\\(?!(jest-)?react-native|@react-native-community)"
}
}
Aparently Quokka doesn't know what a View is. If it worked with React Native, you'd make me a customer. As it is, I don't know how I can use it in my workflow.
@charlestbell - you may be interested in reading about how Quokka works. It may help you understand where Quokka works best.
@smcenlly Hi Simon, Any update as to where react native support sits on the roadmap? Looks like an amazing tool, for which I purchased not realising it didn't support React Native.
We don't have any short term plans to enhance Quokka to support for react-native.