React-native-paper: How to change the color of action in Snackbar?

Created on 13 Mar 2019  路  5Comments  路  Source: callstack/react-native-paper

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>
question

Most helpful comment

You can change it via theme prop:

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

All 5 comments

You can change it via theme prop:

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

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

and, how to change the label color?

@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

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alikazemkhanloo picture alikazemkhanloo  路  4Comments

mihaidaviddev picture mihaidaviddev  路  3Comments

kpervin picture kpervin  路  3Comments

ButuzGOL picture ButuzGOL  路  3Comments

tonyxiao picture tonyxiao  路  3Comments