react-native-material-ui
react-native-material-ui copied to clipboard
Adding the ability to pass a custom children to button
Done this change to allow us to pass a custom children component. This can be util when you need to pass something different than only a text component.
What else you want to pass there?
I was thinking about two situation:
1 - Some of my buttons have icons on the right side. The way material-ui do today, we can't pass a icon to the right side. I was able to invert the icon direction using flexDirection: 'row-reverse'
on container style, but I still can't change the 8px right margin, and this make the content to be not centralized.
2 - I have a button that looks like a link (with underline). I was planning to pass a custom Text, but I saw I can pass a custom style to it.
So, after all I don't think I have more cases that I can't solve with the current resources, so, feel free to close it if you don't think it's necessary
@JoaoBGusmao You can override style on the icon by passing style={icon: {marginRight: 0}}
. IDK why it's not defined on the proptypes, I might open a PR for that.
I personally would like to have custom children component tho! Can think of couple usecases, i.e. displaying an ActivityIndicator.