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 with icon in the right side

See original GitHub issue

Sometimes it is needed to put the icon in the Button component right to text, instead of left. For example when using Buttons in a pagination screen (prev, next).

Tried setting styled={{flexDirection:'row-reverse'}} via the style prop but the style props is being applied to the outer AnimatedPaper element and not the inner view which sets the direction.

How can make so that the icon will appear right of the text?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:5

github_iconTop GitHub Comments

10reactions
Rajan-Savaliyacommented, Aug 23, 2021

contentStyle={{flexDirection: ‘row-reverse’}} work for me

7reactions
jpaulomottacommented, Aug 12, 2021

I was able to get the icon on the right with the following code:

contentStyle={{flexDirection: 'row-reverse'}}

Full example:

<Button
  mode="contained"
  onPress={addPhoneNumber}
  style={{ padding: spacing.s3, marginTop: spacing.s8, backgroundColor: colors.grey200 }}
  dark={false}
  icon="chevron-right"
  contentStyle={{flexDirection: 'row-reverse'}}
>
  Next
</Button>

Result: Screen Shot 2021-08-12 at 19 15 38

Read more comments on GitHub >

github_iconTop Results From Across the Web

Right-aligned icon within button at any width - Stack Overflow
The button can be any width; Without an icon present, there is no excess padding on the button; The text and icon always...
Read more >
How To Create Icon Buttons - W3Schools
Tip: Go to our Icons Tutorial to learn more about icons. Go to our CSS Buttons Tutorial to learn more about how to...
Read more >
Buttons with icons - Leonardo Fernandes
These buttons each have an arrow icon. The next button has an arrow pointing right, aligned to the right of the button.
Read more >
Easily Create Buttons With Icons Using HTML & CSS - YouTube
View the Code & CodePen:https://dcode.domenade.com/tutorials/easily-create- buttons-with-icons -html-and-cssIn today's video I'll be showing ...
Read more >
Change icons position and add more than one icon in a button
How to make an icon in a button appear on the right side of the text instead of on the left side? How...
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