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

fix: Adjust asset paths on iOS to resolve relative to the Resources group #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cayleyh
Copy link

@cayleyh cayleyh commented Jun 15, 2023

#43

@cayleyh
Copy link
Author

cayleyh commented Jun 15, 2023

While this improves the default handling of issues like #43 and using react-native-assets with other RN boilerplates, it does not address the underlying issue:

Xcode project groups can be arbitrarily moved around in Xcode, and they are not necessarily related to the layout of the underlying source code. Most teams over a certain size or app complexity will have adjusted their Resource groups to more cleanly organize their projects.

When react-native-assets links assets with Xcode, it just shoves everything in the the Resource group (either the first one it can find, or by creating one in the project top-level). The assets are added as Relative to Group --> ie. the path of the asset is relative to the nesting of the group in the Xcode project.

This can cause different errors, such as in cases where a deeply nested Resources group already exists, or if the team later moves their Resources group.

A better change would be to link the assets as being Relative to Project. However, based on my cursory reading of the cordova-node-xcode project tools, this is not possible. We would need to be able to set the sourceTree of an individual file from <group> to SOURCE_ROOT.

It's also worth noting that unlinking is broken in projects that require manual adjustments, and if you unlink some assets then re-add them, you could have duplicates added to your Xcode project.

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.

1 participant