Using different iconFamily gives warning, but displays correctly
react-native, react and native-base version
- React-Native: 0.40.0
- React: 15.4.2
- Native-Base: 2.0.5
Expected behaviour
Setting the iconFamily in variables will allow for other icons sets to be used.
Actual behaviour
Other iconSets can be used however there is a warning syaing that IconNB got an invalid prop type for name and then lists the IonIcon icon names.
Steps to reproduce (code snippet or screenshot)
import { Component } from 'react';
import { Container, StyleProvider, getTheme, Content, Icon } from 'native-base';
const variables={
iconFamily: 'FontAwesome',
iconFontSize: 28,
};
class TestPage extends Component {
render() {
return (
<Container>
<StyleProvider style={getTheme(variables)}>
<Content>
<Icon name="user" />
</Content>
</StyleProvider>
</Container>
);
}
}
Screenshot of emulator/device

Is the bug present in both ios and android or in any one of them?
Can only test on Android
Any other additional info which would help us debug the issue quicker.
This is a follow up issue from #493
I gets problems. How to fix ???
Looking through the source, I think that the problem lies with this line of code:
https://github.com/GeekyAnts/NativeBase/blob/a1cdca9ad2a7406b76feea76959536688dc226c3/src/basic/IconNB.js#L60
Ionicons' proptypes are copied into IconNBs proptypes. This means that if a different icon set is used a warning will appear as the proptype is in fact invalid
Thanks, will be looked into!
Other than giving warnings, certain icons do not render with other FontFamilies. e.g. In place of FontAwesome, if you use 'MaterialIcons' and try to use menu icon, it won't render correctly.
In my opinion, the root of the cause is here: https://github.com/GeekyAnts/NativeBase/blob/a1cdca9ad2a7406b76feea76959536688dc226c3/src/basic/Icon/NBIcons.json
Just come across this issue as well. Was trying to use lock icon in FontAwesome. Should the getName function be changed to check for icon packs in variables?
https://github.com/GeekyAnts/NativeBase/blob/a1cdca9ad2a7406b76feea76959536688dc226c3/src/basic/Icon/index.js#L18-L35
Looks like this was fixed in https://github.com/GeekyAnts/NativeBase/commit/f6e9e8b9c1f51b36903bfcfb09838510ab73a29a.
Will keep issue open until the next release, but using master for now and it is working. Thanks 😃
Now that 2.0.6 has been released I'm closing this issue.
Thanks!