Css 覆盖react native中的按钮背景色

Css 覆盖react native中的按钮背景色,css,react-native,user-interface,button,mobile,Css,React Native,User Interface,Button,Mobile,我是react native的新手,我想知道是否有一种简单的方法可以覆盖按钮中的背景色。我确实试过很多方法,但都不走运。 基本上,我试图用我的自定义颜色替换默认的蓝色背景 有什么好的提示吗?请仔细阅读react native中的文档 您可以按如下方式轻松为按钮的颜色属性提供所需的颜色: <Button title="Press me" color="black" // Color of your choice

我是react native的新手,我想知道是否有一种简单的方法可以覆盖按钮中的背景色。我确实试过很多方法,但都不走运。 基本上,我试图用我的自定义颜色替换默认的蓝色背景


有什么好的提示吗?

请仔细阅读react native中的文档

您可以按如下方式轻松为按钮的颜色属性提供所需的颜色:

<Button
        title="Press me"
        color="black" // Color of your choice
        onPress={() => Alert.alert('Button with adjusted color pressed')}>
Alert.Alert(‘按下调整颜色的按钮’)}>

请仔细阅读react native中的文档

您可以按如下方式轻松为按钮的颜色属性提供所需的颜色:

<Button
        title="Press me"
        color="black" // Color of your choice
        onPress={() => Alert.alert('Button with adjusted color pressed')}>
Alert.Alert(‘按下调整颜色的按钮’)}>
您可以试试

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

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

export default App;
函数应用程序(){
const[color,setColor]=React.useState('blue');
返回(
{setColor(“黑色”)}/>
);
}
导出默认应用程序;
您可以试试

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

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

export default App;
函数应用程序(){
const[color,setColor]=React.useState('blue');
返回(
{setColor(“黑色”)}/>
);
}
导出默认应用程序;