Skip to content

Commit

Permalink
Merge pull request GeekyAnts#4246 from GeekyAnts/fix/typing-issue-fon…
Browse files Browse the repository at this point in the history
…t-styling

Typing issue fix in Font Styling
  • Loading branch information
surajahmed authored Oct 28, 2021
2 parents 7c7fb7c + 7b6859b commit ca1ccd4
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 87 deletions.
4 changes: 2 additions & 2 deletions src/components/composites/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ export const Tooltip = ({

const targetRef = React.useRef(null);

const enterTimeout = React.useRef<number>();
const exitTimeout = React.useRef<number>();
const enterTimeout = React.useRef<any>();
const exitTimeout = React.useRef<any>();
const tooltipID = useId();

const openWithDelay = React.useCallback(() => {
Expand Down
10 changes: 5 additions & 5 deletions src/hooks/useResolvedFontFamily.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useTheme } from './useTheme';

import type { ITheme } from '../theme';
/**
*
* @param props
Expand All @@ -10,9 +10,9 @@ import { useTheme } from './useTheme';
* This function depends upon fontConfig token in typography for mapping.
*/
export function useResolvedFontFamily(props: {
fontFamily?: string;
fontFamily?: keyof ITheme['fonts'];
fontStyle?: string;
fontWeight?: string | number;
fontWeight?: keyof ITheme['fontWeights'];
}) {
const { fontFamily, fontStyle, fontWeight } = props;
let newFontFamily = fontFamily;
Expand All @@ -21,8 +21,8 @@ export function useResolvedFontFamily(props: {

const { fontConfig, fontWeights, fonts } = useTheme();
if (fontWeight && fontStyle && fontFamily && fontFamily in fonts) {
const fontToken = fonts[fontFamily];

// TODO: Fix typing remove any.
const fontToken: any = fonts[fontFamily];
if (fontConfig && fontConfig[fontToken]) {
// If a custom font family is resolved, set fontWeight and fontStyle to undefined.
// https://github.com/GeekyAnts/NativeBase/issues/3811
Expand Down
157 changes: 78 additions & 79 deletions src/theme/base/typography.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,85 +19,84 @@ const typography = {
'4xl': '3em',
'5xl': '4em',
},
// fontConfig: {
// Roboto: {
// 100: {
// normal: 'Roboto-Light',
// italic: 'Roboto-LightItalic',
// },
// 200: {
// normal: 'Roboto-Light',
// italic: 'Roboto-LightItalic',
// },
// 300: {
// normal: 'Roboto-Light',
// italic: 'Roboto-LightItalic',
// },
// 400: {
// normal: 'Roboto-Regular',
// italic: 'Roboto-Italic',
// },
// 500: {
// normal: 'Roboto-Medium',
// italic: 'Roboto-MediumItalic',
// },
// 600: {
// normal: 'Roboto-Medium',
// italic: 'Roboto-MediumItalic',
// },
// 700: {
// normal: 'Roboto-Bold',
// italic: 'Roboto-BoldItalic',
// },
// 800: {
// normal: 'Roboto-Bold',
// italic: 'Roboto-BoldItalic',
// },
// 900: {
// normal: 'Roboto-Bold',
// italic: 'Roboto-BoldItalic',
// },
// },

// Montserrat: {
// 100: {
// normal: 'Montserrat-Light',
// italic: 'Montserrat-LightItalic',
// },
// 200: {
// normal: 'Montserrat-Light',
// italic: 'Montserrat-LightItalic',
// },
// 300: {
// normal: 'Montserrat-Light',
// italic: 'Montserrat-LightItalic',
// },
// 400: {
// normal: 'Montserrat-Regular',
// italic: 'Montserrat-Italic',
// },
// 500: {
// normal: 'Montserrat-Medium',
// italic: 'Montserrat-MediumItalic',
// },
// 600: {
// normal: 'Montserrat-SemiBold',
// italic: 'Montserrat-SemiBoldItalic',
// },
// 700: {
// normal: 'Montserrat-Bold',
// italic: 'Montserrat-BoldItalic',
// },
// 800: {
// normal: 'Montserrat-ExtraBold',
// italic: 'Montserrat-ExtraBoldItalic',
// },
// 900: {
// normal: 'Montserrat-Black',
// italic: 'Montserrat-BlackItalic',
// },
// },
// },
fontConfig: {
// Roboto: {
// 100: {
// normal: 'Roboto-Light',
// italic: 'Roboto-LightItalic',
// },
// 200: {
// normal: 'Roboto-Light',
// italic: 'Roboto-LightItalic',
// },
// 300: {
// normal: 'Roboto-Light',
// italic: 'Roboto-LightItalic',
// },
// 400: {
// normal: 'Roboto-Regular',
// italic: 'Roboto-Italic',
// },
// 500: {
// normal: 'Roboto-Medium',
// italic: 'Roboto-MediumItalic',
// },
// 600: {
// normal: 'Roboto-Medium',
// italic: 'Roboto-MediumItalic',
// },
// 700: {
// normal: 'Roboto-Bold',
// italic: 'Roboto-BoldItalic',
// },
// 800: {
// normal: 'Roboto-Bold',
// italic: 'Roboto-BoldItalic',
// },
// 900: {
// normal: 'Roboto-Bold',
// italic: 'Roboto-BoldItalic',
// },
// },
// Montserrat: {
// 100: {
// normal: 'Montserrat-Light',
// italic: 'Montserrat-LightItalic',
// },
// 200: {
// normal: 'Montserrat-Light',
// italic: 'Montserrat-LightItalic',
// },
// 300: {
// normal: 'Montserrat-Light',
// italic: 'Montserrat-LightItalic',
// },
// 400: {
// normal: 'Montserrat-Regular',
// italic: 'Montserrat-Italic',
// },
// 500: {
// normal: 'Montserrat-Medium',
// italic: 'Montserrat-MediumItalic',
// },
// 600: {
// normal: 'Montserrat-SemiBold',
// italic: 'Montserrat-SemiBoldItalic',
// },
// 700: {
// normal: 'Montserrat-Bold',
// italic: 'Montserrat-BoldItalic',
// },
// 800: {
// normal: 'Montserrat-ExtraBold',
// italic: 'Montserrat-ExtraBoldItalic',
// },
// 900: {
// normal: 'Montserrat-Black',
// italic: 'Montserrat-BlackItalic',
// },
// },
},
fontWeights: {
hairline: 100,
thin: 200,
Expand Down
3 changes: 2 additions & 1 deletion src/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ const config: ColorModeOptions = {
initialColorMode: 'light',
accessibleColors: false,
};

const theme = {
...base,
components,
config,
};

export type Theme = typeof theme;
export type Theme = typeof theme & { fontConfig: any };

export interface ICustomTheme {}

Expand Down

0 comments on commit ca1ccd4

Please sign in to comment.