-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[Android,Ios]supporting button text resize #16351
Changes from 9 commits
9ebe866
e5f3b26
6749869
568e8d7
09b5752
c116503
6da750b
b9b940d
9c5eb4f
652ab55
3c19cd8
ae8584e
3544f77
b8edc40
e6d4198
c9d93b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,7 @@ class Button extends React.Component<{ | |
accessibilityLabel?: ?string, | ||
disabled?: ?boolean, | ||
testID?: ?string, | ||
textSize?: ?string, | ||
}> { | ||
static propTypes = { | ||
/** | ||
|
@@ -84,6 +85,10 @@ class Button extends React.Component<{ | |
* Used to locate this view in end-to-end tests. | ||
*/ | ||
testID: PropTypes.string, | ||
/** | ||
* Used to change button's textSize | ||
*/ | ||
textSize: PropTypes.string, | ||
}; | ||
|
||
render() { | ||
|
@@ -94,6 +99,7 @@ class Button extends React.Component<{ | |
title, | ||
disabled, | ||
testID, | ||
textSize, | ||
} = this.props; | ||
const buttonStyles = [styles.button]; | ||
const textStyles = [styles.text]; | ||
|
@@ -104,6 +110,9 @@ class Button extends React.Component<{ | |
buttonStyles.push({backgroundColor: color}); | ||
} | ||
} | ||
if (textSize) { | ||
textStyles.push({fontSize: parseInt(textSize)}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'd consider using the same terms for styling props here because you're mapping also, your |
||
} | ||
const accessibilityTraits = ['button']; | ||
if (disabled) { | ||
buttonStyles.push(styles.buttonDisabled); | ||
|
@@ -155,6 +164,7 @@ const styles = StyleSheet.create({ | |
textAlign: 'center', | ||
padding: 8, | ||
fontWeight: '500', | ||
fontSize: 18, | ||
}, | ||
}), | ||
buttonDisabled: Platform.select({ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to this file appear unintentional. Can you remove it?