Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styling Button's text in React Native #1853

Closed
silvestreh opened this issue Sep 14, 2017 · 6 comments
Closed

Styling Button's text in React Native #1853

silvestreh opened this issue Sep 14, 2017 · 6 comments
Labels

Comments

@silvestreh
Copy link

It does look like the Button component takes a styles prop which you later use to apply the Text styles.

I can't find documentation on how to change the text color. I noticed I can switch between black and white by using the type='primary' prop, but I need other colors 😄

Any hints would be greatly appreciated.

@ant-design-bot
Copy link

Hello @silvestreh, your issue has been closed because it does not conform to our issue requirements. Please use the Issue Helper to create an issue, thank you!

@paranoidjk
Copy link
Contributor

You have to follow this object structure
https://github.com/ant-design/ant-design-mobile/blob/master/components/button/style/index.native.tsx
for example

https://github.com/ant-design/antd-mobile-samples/blob/master/rn-custom-ui/inputStyle.js

@silvestreh
Copy link
Author

Thanks! For people who might get here through a Google search here's how I solved using @paranoidjk hints:

import ButtonStyle from 'antd-mobile/lib/button/style/index.native';

StyleSheet.create({
  ...ButtonStyle,

  defaultRawText: {
    color: 'red'
  }
});

@warmhug
Copy link
Contributor

warmhug commented May 24, 2018

Ref: #2461 #2025 #1856 #1851 #1174 #815 #698

@youngjuning
Copy link

@silvestreh how can i do?

@1uokun
Copy link

1uokun commented Aug 13, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants