r/reactnative • • Oct 12 '18

News Trying out Microsoft's fork of React Native for macOS

https://twitter.com/LinguaBrowse/status/1050798787088723973
1 Upvotes

5 comments sorted by

2

u/Bamboo_the_plant Oct 12 '18

Up until now, I've been using ptmt's fork of React Native for macOS. It's the famous community-lead effort.

After I discovered in August that Microsoft have open-sourced their own implementation of the same thing, I decided to see how they compared, by installing it into my existing react-native-macos app.

Unfortunately, I was met with a wall of metro bundler errors. Name an error you've ever had with metro, and I probably faced it.

After speaking with Tom Underhill, who published the key commit for Microsoft's react-native-macos effort, it became clear that global dependencies were screwing up my environment. So I uninstalled Facebook's react-native-cli and ptmt's react-native-macos-cli. I also had to add the following code into the rn-cli.config.js of the react-native-macos project (which I'm a bit worried about, as Tom didn't need it – but anyway):

/* Prevents the node-haste DependencyGraph error:
 *   "bundling failed: Error: Unrecognized platform: macos" */
getPlatforms(){
    return ["ios", "android", "macos"];
},

I was thus able to get the RNTester app to run in a bare clone of react-native-macos.

My next challenge will be to integrate it into my existing React Native macOS app, LinguaBrowse (which has made it to the App Store and is even doing quite well!).

The exciting difference of this fork is that it makes deploying to iOS possible. In ptmt's fork, iOS is wholly replaced by macOS, and so it would require some real expertise (and I suspect it would be very messy) to get both to build. Though it is admittedly possible, and people have tried it from time-to-time.

So why wait for Marzipan? macOS is here for RN now! :)

2

u/too_much_exceptions Oct 12 '18

Hi, Can you explain what this fork offers ?

Is is somehow related to ReactXP ?

1

u/Bamboo_the_plant Oct 12 '18

It allows you to deploy to macOS (as well as the usual iOS, tvOS and Android)! I surmise that the Microsoft Office team are using it.

ReactXP doesn’t target desktop as far as I know (although they’ve made the folder structure to allow a macOS target to be implemented in future); they recommend Electron for those purposes for now.

1

u/S_Y_N_T_A_X Mar 10 '19

ReactXP does target Windows (W10, Xbox One, Mixed Reality) natively.For earlier versions of Windows, and Linux you need Electron.Native MacOS support is experimental.