react-native-paper icon indicating copy to clipboard operation
react-native-paper copied to clipboard

How to change the color of action in Snackbar?

Open ilyaux opened this issue 7 years ago • 10 comments

How to change the color of action in Snackbar?

Hi guys ! Help to understand how to change the color of the action in Snackbar ?

         <Snackbar
           visible={this.state.visible}
          onDismiss={() => this.setState({ visible: false })}
          action={{
            
            label: "Undo",
            onPress: () => this.setState({ isHidden: true })}}>
          You are registered on {namefilm}
        </Snackbar>

ilyaux avatar Mar 13 '19 22:03 ilyaux

You can change it via theme prop:

theme={{ colors: { accent: 'red' }}}

Trancever avatar Mar 14 '19 08:03 Trancever

Hmm, this doesn't feel quite right. Why doesn't the Context-provided theme apply to this specific component?

robertherber avatar Aug 20 '19 22:08 robertherber

and, how to change the label color?

potier97 avatar Jun 09 '20 05:06 potier97

@potier97 in case you didn't find an answer - it's better to check TS definitions of Theme. I tried a few to find that I needed to change: image

vsheyanov avatar Aug 03 '20 06:08 vsheyanov

theme={{ colors: {surface: 'blue', accent: 'red'},}}

The example above describes the snackbar text color (and label color) as blue and the action color as red.

oberdan-dev avatar Dec 31 '20 11:12 oberdan-dev

I think this component should have a mode component that takes 'danger', 'error', 'info' etc...

shahzaibdev1 avatar Dec 02 '21 07:12 shahzaibdev1

        action={{
            icon: "close",
            color: "#FF00FF", // <---- Add this.
            label: "Undo",
           onPress: () => this.setState({ isHi.....

nebojsanb avatar May 07 '22 18:05 nebojsanb

With theme version 3, you can use theme={{colors: {inversePrimary: Colors.white }}}

alvinmandala avatar Sep 19 '22 16:09 alvinmandala

Hi, you should use the property textColor inside object action. in this example is red

<Snackbar visible={visible} action={{ label: 'Understan', textColor: 'red' }} onDismiss={ () => handleErrors() }> {message} </Snackbar>

andresfmm avatar Sep 10 '23 19:09 andresfmm

Some one knows how to change the size of the label inside the action?Without touching the code inside of the module of react-native-paper ?

SvenAndreas avatar Sep 12 '23 01:09 SvenAndreas