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

Upgrade RN 0.40 Finalization #678

Merged
merged 3 commits into from
Jan 24, 2017
Merged

Upgrade RN 0.40 Finalization #678

merged 3 commits into from
Jan 24, 2017

Conversation

buptkang
Copy link
Contributor

This PR finalizes the upgrade toward RN 0.40, which relates to previous PRs: #638, #665 and #670.

Copy link
Contributor

@richardhuaaa richardhuaaa left a comment

Choose a reason for hiding this comment

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

Looks good, well done @buptkang! Just left minor comments about changing the ordering of import statements, once you've done that feel free to squash and merge at your convenience.

@@ -1,4 +1,6 @@
#if __has_include("RCTEventEmitter.h")
#import "RCTEventEmitter.h"
#elif __has_include(<React/RCTEventEmitter.h>)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we swap this with the statement above?

@@ -1,5 +1,10 @@
#import "CodePush.h"

#if __has_include("RCTConvert.h")
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, please swap the ordering so that <> is the default

Copy link
Contributor

@richardhuaaa richardhuaaa Jan 24, 2017

Choose a reason for hiding this comment

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

(and below in the other file)

Choose a reason for hiding this comment

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

Hi guys. I'm just solving probably the issue with ordering, like you did here. Can you please explain why ordering in if ... else statement is important? Just don't get it, but seems to be causing duplicate imports. Many thanks.

Copy link
Contributor

@richardhuaaa richardhuaaa Mar 20, 2017

Choose a reason for hiding this comment

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

I think this was more of an aesthetic preference than anything else (put the case we expect to use first), so there wasn't necessarily a specific technical reason for it.

With the error you're facing, I'm not sure without additional investigation - but I could hypothesize that both "RCTConvert.h" and <React/RCTConvert.h> exist in 0.40 and later, and you're meant to use the latter.

Choose a reason for hiding this comment

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

I could hypothesize that both "RCTConvert.h" and <React/RCTConvert.h> exist in 0.40

actually that is what i thought too, but find node_modules/ -name RCTBridge* finds only occurrence. Also even if there were two of them, I though that #if / #else is safe enough to not allow importing file more than once.

I saw this commit, where you're changing order and I though, you had same issue with duplicate imports, but if it's just cosmetic, then it remains mystery for me.

Anyway thank you for time and answer.

Copy link
Contributor

@richardhuaaa richardhuaaa Mar 21, 2017

Choose a reason for hiding this comment

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

I don't think #if #else would protect you from duplicate imports. The #if only checks for existence - if it exists, it will try to import it. That's why my hypothesis is that the ordering might matter here - you should order by preference, in case both exist.

Copy link
Member

@BretJohnson BretJohnson left a comment

Choose a reason for hiding this comment

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

I just made the minor comment below, similar to what richard spotted. Otherwise, LGTM.

@@ -1,5 +1,10 @@
#import "CodePush.h"

#if __has_include("RCTConvert.h")
Copy link
Member

Choose a reason for hiding this comment

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

Should we swap the order, to do #if __has_include(<React/RCTConvert.h>) (that is, always check for the 0.40 case first)? It shouldn't really matter, that that would make all the files consistent and seems slightly better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants