From 966619db89fc2206ff3806e879b2564da9d2bc54 Mon Sep 17 00:00:00 2001 From: SanyaPillai <151492137+SanyaPillai@users.noreply.github.com> Date: Mon, 29 Jan 2024 11:13:54 +0530 Subject: [PATCH] Add fontScaling prop to allow font scale (#358 & #349) (#362) * Update package.json version to 8.0.1 --- CalendarPicker/index.js | 8 +++++++- README.md | 1 + package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CalendarPicker/index.js b/CalendarPicker/index.js index e9265a8..f6d79d6 100644 --- a/CalendarPicker/index.js +++ b/CalendarPicker/index.js @@ -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'; @@ -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 = { @@ -61,6 +65,7 @@ export default class CalendarPicker extends Component { selectedRangeStartStyle: null, selectedRangeEndStyle: null, selectedRangeStyle: null, + fontScaling: true, }; componentDidUpdate(prevProps) { @@ -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, }; } diff --git a/README.md b/README.md index db5d516..3e721f0 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/package.json b/package.json index 4af5ad2..c0b90eb 100644 --- a/package.json +++ b/package.json @@ -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"