2016-07-01 72 views
2

我一直在嘗試使用此模塊「react-native-material-desing」更改按鈕的背景顏色。在文檔中(「https://github.com/react-native-material-design/react-native-material-design/blob/master/lib/Button.js」),他們說你必須重寫背景顏色,我認爲這樣做是正確的,但由於某種原因它不起作用,沒有錯誤或沒有任何簡單的顏色保持默認。更改React-Native-Material-Design模塊中按鈕的背景顏色

繼承人我的按鈕代碼裏面的渲染。

\t \t \t \t <Button 
 
\t \t \t \t \t onPress={this.gotoNext.bind(this)} 
 
\t \t \t \t \t text='Login' 
 
\t \t \t \t \t theme = 'dark' 
 
\t \t \t \t \t textColor = 'white' 
 
\t \t \t \t \t raised={true} 
 
\t \t \t \t \t overrides={{backgroundColor: 'red'}} 
 
\t \t \t \t />

任何想法或解決方案?謝謝:)

+0

只是爲了便便和咯咯笑,你試過'#F00'嗎? – JayGarcia

+0

Yee mb謝謝:)在iOS中 – user2849167

回答

1

以下是改變react-native-material-design背景顏色的方法。 請使用raised=true其他明智的背景色不覆蓋。

<Button value="submit" 
      raised={true} 
      backgroundColor='#F00' 
      onPress={//your onPress event here} 
      text="Submit"/> 
+0

,背景顏色根本沒有任何效果。 – Raptor