File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,10 @@ type Props = React.ElementConfig<typeof Surface> & {|
4848 * Label text of the button.
4949 */
5050 children : React . Node ,
51+ /**
52+ * Make the label text uppercased. Note that this won't work if you pass React elements as children.
53+ */
54+ uppercase : boolean ,
5155 /**
5256 * Accessibility label for the button. This is read by the screen reader when the user taps the button.
5357 */
@@ -102,6 +106,7 @@ type State = {
102106class Button extends React . Component < Props , State > {
103107 static defaultProps = {
104108 mode : 'text' ,
109+ uppercase : true ,
105110 } ;
106111
107112 state = {
@@ -136,6 +141,7 @@ class Button extends React.Component<Props, State> {
136141 icon,
137142 color : buttonColor ,
138143 children,
144+ uppercase,
139145 accessibilityLabel,
140146 onPress,
141147 style,
@@ -262,7 +268,9 @@ class Button extends React.Component<Props, State> {
262268 { React . Children . map (
263269 children ,
264270 child =>
265- typeof child === 'string' ? child . toUpperCase ( ) : child
271+ typeof child === 'string' && uppercase
272+ ? child . toUpperCase ( )
273+ : child
266274 ) }
267275 </ Text >
268276 </ View >
You can’t perform that action at this time.
0 commit comments