React Native: Change text colour in Paper Button

Khant Thu Linn picture Khant Thu Linn · Oct 23, 2019 · Viewed 7.8k times · Source

I am relatively new in react native.

I can easily show button (with shadow, etc) as in here.

 <Button
  mode="contained"
  color={'#f08e25'}
  contentStyle={{ height: 44 }}
  onPress={this.onPressSubmit}
  theme={theme} >SUBMIT </Button>

I am also referring to this document.

https://callstack.github.io/react-native-paper/button.html#contentStyle

Problem is I can't change text colour if mode is "contained". I tried in contentStyle or theme and it is not working. How shall I change text color if mode is "contained"?

Answer

daryosh setorg picture daryosh setorg · Oct 23, 2019
import * as React from 'react';
import { Button,Text } from 'react-native-paper';

const MyComponent = () => (
  <Button icon="camera" color="blue" dark={true} compact={true}  style={{color:"red",marginTop:100}} mode="contained" onPress={() => console.log('Pressed')}>
   <Text style={{color:"red"}}>press me</Text>
  </Button>
);

export default MyComponent;

this is your answer in contained mode , color is shows for the color of all button not just text