React-native-paper: Property for Icon color in Button component

Created on 13 Jul 2019  路  7Comments  路  Source: callstack/react-native-paper

Would be great to have a own property to override the icon color inside a button

https://github.com/callstack/react-native-paper/blob/master/src/components/Button.tsx#L256

Most helpful comment

Hey Surely we can, use the color prop

<Button
icon="close"
mode="outlined"
color="#fff"
dark={true}
compact={true}>
Close
</Button>

Yeah, that's for the text color.
But does it have a separate props only for the icon color if the icon is an SVG? (fill)

I think that's the question.

Component reference: https://callstack.github.io/react-native-paper/button.html#contentStyle

style={{marginTop: 30, borderColor: '#4688f1'}}
labelStyle={{color: '#fff'}} --> This Line Will Change Icon Color
icon="account-check"
mode="contained"
color="#8f7ee1"
onPress={() => this.checkIfExists()}>

All 7 comments

Cannot find an example in Material Design guidelines where there are different colours for button text and button icon. Generally, both an icon and text label should clarify action and call attention to a button, which with different colours can be less coherence.

Hey Surely we can, use the color prop

<Button
icon="close"
mode="outlined"
color="#fff"
dark={true}
compact={true}>
Close
</Button>

Hey Surely we can, use the color prop

<Button
icon="close"
mode="outlined"
color="#fff"
dark={true}
compact={true}>
Close
</Button>

Yeah, that's for the text color.
But does it have a separate props only for the icon color if the icon is an SVG? (fill)

I think that's the question.

Component reference: https://callstack.github.io/react-native-paper/button.html#contentStyle

Hey Surely we can, use the color prop

<Button
icon="close"
mode="outlined"
color="#fff"
dark={true}
compact={true}>
Close
</Button>

Yeah, that's for the text color.
But does it have a separate props only for the icon color if the icon is an SVG? (fill)

I think that's the question.

Component reference: https://callstack.github.io/react-native-paper/button.html#contentStyle

style={{marginTop: 30, borderColor: '#4688f1'}}
labelStyle={{color: '#fff'}} --> This Line Will Change Icon Color
icon="account-check"
mode="contained"
color="#8f7ee1"
onPress={() => this.checkIfExists()}>

Hey Surely we can, use the color prop

<Button
icon="close"
mode="outlined"
color="#fff"
dark={true}
compact={true}>
Close
</Button>

Yeah, that's for the text color.
But does it have a separate props only for the icon color if the icon is an SVG? (fill)
I think that's the question.
Component reference: https://callstack.github.io/react-native-paper/button.html#contentStyle

style={{marginTop: 30, borderColor: '#4688f1'}}
labelStyle={{color: '#fff'}} --> This Line Will Change Icon Color
icon="account-check"
mode="contained"
color="#8f7ee1"
onPress={() => this.checkIfExists()}>

According to the code _labelStyle_ is not applied to Icon element: https://github.com/callstack/react-native-paper/blob/f60dd8d2c82afe48406beccf5fb90e64f8ab56cb/src/components/Button.tsx#L281

Go and try once, it works.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

scottybo picture scottybo  路  3Comments

sm2017 picture sm2017  路  4Comments

ButuzGOL picture ButuzGOL  路  3Comments

ferrannp picture ferrannp  路  4Comments

kpervin picture kpervin  路  3Comments