React-native-paper: Snackbar Opacity

Created on 8 May 2020  路  4Comments  路  Source: callstack/react-native-paper

Ask your Question


I am using dark theme and for some reason my snackbars have an opacity less than one (making the content below visible). Is there a way to make the snackbar a solid color (opacity = 1)?

question

All 4 comments

Use the onSurface color property in theme to edit the color of the Snackbar

Here I am reducing the opacity of the Snackbar

theme={{
    colors: {
        onSurface: "rgba(0, 0, 0, 0.4)",
    },
}}

Output
image

In your case, you can set the opacity to 1 in the onSurface property to make it a solid color
In the example below I have changed the color of the Snackbar and the Text

theme={{
    colors: {
      onSurface: "rgba(0, 204, 204, 1)",
      surface: "black",
    },
}}

Output
image

Snackbar Code for Reference

<Snackbar
    visible={visible}
    onDismiss={this._onDismissSnackBar}
    action={{
        label: "Undo",
        onPress: () => {
            // Do something
            console.log("Hello");
        },
    }}

    theme={{
        colors: {
            onSurface: "rgba(0, 0, 0, 1)",
        },
    }}
>
    I'm a Snackbar.
</Snackbar>

Output
image

@mohanyadav Hey thanks for the tip! Unfortunately, I still am seeing items beneath the snackbar, even after setting the opacity to 1 as you mentioned. Any other ideas?

Thanks @mohanyadav! I could not figure out how to change the text color of my message...why would that call it surface...Thanks for the post!

Thank you very much! it has solved my problem :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

knobandre picture knobandre  路  4Comments

ButuzGOL picture ButuzGOL  路  4Comments

zxccvvv picture zxccvvv  路  4Comments

scottybo picture scottybo  路  3Comments

talaikis picture talaikis  路  3Comments