-
Notifications
You must be signed in to change notification settings - Fork 128
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Project Catalyst (running iPad apps on macOS) #131
Comments
|
Didn't they also announce iPadOS? How does this affect react-native now that iOS and IPadOS might be two separate targets |
Ok, so let's keep the discussion here, it fits better the format. Few points (which ofc take with a pinch of salt):
|
I mean.. there is no Facebook.app for the mac right?? And it would be nice to reuse the iOS code, right? wink wink? :p |
That it can work I and some more people demonstrated but took some adjustments in the core of React Native; mostly deprecated API's because you must target the latest iOS/Mac. Planned to make a POC in the coming weeks with 0.60 to see what is working and needed change |
Ya I'm looking for docs and experience on this. How automatic is such "porting" from iPad to Mac? Relevant, important links while I was researching this:
I disagree about treating ipadOS support in RN like tvOS. The latter is very different, while ipadOS is for all intents and purposes of app makers, the same as iOS 13. Dimensions window support for Split View and Slide Over on iPad in #16152 link above means afaik, I got what I need to fully convert my iPhone RN app to support the iPad's screen. Add splitView so my 1 column iPhone layout become 2 columns, then it should be ready for the new Catalyst conversion for macOS. Apple's new HIG docs for iPad apps on Mac says explicitly that splitView on iPad will get automatic conversion to equivalent on macOS. So this is my own plan for bringing my iPhone app (WonderSwipe) to iPad and Mac. Am I missing anything that needs RN core support to make happen, or am I right that all the pieces are already in place as I've outlined above? RNN provides the splitView, while Xcode 11 provides not just iPad layout but also a new Mac option you simply turn on. Will share hiccups I get along the way. Anyone else thinking/planning something similar, on iPad/Mac adaptations of your RN apps? What else do you see missing inside RN that's needed for these adaptations? |
I strongly disagree. tvOS is treated by Apple as a separate OS, with most things in common with iOS and UIKit, but a separate target nonetheless. iPadOS is only a marketing term. It's not really a separate OS, from a technical standpoint. UIKit for Mac / Marzipan / Catalyst is a weird beast, but the way Apple treats it, Mac is only a separate device target for the iOS app. It's not listed as a separate OS in code (all platform checks reference iOS, not macOS), and you're not really supposed to create a separate Xcode target for Catalyst apps (the way you are for tvOS or watchOS -- or truly native/AppKit Mac apps), just check the checkbox, add necessary configuration for macOS, and if necessary -- add extra Therefore, the core of RN for Catalyst apps should remain the same, and in the same repo. A react-native-community repo(s) might (and should) spring up for enhancing Catalyst apps (supporting extra features only available for the Mac). |
👋 Radek - yeah, again, my was literally just a feeling because I wasn't really able to understand what iPad OS really was back then. Upon further investigation, and your comment, I can rollback that 100%, yeah it's basically still iOS13 from our perspective 🤗 |
Heads up: I began initial for for supporting Catalyst in React Native. More work needs to be done to polish everything to look good, but in general it was an hour or two of work to get it to compile properly: |
Summary: This PR adds initial support for Project Catalyst a.k.a. UIKitForMac. This is not yet meant for production, but this is enough for RNTester to successfully compile and mostly work :) Some APIs are not supported on the Mac -- e.g. telephony, and deprecated APIs are removed on Mac ���-- those had to be ifdef'd out via platform checks. The biggest limitation right now is that I couldn't get Web Socket code to successfully compile, and so there are a lot of temporary platform checks for that , and the RCTWebSocket.xcodeproj is marked as not supporting UIKitForMac. Again -- temporary, until someone with more knowledge knows how to fix this. react-native-community/discussions-and-proposals#131 ## Changelog [iOS] [Added] - Fixed compilation for macOS (Project Catalyst) -- not meant for production use yet Pull Request resolved: #25427 Test Plan: - Open RNTester/RNTester.xcodeproj with Xcode 10.2, run it like a normal iOS app -- make sure it compiles and runs correctly (no regression) - Open the same project with Xcode 11 beta 2 (or higher) on macOS Catalina beta, select "My Mac" as device target, and run -- see that it actually compiles and runs. **Note** there are unfortunately some required steps: - change build configuration to Release (because packager doesn't work correctly yet) - change development team to yours if Xcode tells you to - go to RNTester project → Build phases → Link binary with libraries, and change `platforms` for `libRCTWebSocket.a` to `iOS` (without Mac compatibility). I can't commit that change because it breaks compatibility with earlier Xcode versions The two extra steps for successful compile will disappear once web socket compilation for Catalyst is fixed Reviewed By: mmmulani Differential Revision: D16088263 Pulled By: sammy-SC fbshipit-source-id: 9c0b932b048e50a8e0f336eaa0612851b1909cae
@radex will your commit make it to rn 61? do you think real world projects will build successfully for mac? |
@brunolemos I think it will make it to RN 61, but it's only the first step -- web socket doesn't work which is annoying for development, the layout and fonts are all broken… You should help out and contribute too :) |
Any news about this? Catalina is going to be released this month, will it bring anything useful in scope of this topic? |
Tried to build for mac (react-native 0.61.2). Had build errors related to firebase (invertase/react-native-firebase#2698, firebase/firebase-ios-sdk#3144). Then I removed firebase. Got this error:
Removed the websocket pod but no change. How to pass through this error? |
facebook/react-native#25427 did most of the work for apps not using RCTWebSocket, but more help are still needed for other apps like mine. 😔 |
@brunolemos RCTWebSocket didn't compile for Catalyst, so I ifdef'ed it out of React Native build. If you manage to get to compile, send a PR to react-native repo |
@radex can you share more how you managed to do it? |
Which just landed in RN 0.61.2 |
@fungilation cool, is there any information about it somewhere? |
@radex i tried to run my application with react-native 0.61.2. but i still get the error described by @brunolemos
I did the steps you mentioned in the Pull Request. Can this be the problem? |
With my app, while I can build on RN 0.61.2 with the new
|
@fungilation New projects have a huge Podfile referencing a lot of modules, like I don't think the build is working for people using the new setup.
You have Firebase running, but the Firebase sdk doesn't support targeting mac yet. They are working on it. (invertase/react-native-firebase#2698, firebase/firebase-ios-sdk#3144) |
@kaiyes I was having the same issue and eventually I got the app running by selecting the Hope it helps! |
@ruimagalhaes thanks, that make the build work! But the app only runs on Release mode, right? On Development mode I get this: |
Oh my god, it works! Even the swipe gestures using Here's DevHub running as a native macOS app: Tweeted a more complete video here: twitter.com/brunolemos/status/1185636022346043392 |
@brunolemos Correct, since development connects to the packager via a websocket (to enable hot reloading), and websockets don't work yet, you need to build in Release mode for Mac. To reiterate, to get your app working:
|
Thanks a lot @petrbela & @ruimagalhaes . It worked 😄 A vanilla fresh React-native init project on 61.2, macOs - catalina and xcode 11 |
What needs to be done till web sockets will work in debug scheme on Mac Catalina? |
Thats a good question. My app builds now, but at some point something fails in the js code and i don't know how to debug it in the release version. |
In Clojurescript, I was able to work around this issue by implementing my own custom WebSockets module in Swift, I documented the process here Some of the code above might be of use for JS people, however, I suspect React Native core requires the WebSocket module before you could overload/shim it... |
Introducing keyboard shortcuts to show up the dev menu here: facebook/react-native#27479. |
Anyone has made it work with the latests |
@mgcrea, for now, you can just disable Flipper since it seems to be the cause of the error. You can comment out the lines that mention flipper in the |
Quick question, how to run with Mac target from console, is there an analog for |
@kirill-konshin |
@Naturalclar I just tried |
I think they haven’t released a new version containing this commit. I’m not one of the maintainers so I don’t know when they will release it either. You can use something like patch-package to manually apply the commit diff as a workaround. |
Seems that macos support not planned in nearest future. |
Microsoft is hard at work building out the react-native-macos platform, which in my opinion is a far better solution than relying on Project Catalyst. Just recently they merged this PR: microsoft/react-native-macos#291 |
That's just amazing! Agree that project Catalyst has many shortcomings, eg. any macOS specific API is unavailable like handling file drops, using system menu, etc. that makes it currently a pretty poor option to build real applications. |
@kevinvangelder I've created react-native(*) native module using $ create-react-native-module MyNativeModule --generate-example and build&run it on MacOS. So in theory I can implement in that module all that I can do in ordinary Objective-C application and connect it to react-native ui. Or I wrong?
|
@Andreychikov-Vasiliy Yes, in theory you should be able to write a Swift/Obj-C module using macOS APIs. You may run into shortcomings working with the react-native-macos bridge implementation (I don't know how complete it is in it's current state), but if you have issues now I would expect that they'll be resolved in the near future as Microsoft is putting a lot of time and effort into this. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Apple has just announced Project Catalyst on WWDC 2019, which allows iOS/iPad apps to run on macOS without modification. This is AWESOME.
We'd love if React Native could build and work correctly on macOS. That should be a supported scenario.
Beta is already available today for developers to test.
EDIT: Stable version of macOS Catalina is already available.
https://techcrunch.com/2019/06/03/ios-apps-will-run-on-macos-with-project-catalyst/
The text was updated successfully, but these errors were encountered: