Skip to content

Commit fa6026f

Browse files
committed
Typescript: Added definition for Grid and some missing props.
Also added dependencies to type definitions of react and react-native.
1 parent 3f66cff commit fa6026f

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@
2121
"url": "https://github.com/idibidiart/react-native-responsive-grid/issues"
2222
},
2323
"homepage": "https://github.com/idibidiart/react-native-responsive-grid#readme",
24-
"dependencies": {}
24+
"dependencies": {
25+
"@types/react": "^16.0.25",
26+
"@types/react-native": "^0.50.7"
27+
}
2528
}

src/index.d.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ declare module "react-native-responsive-grid" {
22
import { Component } from "react";
33
import { ViewProperties } from "react-native";
44

5+
export interface GridProps {
6+
7+
}
8+
59
export interface ColumnProps {
610
size?: number,
711
sizePoints?: number,
@@ -31,8 +35,7 @@ declare module "react-native-responsive-grid" {
3135
hAlign?: 'stretch' | 'center' | 'right' | 'left',
3236
alignSelf?: 'auto' | 'top' | 'bottom' | 'middle' | 'stretch' | 'baseline',
3337
fullWidth?: boolean,
34-
aspectRatio?: object,
35-
layoutEvent?: string,
38+
aspectRatio?: object
3639
}
3740

3841
export interface RowProps {
@@ -43,22 +46,29 @@ declare module "react-native-responsive-grid" {
4346
alignSelf?: 'auto' | 'left' | 'right' | 'center' | 'stretch',
4447
fullHeight?: boolean,
4548
alignLines?: string,
46-
layoutEvent?: string
49+
size?: number,
50+
sizePoints?: number
51+
smSizePoints?: number,
52+
mdSizePoints?: number,
53+
lgSizePoints?: number,
54+
xlSizePoints?: number
4755
}
4856

57+
export type AspectRatio = '16:9' | '16:10' | '3:2' | '4:3' | '1:1' |'4:3' | '3:2' | '16:10' | '16:9'
58+
4959
export class Row extends Component<ViewProperties & RowProps, any> { }
5060
export class Column extends Component<ViewProperties & ColumnProps, any> { }
61+
export class Grid extends Component<ViewProperties & GridProps, any> { }
5162

5263
export interface ScreenParams {
5364
mediaSize: 'sm' | 'md' | 'lg' | 'xl',
5465
width: number,
5566
height: number,
5667
aspectRatio?: {
57-
currentNearestRatio: string,
68+
currentNearestRatio: AspectRatio,
5869
currentOrientation: 'square' | 'landscape' | 'portrait'
5970
}
6071
}
6172

6273
export function ScreenInfo(onlySize?: boolean): ScreenParams;
63-
}
64-
74+
}

0 commit comments

Comments
 (0)