Icon centered ?
See original GitHub issueYo ! I’m using this lib to render icon component and I find that the icons are not vertically centered. Maybe I’m using it wrong, but even if I render just the Icon component and put his background color to see better, the icon is clearly not centered.
import { Ionicon } from '@expo/vector-icons'
<Ionicon
color='white'
name='close'
style={ { backgroundColor: 'red' } }
/>
I tried to put alignItems: 'center'
and justifyContent: 'center'
to style
without success…
If I put paddingTop: 2
to style
, the icon is centered
Issue Analytics
- State:
- Created 6 years ago
- Reactions:18
- Comments:24 (1 by maintainers)
Top Results From Across the Web
How to center Font Awesome icons horizontally? - css
I have a table with a Font Awesome icon and I want to align text left and center icons. I tried with centering...
Read more >How to target all Font Awesome icons and align them center?
The most preferred way to center Font Awesome Icons is to assign a center class to each <i> tag. Setting width to 100%,...
Read more >[Solved] center align icon fonts horizontally - CSS-Tricks
I can't figure out how to txt-center icon fonts. They just don't center no matter what you do. example of css and html...
Read more >align-center Icon | Font Awesome
align -center icon in the Solid style. Make a bold statement in small sizes.. Available now in Font Awesome 6.
Read more >How to Vertically Center Text and Icons in CSS - SitePoint
To vertically center a single line of text or an icon within its container, we can use the line-height property. This property controls...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Wrap the icon component in a parent view and then set that view’s justifyContent style property to “center”. (or alignItems if you make the flexDirection “row”)
@basbase solution is good. And if you want to center the icon inside (because sometimes icons are not centered), you can add
textAlign: 'center'
to style icon