Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Paper Button icon size

Hey is there a way to set the size of my Button Icon?

<Button
  contentStyle={[accordionStyles.header__button, ]}
  icon={show === Props.value ? "chevron-up" : "chevron-down"}
  direction='rtl'
  color='black'
>
...
</Button>   

But if i try to size the Button with size={40} it's not working.

like image 409
MrTilllus Avatar asked Jul 10 '20 12:07

MrTilllus


1 Answers

You can do by adding icons as a child, still that feature is not yet developed, they have raised a PR:

 import { Button, Text } from 'react-native-paper';
import Icon from 'react-native-vector-icons/FontAwesome';

<Button
  style={buttonStyle}
  mode="contained"
  contentStyle={buttonContentStyle}
>
  <Icon name="warning" size={24} color="#fff" />
  <View style={{ width: 16, height: 1 }} />
  <Text style={buttonTextStyle}>Hello World</Text>
</Button>

hope it helps. feel free for doubts

like image 190
Gaurav Roy Avatar answered Oct 04 '22 11:10

Gaurav Roy