Skip to content
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

[IOAPPX-438] Relax the TS constraints of IOText to accept any numeric value as size #361

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Relax the TS constraints of IOText' to accept any numeric value as
…size`
dmnplb committed Nov 21, 2024
commit 0e6dddeb2cb7ea49f76397cd2596d44ddb384b75
3 changes: 1 addition & 2 deletions src/components/typography/IOText.tsx
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ import { IOColors, useIOExperimentalDesign, useIOTheme } from "../../core";
import { useBoldTextEnabled } from "../../utils/accessibility";
import {
IOFontFamily,
IOFontSize,
IOFontWeight,
makeFontStyleObject
} from "../../utils/fonts";
@@ -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;
4 changes: 2 additions & 2 deletions src/utils/fonts.ts
Original file line number Diff line number Diff line change
@@ -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;
@@ -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,