ptmt / react-native-macos

[deprecated in favor of https://microsoft.github.io/react-native-windows/] React Native for macOS is an experimental fork for writing desktop apps using Cocoa
MIT License
11.25k stars 429 forks source link

Merge 0.52.0 rnpm plugin #197

Closed Pagebakers closed 6 years ago

Pagebakers commented 6 years ago

Added RNPM plugin configuration.

Instead of running react-native-macos-cli you can now just run react-native-cli like:

react-native run-macos

This still needs adjustments .babelrc config and rn-cli-config to resolve the libraries correctly though. If somebody know hows to solve this using the plugin please let me know :)

ptmt commented 6 years ago

That's awesome!

Pagebakers commented 6 years ago

@ptmt

So the trick to run this as a plugin is to remove all duplicate js code and namespace all js files with specifics changes for macos with .macos.js

After that you can add this to your rn-cli.config.js and run multiple platforms without any hacks.

module.exports = {
  getProvidesModuleNodeModules: () => {
    return ['react-native', 'react-native-macos', 'react-native-windows']
  },
  getPlatforms: () => {
    return ['ios', 'android', 'macos', 'windows']
  },
};

I've got this partly working locally, but it needs quite a bit more work to make it releasable I'm afraid.

Once we get more help to keep this repo up to date and get all tests running we might be able to add 'react-native-macos' to the default settings in react-native, just like windows.