gluestack

gluestack Logogluestack

How to style a button when pressed ?

andbutsothen posted this in #support
Open in Discord
Avatar
andbutsothenOP
Hello, I've noticed there is no documentation for how to style a button based upon a press.

In NativeWind, the active psedu-class is not supported in RN. And the pressable "pressed" event is only available in the inner JSX.

So if iI want to style the Button component at the Button level ( not the inner children ) when I press it, how would I do this ?

It seem like we would like to see some kind of opacity change or somethig to signal the press ?

5 Replies

Avatar
viraj1098
You can pass data-[active=true]:bg-red-500 as a className and this will change the color.
data-[active=true]:opacity-50
Avatar
andbutsothenOP
@viraj1098 Thank you. Can you update your docs to explain these states ... or did I miss this section ?
Avatar
andbutsothenOP
@viraj1098 this doesn't seem to work for me now. Is there a way to check all configuration or overwrite all configuration and add updates to V2 once it is installed ?
Avatar
viraj1098
Hey @andbutsothen , Can you give me a reproduce bug repo? with this bug I might be able to debug better.