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
React native support? #6
Comments
The icons are implemented as react If you care to do any work toward it, I can stub out a repo in this org which you can contribute to. |
While Phosphor is not officially supported in react-native, you can just add the import { createIconSetFromIcoMoon } from 'react-native-vector-icons';
import phosphorConfig from '_assets/icons/Phosphor.json';
const VectorIcon = createIconSetFromIcoMoon(
phosphorConfig,
'Phosphor',
'Phosphor.ttf'
);
function PhosphorIcon({ name, size, color, ...props }) {
return <VectorIcon size={size} name={name} color={color} {...props} />;
}
PhosphorIcon.propTypes = {
name: PropTypes.string.isRequired,
size: PropTypes.number,
color: PropTypes.string,
};
PhosphorIcon.defaultProps = {
size: 24,
color: '#fff',
};
export default PhosphorIcon The Edit: By using this way, the Duotone icons do not work. To use them, you should use react-native-svg as @rektdeckard said before. All the others variations are available as a dash-separated name (AKA |
@italomlp this is essentially what we do in phosphor-flutter, with the main drawbacks of not having duotone, no tree-shaking (font files and json are pretty big), and the inherent limitations of using fonts. If we were to provide our own react-native implementation, I'd want it to be SVG. |
@rektdeckard of course, you should use the best option to provide all features from Phosphor, I totally agree! But for now, for those who want to use the basic, react-native-vector-icons with custom fonts is a great option. We are still talking about it here in the job. If we will use svg, maybe we could make a PR to contribute to Phosphor too. I'll come back if it's the case. |
@italomlp I tried it, but got an error Unrecognized font family 'Phosphor' I added phosphor.ttf in ios/Fonts, Phosper.json in assets/ and added < key > UIAppFonts </ key > Did I miss anything? |
I've just released https://github.com/duongdev/phosphor-react-native. Same API to this lib. Try it guys. Contribution is welcomed. |
Is react native supported? If so can we add the integration steps in the documentation.
Usually font icons works on react native using react native vector icons library. But Phosphor icon support is not there yet.
The text was updated successfully, but these errors were encountered: