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
Rename all fonts to use their names in react-native-vector-icons? #12
Comments
hi @gsklee! Sorry that this caused problems for you. It's not clear to me that the problem you are encountering is related to the name of the fonts -- I can't imagine why they would be used outside of the vector-icons libraries, and if so, you can get the name of the font rather than use an arbitrary string by doing The reason why Of course we can't ask every library to depend on I hope that helps give some background on the situation, but it's possible that it won't solve the immediate issue! Are you able to provide me with access to the project where you are experiencing this problem so I can investigate further? Or to reproduce within another example project? Thanks! |
Hi @brentvatne, I appreciate the detailed explanation, but it answered a question I didn't ask; my issue is exactly the same with #9. To illustrate: This is a very simple import { SearchBar } from 'react-native-elements';
// ...
render () {
return (
<SearchBar/>
);
}
// ... It will result in the error reported in #9: It won't work if I do the standard preloading mechanism as suggested in your docs; the same error still appears: async componentDidMount () {
const {navigation} = this.props;
await Promise.all([
...cacheImages(Object.values(images)),
...cacheFonts([MaterialIcons.font])
]);
navigation.navigate('Main');
} It works if I do this instead: async componentDidMount () {
const {navigation} = this.props;
await Promise.all([
...cacheImages(Object.values(images)),
...cacheFonts([
{'Material Icons': MaterialIcons.font['material']}
])
]);
navigation.navigate('Main');
} The culprit, as I've explained, is that you changed the name of the fonts for no apparent reason. While it's The fastest way to fix this issue, I believe, is to simply change the font names to align with the names inside I'd also suggest you to spend some time and play around |
I believe it did -- I explained that I did not see there being any difference in renaming the fonts. Like I said I'd be happy to do it if I thought it would help. I think the error you're seeing is because of another problem, though.
It does not result in this error. I just created a new project and added SearchBar and did not get any errors.
This is incorrect, as far as I can tell. Let's look at
now let's look at Expo's
Notice that it uses the Now, with the alias, when you do The only way this would not work is if the babelrc is not configured to use babel-preset-expo. The error that you are seeing would occur in that situation -- it's trying to use
I have done this and written up a guide in the past on how to integrate, and helped them to become compatible in various ways. Everything works as expected unless the babel preset isn't properly configured. |
It would not cause any problems, except that it might mask an underlying configuration issue where the Expo preset is not properly set up. I would accept a PR for it nonetheless -- if you don't want to use the Expo preset then this would make it easier to do so! |
@brentvatne In that case I am no longer sure about the source of the issue because the project was initialized using CRNA and I didn't touch anything about Babel configs. |
I'd like to say, however, that using Babel transformation to tackle this issue both made the source code harder to understand (what is described by the source code is not true and there are some meta mechanisms that I need to also become aware of to properly interpret the code) and harder to debug. Maybe you should figure out a better way to do this. |
I agree! I explained the idea for how we can do this above in my original reply. If you have time to help with that it would be very welcome; we have a lot to do at Expo and are a small team still so any help is appreciated. |
Again @gsklee if you share the project with me I am happy to help you get to the bottom of it. I have no idea what could be causing this if it's not the babel config. Did you eject the project, by any chance? I'd be happy to sign a NDA or whatever if that's necessary for accessing the project. |
@brentvatne I can help after this next week, have a tight deadline to meet right now 😭 |
@gsklee - good luck! :D |
@gsklee me too |
Okay, so, this is actually the same issue as #9; it's not being resolved by a PR, the issue is still there, I'm using the latest CRNA/expo(v17) combo.
I think this issue can be easily mitigated by renaming all fonts to use their names inside the original react-native-vector-icons; ie. you will wanna change this from
'material'
to'Material Icons'
, etc. etc.May we discuss why their names in this repo deviated from their original names and, if it will cause any harm to change them back? Thanks!
The text was updated successfully, but these errors were encountered: