question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fab icon not working on web

See original GitHub issue

Current behaviour

The fab icon is not properly loading the font. As seen in the official demo here

Screen Shot 2020-11-07 at 9 37 19 PM

Expected behaviour

Font icon loads as seen on android and ios

Code sample

import * as React from 'react';
import { StyleSheet } from 'react-native';
import { FAB } from 'react-native-paper';

const MyComponent = () => (
  <FAB
    style={styles.fab}
    small
    icon="plus"
    onPress={() => console.log('Pressed')}
  />
);

Your Environment

See expo snack listed above and locally I am using

software version
react-native 0.63
react-native-paper ^4.3.1
react-native-vector-icons ^7.1.0
expo 39.0.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
RichardLindhoutcommented, Dec 7, 2020

I don’t use expo but with create-react-app 4 i had problems with react-native-vector-items

     {Platform.OS === 'web' ? (
              <style type="text/css">
                {`@font-face {
                font-family: 'MaterialCommunityIcons';
                src: url(${
                  require('react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf')}) format('truetype');
              }`}
              </style>
            ) : null}

Adding .default fixed it for me

     {Platform.OS === 'web' ? (
              <style type="text/css">
                {`@font-face {
                font-family: 'MaterialCommunityIcons';
                src: url(${
                  require('react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf')
                    .default
                }) format('truetype');
              }`}
              </style>
            ) : null}
0reactions
github-actions[bot]commented, Feb 6, 2021

Hello 👋, this issue has been open for more than 2 months with no activity on it. If the issue is still present in the latest version, please leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution on workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

html - Font Awesome icons are not working, I have included all ...
I am trying to use Font Awesome icons of version 4.1.0 on my website but they are not working, I have referenced them...
Read more >
[Solved]: Font Awesome icons not showing on my website
In this article, we will cover multiple possible causes of Font Awesome icons not showing on a website. In each of them, we...
Read more >
Troubleshooting | Font Awesome Docs
The icon I want to use is missing or not showing up? · Is the icon you're trying to use available in the...
Read more >
Favicon Not Showing Up - How to Fix In Chrome, Wordpress ...
Syntax errors · Your browser has cached your site as one without a favicon · Wrong file path · The browser does not...
Read more >
Some icons (fas/fab) not working on 4.6 Pro - MDBootstrap
I've noticed that the icons section has changed, but the icons are not displaying correctly (mainly fab / fas). Is there any additional...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found