Skip to content

Commit

Permalink
[IOAPPX-438] Relax the TS constraints of IOText to accept any numer…
Browse files Browse the repository at this point in the history
…ic value as `size` (#361)

## Short description
This PR removes the TS constraints of the `size` property of the
`IOText` component. It now accepts any numeric value.

## List of changes proposed in this pull request
- Change `IOText` TS requirements

## How to test
N/A
  • Loading branch information
dmnplb authored Nov 21, 2024
1 parent 4bf1a32 commit a643314
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/components/typography/IOText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { IOColors, useIOExperimentalDesign, useIOTheme } from "../../core";
import { useBoldTextEnabled } from "../../utils/accessibility";
import {
IOFontFamily,
IOFontSize,
IOFontWeight,
makeFontStyleObject
} from "../../utils/fonts";
Expand All @@ -37,7 +36,7 @@ export type TypographicStyleProps = Omit<
* cannot be included in the default StyleProp<TextStyle>
*/
type IOTextBaseProps = {
size?: IOFontSize;
size?: number;
weight?: IOFontWeight;
color?: IOColors;
font?: IOFontFamily;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/fonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const fontWeights: Record<IOFontWeight, IOFontWeightNumeric> = {
};

type FontStyleObject = {
fontSize: IOFontSize;
fontSize: IOFontSize | number;
/* We also accept `string` because Android needs a composed
fontFamily name, like `TitilliumSansPro-Regular` */
fontFamily: string | IOFontFamily;
Expand Down Expand Up @@ -132,7 +132,7 @@ const defaultFontSize: IOFontSize = 16;
*/

export const makeFontStyleObject = (
size: IOFontSize = defaultFontSize,
size: number = defaultFontSize,
font: IOFontFamily = defaultFont,
lineHeight: TextStyle["lineHeight"],
weight: IOFontWeight = defaultWeight,
Expand Down

0 comments on commit a643314

Please sign in to comment.