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.

[Button] - FAB icon is not centered on wide screens

See original GitHub issue

Description

The style seems to use wrong height/width values for the FAB (floating button) on wide screens:

.md-btn--floating{height:48px;padding:14px;width:48px}

It seems it should use 56px instead of 48px.

Images/Screenshots

screenshot from 2017-06-24 16-46-39

Version

  • React 15.6.1
  • React-MD 1.1.0-alpha-7

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
mlaursencommented, Aug 3, 2017

I could update the styles to something like this:

@media #{$md-desktop-media} {
  .md-icon.material-icons {
    font-size: 20px;
  }
}

which would work for these cases. It would just be harder to manually update the size of icons anywhere else. Maybe this isn’t too bad since there is the forceSize prop on the FontIcon? I’ll either update the documentation to tell the import order, or add this. I’ll close once I decide or if anyone else has opinions

0reactions
frolcommented, Aug 3, 2017

OK, I figured the root cause: I include material-icons-fontface.css AFTER the React-MD style sheets, and .material-icons class overrides the font-size. If I swap the <link> tags so Material icons style sheets are included BEFORE the React-MD ones, the issue goes away.

React-MD 1.0.x doesn’t change the size of the FAB button based on the screen size, which is why it works fine there.

I am not sure I like the idea of importing fonts before React-MD styles, but I can live with it. Feel free to close the issue if there is nothing you can do about it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android: Floating Button Icon is not centred - Stack Overflow
Use layout width and height of floatingActionButton as wrap-content. It will solve all the problems . <com.google.android.material.floatingactionbutton.
Read more >
FAB icon is not centered when using FontAwesome icons #1479
When I use FAB button it renders + icon not centered ... Set FontAwesome as a default icons source, use FAB with "plus"...
Read more >
5 Daily issues Android-Floating Action Button Icon not aligned ...
When I am trying to set the height and width value instead of wrap_content to FAB, the FAB icon not aligned to centre....
Read more >
Buttons: floating action button - Material Design
A floating action button (FAB) represents the primary action of a screen. ... all screen content, typically as a circular shape with an...
Read more >
Quick Tips to Start Using ExtendedFloatingActionButton
Find the right placement. Advice from material.io: “The extended FAB can be positioned in the center, left, or right side of a screen.”...
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