Skip to content
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

React Native Compatibility #713

Closed
wants to merge 3 commits into from
Closed

React Native Compatibility #713

wants to merge 3 commits into from

Conversation

skevy
Copy link
Contributor

@skevy skevy commented Jan 3, 2016

This PR depends on an unreleased version of fbjs, so DO NOT MERGE.

When merged along with facebook/react-native#5084, facebook/fbjs#95, and whatever PR fixes facebook/react-native#4062 (which I will update this issue with when I push it), this fixes #26.

The changes to Relay itself are super minor here:

  1. Remove the reliance on ReactDOM. The only use of ReactDOM is unstable_batchedupdates. So to fix, I abstracted the reference to unstable_batchedupdates to it's own module, and then took advantage of the "react-native" package.json option, supported by the React Native packager, to load the correct version of this function given the execution context.
  2. Removed react-dom from peerDependencies (but kept it in devDependencies, for use in tests), and also upgrade the fbjs dependency to a (yet unreleased) version that provides better compatibility with React Native.

@josephsavona
Copy link
Contributor

Awesome, thanks for working on this!

@KyleAMathews
Copy link
Contributor

💯

@chandu0101
Copy link
Contributor

👍 👏

@@ -0,0 +1,19 @@

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this file be named RelayUnstableBatchedUpdates.native.js?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed it can, and we can get rid of what's in package.json...because the RN packager looks for the native extension. Though @spicyj has mentioned that he'd like to remove that eventually. I suppose if he does, we can just put back the package.json directive.

@yungsters
Copy link
Contributor

This is great — thanks for tackling it. And great write ups, too.

@taion
Copy link
Contributor

taion commented Jan 18, 2016

Do you suppose there's any chance to pull this unstable_batchedUpdates support into a separate package? I'd find this useful outside of just the Relay context.

@josephsavona
Copy link
Contributor

@skevy this is now blocked only on facebook/react-native#5084, right?

@skevy
Copy link
Contributor Author

skevy commented Jan 25, 2016

@josephsavona yah. Hopefully being merged soon! :)

@skevy
Copy link
Contributor Author

skevy commented Jan 27, 2016

Fyi @josephsavona, fbjs 0.7.0 is now released, so presuming you don't have any changes on this PR, it can be merged :)

@skevy
Copy link
Contributor Author

skevy commented Jan 27, 2016

Would also be cool if you could release relay@0.6.2 -- nothing in here is breaking, so it should keep in line with semver.

@josephsavona
Copy link
Contributor

@facebook-github-bot import

@@ -85,6 +85,7 @@
"<rootDir>/src/"
],
"unmockedModulePathPatterns": [
"<rootDir>/src/tools/RelayUnstableBatchedUpdates.js",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm assuming a manual mock with module.exports = require.requireActual('...') won't work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I'm not sure how to do that :( Sorry...not a Jest expert. If you point me in the right direction, happy to make the change...otherwise I defer to your decision on that.

Based on my limited knowledge of requireActual...it seems like it would work fine. But I'm not 100% certain.

@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/1014651835240270/int_phab to review.

@ghost ghost closed this in 60c8a76 Jan 28, 2016
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants