React-native-elements: center Icon in Button

Created on 5 Apr 2018  路  3Comments  路  Source: react-native-elements/react-native-elements

Version: "react-native-elements": "^0.19.0",

Hello how can i center the icon in the button?
The Icon is align left. This is what i tried

                            <Button
                                rounded
                                buttonStyle={{ backgroundColor: 'green', justifyContent: 'center', alignItems:'center'}}
                                icon={{ name: 'info', type: 'font-awesome' }}
                            />

All 3 comments

@guitar9 See #771

@guitar9 As @mhsekhavat referenced, you can use the Icon component directly. If you really want to use the Button, you will have to do this in v0.19.0

<Button icon={{ name: "home",  style: { marginRight: 0 } }} buttonStyle={{ width: 50 }} />

In the new v1.0.0-beta4, thanks to @mhsekhavat, you don't have to do anything !

<Button icon={<Icon name="home" />} title={null} />

Closing this as it is solved in the beta.

Was this page helpful?
0 / 5 - 0 ratings