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

Smart React util imports #2455

Closed
wants to merge 2 commits into from

Conversation

SudoPlz
Copy link

@SudoPlz SudoPlz commented Aug 23, 2018

What issue is this PR fixing?

This PR changes the way React components/utils/objects are imported so that imports work both with react-native link AND cocoapods React embedded projects.

How did you test this PR?

Tested it on my react-native link project and it works.

@rborn
Copy link
Collaborator

rborn commented Aug 23, 2018

Have you seen this? #2396

@wbyoung could you guys work together on that?

@SudoPlz
Copy link
Author

SudoPlz commented Aug 23, 2018

My PR will help #2396 too, it's not an either or situation, both can work great, and since that is a compile time if/else situation it won't affect the performance either.

@wbyoung
Copy link
Contributor

wbyoung commented Aug 24, 2018

@SudoPlz I understand that you're trying to resolve compiler issues w/ this PR, but I'm not sure I really understand how it resolves the issue that you're facing that #2396 would not.

I think it'd be preferable to stick with the React/*.h imports. That's working just fine for me and others in #2396 and I believe is how pretty much every project will import things (i.e. react-native-camera imports w/ the same style).

When used via react-native link, the project will be included as a sub-project of a main React Native app. It's been a while since I've worked in depth with Xcode, but as I understand it, this also allows Xcode to determine how to resolve React/*.h.

Can you try pulling and using #2396 in your project as it should resolve the issue that you're trying to address in this PR as well.

If it doesn't, can you post an example GitHub project that includes the proper package.json that fails to compile properly with npm run ios?

@SudoPlz
Copy link
Author

SudoPlz commented Aug 24, 2018

@wbyoung you're right, I did pull #2396 here https://github.com/SudoPlz/react-native-maps/tree/bin and everything works fine now (I had to add a few missing #ifdef HAVE_GOOGLE_MAPS clauses there as well).

Keep in mind in this PR I also included my code too.
It never harms to have an extra if clause just in case something went wrong and the class is not there, but I haven't tested enough to see if it wouldn't work if those if/else statements were not there.

I'll close that PR since I don't have the time to investigate further atm, but hopefully that issue will help someone in the future.

@SudoPlz SudoPlz closed this Aug 24, 2018
@wbyoung
Copy link
Contributor

wbyoung commented Aug 25, 2018

@SudoPlz yeah, it depends on what branch of the code base you're working off of. @chrise86 did the same thing off of a stable tag that I have here and shared it on wbyoung#2.

It's really just that all the Google Maps files need it (which I'm sure you already figured out, but the comment may be helpful for others who come here), but it depends on which branch you're including the changes. The open PR is based off of master which doesn't have that file.

This pull request was closed.
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.

3 participants