@hoddy-ui/core 2.5.0 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hoddy-ui/core",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "Core rich react native components written in typescript",
5
5
  "main": "index.ts",
6
6
  "repository": {
@@ -1,7 +1,7 @@
1
1
  import { Ionicons, MaterialIcons } from "@expo/vector-icons";
2
2
  import React, { forwardRef } from "react";
3
3
  import { ActivityIndicator, Text, TouchableOpacity } from "react-native";
4
- import { ScaledSheet, moderateScale } from "react-native-size-matters";
4
+ import { ScaledSheet, moderateScale, ms } from "react-native-size-matters";
5
5
  import { getConfig } from "../config/KeyManager";
6
6
  import { useColors, useTheme } from "../hooks";
7
7
  import { ButtonProps, IconButtonProps, LinkButtonProps } from "../types";
@@ -20,7 +20,7 @@ export const LinkButton: React.FC<LinkButtonProps> = ({
20
20
  const styles: any = ScaledSheet.create({
21
21
  text: {
22
22
  fontSize: moderateScale(fontSize),
23
- fontWeight: fontWeight,
23
+ fontWeight: fontWeight as any,
24
24
  fontFamily: getConfig().DEFAULT_FONT_FAMILY || "System",
25
25
  color: disabled ? "#777" : colors[color].main,
26
26
  },
@@ -51,7 +51,7 @@ export const IconButton: React.FC<IconButtonProps> = ({
51
51
  container: {
52
52
  alignSelf: "flex-start",
53
53
  flexGrow: 0,
54
- backgroundColor: bg ? bgColor : elevation! > 0 ? bgColor : null,
54
+ backgroundColor: bg ? bgColor : elevation! > 0 ? bgColor : undefined,
55
55
  padding: "5@ms",
56
56
  shadowColor: "#000",
57
57
  shadowOpacity: 0.1,
@@ -59,8 +59,8 @@ export const IconButton: React.FC<IconButtonProps> = ({
59
59
  height: 1,
60
60
  width: 0,
61
61
  },
62
- height: bg ? size + 20 + "@ms" : undefined,
63
- width: bg ? size + 20 + "@ms" : undefined,
62
+ height: bg ? ms(size + 20) : undefined,
63
+ width: bg ? ms(size + 20) : undefined,
64
64
  alignItems: "center",
65
65
  justifyContent: "center",
66
66
  shadowRadius: elevation,
@@ -118,7 +118,7 @@ const Button: React.FC<ButtonProps> = forwardRef(
118
118
  justifyContent: "center",
119
119
  backgroundColor:
120
120
  variant === "text" || variant === "outlined"
121
- ? null
121
+ ? undefined
122
122
  : translucent
123
123
  ? translucent === "dark"
124
124
  ? colors.white[3] + "22"
@@ -143,7 +143,7 @@ const Button: React.FC<ButtonProps> = forwardRef(
143
143
  width: 0,
144
144
  },
145
145
  shadowOpacity: variant === "text" ? 0 : 0.3,
146
- width: fullWidth ? "100%" : null,
146
+ width: fullWidth ? "100%" : undefined,
147
147
  ...style,
148
148
  },
149
149
  text: {
@@ -155,7 +155,7 @@ const Button: React.FC<ButtonProps> = forwardRef(
155
155
  variant === "text" || variant === "outlined" ? "main" : "text"
156
156
  ],
157
157
  fontWeight: variant === "outlined" ? "700" : "500",
158
- fontSize: size === "small" ? "12@ms" : "16@ms",
158
+ fontSize: size === "small" ? "12@ms" : "14@ms",
159
159
  fontFamily: getConfig().DEFAULT_FONT_FAMILY || "System",
160
160
  },
161
161
  });
@@ -11,19 +11,20 @@ const Typography: React.FC<TypographyProps> = forwardRef(
11
11
  children,
12
12
  color = "dark",
13
13
  style = {},
14
- textCase = null,
14
+ textCase,
15
15
  variant = "body1",
16
16
  align = "left",
17
17
  gutterBottom = 0,
18
18
  adjustsFontSizeToFit,
19
19
  fontWeight = 400,
20
20
  fontFamily, // NEW PROP ADDED
21
+ fontSize,
21
22
  ...props
22
23
  },
23
24
  ref
24
25
  ) => {
25
26
  const colors: any = useColors();
26
- const fontSize = {
27
+ const _fontSize = {
27
28
  h1: moderateScale(42),
28
29
  h2: moderateScale(37),
29
30
  h3: moderateScale(32),
@@ -37,7 +38,7 @@ const Typography: React.FC<TypographyProps> = forwardRef(
37
38
 
38
39
  const styles: any = StyleSheet.create({
39
40
  text: {
40
- fontSize: fontSize[variant],
41
+ fontSize: fontSize || _fontSize[variant],
41
42
  marginBottom: verticalScale(gutterBottom) || 0,
42
43
  color: colors[color]?.main || color,
43
44
  textTransform: textCase,
package/src/types.ts CHANGED
@@ -273,6 +273,7 @@ export interface TypographyProps extends TextProps {
273
273
  numberOfLines?: number;
274
274
  adjustsFontSizeToFit?: boolean;
275
275
  fontFamily?: string;
276
+ fontSize?: number;
276
277
  fontWeight?: 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
277
278
  }
278
279