-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 iOS Asset Linking #1232
Fix iOS Asset Linking #1232
Conversation
Because `RNVectorIcons.podspec` includes a `resources` line AND `react-native-config.js` includes an `assets` line, each font file is being copied into the iOS project twice when using react native >= 0.60 (autolinking). This commit removes the `resources` line from the podspec, making it so that just a single copy of the assets are added to the project. I chose to remove it from the podspec, not the react-native config because the react-native config also copies assets for Android and I didn't want to break that functionality.
+1 |
This broke the example application when I applied the changes 🤔 |
@oblador Thanks for reviewing the PR. Are you talking about the TabBarExample? If so, the breakage you're seeing is likely because the example is still on react-native@0.57.1, which doesn't have support for auto linking, so you wouldn't have seen this issue or the fix unless you explicitly tried to run
This library is currently broken on react-native@>=0.60 and needs a fix, but I don't know how to do that and still keep backward-compatibility with react-native@<0.60. I think this is going to need to be released as a semver: major (breaking change). With the IconExplorerExample, you would also see the issue and the fix if you run With your blessing, I'll make the necessary changes in this PR to prep for a major version update:
Does that work for you? Any other changes? |
+1 on the README updates. It's really confusing, especially for newcomers, to install a native module when it really is just a single command. No need to explain complex steps like link command or manual linking. |
Now that I'm reading through the Autolinking docs again, I think the title of this PR might be misleading. What I actually did was fix support for |
@kylerjensen any news on your last approach? It sounds interesting and might solve a lot of headaches |
@danielfx90 I put this on hold for a while because I'm not sure which direction to go. Either we fix autolinking and force devs to manually add fonts to their Info.plists, or we fix diff --git a/node_modules/react-native-vector-icons/RNVectorIcons.podspec b/node_modules/react-native-vector-icons/RNVectorIcons.podspec
index 9a1d11d..ff2e9ad 100644
--- a/node_modules/react-native-vector-icons/RNVectorIcons.podspec
+++ b/node_modules/react-native-vector-icons/RNVectorIcons.podspec
@@ -12,7 +12,6 @@ Pod::Spec.new do |s|
s.platforms = { :ios => "9.0", :tvos => "9.0" }
s.source = { :git => "https://github.com/oblador/react-native-vector-icons.git", :tag => "v#{s.version}" }
s.source_files = 'RNVectorIconsManager/**/*.{h,m}'
- s.resources = "Fonts/*.ttf"
s.preserve_paths = "**/*.js"
s.dependency 'React'
|
@kylerjensen I think autolinking is the new standard. Manual linking is deprecated. Cheers |
I am still getting this error:-
After removing |
Closing this for now. I've come up with a suitable workaround (see above), but implementing/fixing auto linking is beyond the scope of what I have time for right now. If someone else wants to try their hand at auto linking, I'm sure it would be greatly appreciated. |
Because
RNVectorIcons.podspec
includes aresources
line ANDreact-native-config.js
includes anassets
line, each font file is being copied into the iOS project twice when using react native >= 0.60 (which supports autolinking) and runningreact-native link
. This commit removes theresources
line from the podspec, making it so that just a single copy of the assets are added to the project. I chose to remove it from the podspec rather than the react-native config because the react-native config also copies assets for Android and I didn't want to break that functionality.Closes #1173