Skip to content

Commit

Permalink
Add fontScaling prop to allow font scale (#358 & #349) (#362)
Browse files Browse the repository at this point in the history
* Update package.json version to 8.0.1
  • Loading branch information
SanyaPillai authored Jan 29, 2024
1 parent 68baad1 commit 966619d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion CalendarPicker/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { View, Dimensions } from 'react-native';
import { View, Dimensions, Text } from 'react-native';
import { makeStyles } from './makeStyles';
import { Utils } from './Utils';
import HeaderControls from './HeaderControls';
Expand Down Expand Up @@ -39,6 +39,10 @@ export default class CalendarPicker extends Component {
...this.createMonths(props, {}),
};
this.state.renderMonthParams = this.createMonthProps(this.state);
Text.defaultProps = {
...Text.defaultProps,
allowFontScaling: props.fontScaling,
}
}

static defaultProps = {
Expand All @@ -61,6 +65,7 @@ export default class CalendarPicker extends Component {
selectedRangeStartStyle: null,
selectedRangeEndStyle: null,
selectedRangeStyle: null,
fontScaling: true,
};

componentDidUpdate(prevProps) {
Expand Down Expand Up @@ -408,6 +413,7 @@ export default class CalendarPicker extends Component {
selectedRangeStyle: this.props.selectedRangeStyle,
selectedRangeEndStyle: this.props.selectedRangeEndStyle,
customDatesStyles: this.props.customDatesStyles,
fontScaling: this.props.fontScaling,
};
}

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ const styles = StyleSheet.create({
| **`monthTitleStyle`** | `TextStyle` | Optional. Text styling for header's month text. |
| **`yearTitleStyle`** | `TextStyle` | Optional. Text styling for header's year text. |
| **`initialView`** | `String` | Optional. The view that the calendar opens to. Default is `days`. Available options are `years`, `months`, and `days`. |
| **`fontScaling`** | `Boolean` | Optional. To enable fontScaling. Default is `true` |

# Styles

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-calendar-picker",
"version": "8.0.0",
"version": "8.0.1",
"description": "Calendar Picker Component for React Native",
"engines": {
"node": ">=4.0.0"
Expand Down

0 comments on commit 966619d

Please sign in to comment.