Skip to content

Commit

Permalink
fixed some styles causing ts errors when given string
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir Hadassi committed Oct 3, 2018
1 parent 710ed0b commit 2c96083
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
28 changes: 27 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,37 @@ import * as ReactNative from "react-native";

declare module "react-native-size-matters" {

interface StringifiedStyles {
fontSize?: string | number;
letterSpacing?: string | number;
lineHeight?: string | number;
textShadowRadius?: string | number;
textShadowOffset?: { width: number | string; height: number | string; };
shadowOffset?: { width: number | string; height: number | string; };
borderBottomLeftRadius?: string | number;
borderBottomRightRadius?: string | number;
borderTopLeftRadius?: string | number;
borderTopRightRadius?: string | number;
borderBottomWidth?: string | number;
borderTopWidth?: string | number;
borderRightWidth?: string | number;
borderLeftWidth?: string | number;
borderRadius?: string | number;
shadowRadius?: string | number;
borderWidth?: string | number;
aspectRatio?: string | number;
rotation?: string | number;
scaleX?: string | number;
scaleY?: string | number;
translateX?: string | number;
translateY?: string | number;
}

export function scale(size: number): number;
export function verticalScale(size: number): number;
export function moderateScale(size: number, factor?: number): number;

type NamedStyles<T> = { [P in keyof T]: ReactNative.ViewStyle | ReactNative.TextStyle | ReactNative.ImageStyle };
type NamedStyles<T> = { [P in keyof T]: ReactNative.ViewStyle | ReactNative.TextStyle | ReactNative.ImageStyle | StringifiedStyles };

export namespace ScaledSheet {
export function create<T extends NamedStyles<T>>(stylesObject: T): { [P in keyof T]: ReactNative.RegisteredStyle<T[P]> };
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-size-matters",
"version": "0.1.3",
"version": "0.1.4",
"description": "A React-Native utility belt for scaling the size your apps UI across different sized devices",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 2c96083

Please sign in to comment.