Search code examples
react-nativereact-native-paperreact-native-stylesheet

react native paper : i want to change button's color when i press react native paper's button


While my react-native-paper button is pressed, the background color turns violet. I want to change this 'violet color' to anything to suit the situation. enter image description here

I change button's text color easily and rejoicingly with docs. However, I read the docs of React Native Paper button, but i can't find anything about changing the background color.


Solution

  • I think you can't change color chaning after pressed without changing the color of whole button. What you can do is wrap the button in independent clickable function like TouchableOpacity, TouchableWithoutFeedback or another custom from web.

    There is a little example what I mean to do:

    <TouchableOpacity>
       <Button icon="camera" mode="contained">
          Press me
       </Button>
    </TouchableOpacity>