0

I am new on react-native and I was wondering if there is an easy way to overwrite a backgroundColor in the button. I did try in many ways but with no luck. Basically I am trying to replace the blue background by default with my custom color.

Any good tips?

2 Answers 2

1

You can try

function App() {
  const [color,setColor] = React.useState('blue'); 

  return (
    <Button 
       color={color}
       title="Click here"  
       onPress={() => { setColor("black") } />
    </div>
  );
}

export default App;
1

Please go through the documentation for Button in react native,

You can easily provide the required color to color prop of Button as follows:

<Button
        title="Press me"
        color="black" // Color of your choice
        onPress={() => Alert.alert('Button with adjusted color pressed')}>

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.