Skip to content

Commit 5e42ef3

Browse files
committed
Addded support for the option to allow or disallow fontscaling to all of the text elements
1 parent 58ed2b1 commit 5e42ef3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

datepicker.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ class DatePicker extends Component {
172172
}
173173

174174
getTitleElement() {
175-
const {date, placeholder, customStyles} = this.props;
175+
const {date, placeholder, customStyles, allowFontScaling} = this.props;
176176

177177
if (!date && placeholder) {
178-
return (<Text style={[Style.placeholderText, customStyles.placeholderText]}>{placeholder}</Text>);
178+
return (<Text allowFontScaling={allowFontScaling} style={[Style.placeholderText, customStyles.placeholderText]}>{placeholder}</Text>);
179179
}
180-
return (<Text style={[Style.dateText, customStyles.dateText]}>{this.getDateStr()}</Text>);
180+
return (<Text allowFontScaling={allowFontScaling} style={[Style.dateText, customStyles.dateText]}>{this.getDateStr()}</Text>);
181181
}
182182

183183
onDateChange(date) {
@@ -334,7 +334,8 @@ class DatePicker extends Component {
334334
TouchableComponent,
335335
testID,
336336
cancelBtnTestID,
337-
confirmBtnTestID
337+
confirmBtnTestID,
338+
allowFontScaling
338339
} = this.props;
339340

340341
const dateInputStyle = [
@@ -402,6 +403,7 @@ class DatePicker extends Component {
402403
testID={cancelBtnTestID}
403404
>
404405
<Text
406+
allowFontScaling={allowFontScaling}
405407
style={[Style.btnTextText, Style.btnTextCancel, customStyles.btnTextCancel]}
406408
>
407409
{cancelBtnText}
@@ -413,7 +415,7 @@ class DatePicker extends Component {
413415
style={[Style.btnText, Style.btnConfirm, customStyles.btnConfirm]}
414416
testID={confirmBtnTestID}
415417
>
416-
<Text style={[Style.btnTextText, customStyles.btnTextConfirm]}>{confirmBtnText}</Text>
418+
<Text allowFontScaling={allowFontScaling} style={[Style.btnTextText, customStyles.btnTextConfirm]}>{confirmBtnText}</Text>
417419
</TouchableComponent>
418420
</Animated.View>
419421
</TouchableComponent>
@@ -443,6 +445,7 @@ DatePicker.defaultProps = {
443445
// whether or not show the icon
444446
showIcon: true,
445447
disabled: false,
448+
allowFontScaling: true,
446449
hideText: false,
447450
placeholder: '',
448451
TouchableComponent: TouchableHighlight,
@@ -465,6 +468,7 @@ DatePicker.propTypes = {
465468
customStyles: PropTypes.object,
466469
showIcon: PropTypes.bool,
467470
disabled: PropTypes.bool,
471+
allowFontScaling: PropTypes.bool,
468472
onDateChange: PropTypes.func,
469473
onOpenModal: PropTypes.func,
470474
onCloseModal: PropTypes.func,

0 commit comments

Comments
 (0)