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 #185

Closed ptmt closed 6 years ago

ptmt commented 6 years ago

Work in progress.

Pagebakers commented 6 years ago

Thanks for doing this!

What's the status of the merge, do you need any help?

ptmt commented 6 years ago

Thanks. In fact, it's a shame that it gets me so long.

I think 70% is done, now everything compiles, I need to upgrade some .js to adopt new RNTester approach and then there will be a testing stage. I'll ping here when you can play with it.

ptmt commented 6 years ago

80-85% is done, now it's using new RNTesterApp. Working through examples, checking some basic ones. Also, we'll need to recover Developer Menu, it's gone for some reason.

ptmt commented 6 years ago

90% done, some important but problematic examples left: TextInput, LayoutEvents, ART. Also a few regressions: TouchableHighlight, for example. Some things work surprisingly well. The plan is fixing these and move to -alpha npm release to test on a real-world app that I'm working on. Then fix tests and set up CircleCI workflow, but I expect that won't be easy.

Pagebakers commented 6 years ago

Awesome work man, let me know when I can run the alpha.

beretboat commented 6 years ago

Great work!

ptmt commented 6 years ago

If someone is willing to help with this PR, it will be highly appreciated. I know that it's probably not the most exciting project and this approach is going to change, but highly unlikely before WWDC. So would be nice to release this version (with the later lightweight separate update for React 16.3).

  1. TextInput controls always have been long behind RN, but now they practically unusable. I left the legacy implementation instead of the new one from RN, with an abstracted component for both SingleLine and MultiLine controls. As a result, it doesn't work well. This needs refactoring, and if someone willing to try this, and rewrite UIKit implementation with AppKit one - welcome.

  2. Travis setup and fix a bunch of tests that are failing. I did this numerous times, just can't focus enough on this routine. Also, turns out that Circle is not free, so probably will need to get back to Travis. There is one difficult task though: setting up snapshot tests (basically, comparing two images). Let me know if you could help with this, I"ll give you all permissions.

That being said, I decided to get extra motivation and push it to npm, to use all new React features right now. I published it as 0.16.0-alpha.

Pagebakers commented 6 years ago

This is great, thank a bunch! I'm going to upgrade my project later this week and look into fixing 1 if I find the time.

Pagebakers commented 6 years ago

@ptmt I installed it but somehow i seem to miss most of the scripts in react-native-macos/scripts so it won't run :(

So I installed from git. Then references to ios-install-third-party.sh instead of macos-install-third-party.sh are still in React.xcodeproj

And after changes this i get the following error in mutex.h:

include "config.h" config.h file not found

Unfortunately don't have more time to dive into it now

Pagebakers commented 6 years ago

Managed to get it running with changes in #191

However the metro bundler has issues, hopefully you can shed some light on this.

error: bundling failed: Error: Unable to resolve module `AccessibilityInfo` from `/Users/eelco/Sites/vpnapp/node_modules/react-native-macos/Libraries/react-native/react-native-implementation.js`: Module does not exist in the module map

This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
  1. Clear watchman watches: `watchman watch-del-all`.
  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
  3. Reset Metro Bundler cache: `rm -rf $TMPDIR/react-*` or `npm start -- --reset-cache`.  4. Remove haste cache: `rm -rf $TMPDIR/haste-map-react-native-packager-*`.
    at UnableToResolveError (/Users/eelco/Sites/vpnapp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:772:5)
    at ModuleResolver.resolveDependency (/Users/eelco/Sites/vpnapp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:311:1719)
    at ResolutionRequest.resolveDependency (/Users/eelco/Sites/vpnapp/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:96:16)
    at DependencyGraph.resolveDependency (/Users/eelco/Sites/vpnapp/node_modules/metro/src/node-haste/DependencyGraph.js:269:4352)
    at /Users/eelco/Sites/vpnapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:201:36
    at next (native)
    at step (/Users/eelco/Sites/vpnapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:306)
    at /Users/eelco/Sites/vpnapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:536
    at /Users/eelco/Sites/vpnapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:217
    at addDependency (/Users/eelco/Sites/vpnapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:92)
    at /Users/eelco/Sites/vpnapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:237:9
ptmt commented 6 years ago

Thanks to @Pagebakers, I fixed that issue for projects created with init command. Check react-native-macos@0.18.0-alpha.2. Be sure you have https://github.com/ptmt/react-native-macos/pull/185/commits/96dc15e18930a82c4b78f3f01967781b0d2bbf06#diff-9483f625c762d10b2f8d7c8c76d1cc1a file now in your local project, it should appear on all fresh projects.

Going to continue test this fork on my side project. Sorry guys, I know it's a pity and soon might be outdated due to availability of other frameworks, but I think we should finish this version at least.

Pagebakers commented 6 years ago

Awesome man! updating and adding "babel-plugin-module-resolver": "^3.1.1", to my project fixed the issues.

avdept commented 6 years ago

Any plans on merging this to master?

Pagebakers commented 6 years ago

@ptmt Did you get ART working on MacOS before?~

See #198

ptmt commented 6 years ago

Yes, I had a few examples somewhere. Let me take a look on your PRs tomorrow.

On Fri, 1 Jun 2018 at 16:52, Eelco Wiersma notifications@github.com wrote:

@ptmt https://github.com/ptmt Did you get ART working on MacOS before?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ptmt/react-native-macos/pull/185#issuecomment-393887223, or mute the thread https://github.com/notifications/unsubscribe-auth/AA9SUwlUhJAm2L44yqg0Si1g1jqQwDc9ks5t4UclgaJpZM4RvqCV .

ptmt commented 6 years ago

@Pagebakers this is a proof of worked ReactART example, just in case https://twitter.com/potomushto/status/770346194778415104

Thanks for PR, by the way, I added you as a collaborator, in case you want to make another PRs.

ptmt commented 6 years ago

This will live in master and publised as alpha (you can always check npm show react-native-macos versions latest version). I also removed CircleCI. Too expensive to pay for macOS plan. Going back to Travis