Skip to content

Commit 9112ef2

Browse files
authored
Merge pull request #53 from tranquan/master
Add typescript definition
2 parents 84c10f6 + 3799374 commit 9112ef2

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

index.d.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Component, ReactNode } from "react";
2+
3+
declare module "react-native-easy-toast" {
4+
export interface DURATION {
5+
LENGTH_SHORT: number;
6+
FOREVER: number;
7+
}
8+
export default class Toast extends Component {
9+
show: (
10+
text: string | ReactNode,
11+
duration?: number,
12+
callback?: (() => void)
13+
) => void;
14+
close: (duration?: number) => void;
15+
}
16+
}

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.1.0",
44
"description": "A react native module to show toast like android, it works on iOS and Android.",
55
"main": "index.js",
6+
"types": "index.d.ts",
67
"scripts": {
78
"test": "echo \"Error: no test specified\" && exit 1"
89
},
@@ -28,8 +29,8 @@
2829
"url": "https://github.com/crazycodeboy/react-native-easy-toast/issues"
2930
},
3031
"dependencies": {
31-
"prop-types": "^15.6.0"
32-
},
32+
"prop-types": "^15.6.0"
33+
},
3334
"peerDependencies": {
3435
"react-native": ">=0.20.0",
3536
"prop-types": "^15.5.7"

0 commit comments

Comments
 (0)