quokka icon indicating copy to clipboard operation
quokka copied to clipboard

Feature Request: Support for react-native

Open smcenlly opened this issue 5 years ago • 4 comments

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)"
 }
}

smcenlly avatar Oct 28 '19 02:10 smcenlly

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. ● CartItem js - Shop App - Visual Studio Code 8_26_2021 5_11_29 PM

charlestbell avatar Aug 26 '21 21:08 charlestbell

@charlestbell - you may be interested in reading about how Quokka works. It may help you understand where Quokka works best.

smcenlly avatar Aug 27 '21 00:08 smcenlly

@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.

carbopilot avatar Apr 09 '23 14:04 carbopilot

We don't have any short term plans to enhance Quokka to support for react-native.

smcenlly avatar Apr 10 '23 00:04 smcenlly