Skip to content

Commit 004c1ed

Browse files
author
Alex Casillas
committed
Add type definitions
1 parent bc1e35c commit 004c1ed

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-loading-dots",
3-
"version": "1.3.3",
3+
"version": "1.3.4",
44
"description": "A React Native loading component with dots or custom components and smooth animation",
55
"repository": {
66
"type": "git",
@@ -9,6 +9,7 @@
99
"author": "Alex Casillas",
1010
"license": "MIT",
1111
"main": "src/react-native-loading-dots.js",
12+
"types": "src/react-native-loading-dots.d.ts",
1213
"peerDependencies": {
1314
"react": "^18.2.0",
1415
"react-native": "^0.73.4"

src/react-native-loading-dots.d.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export interface LoadingDotsProps {
2+
/** Number of dots to display */
3+
dots?: number;
4+
/** Array of color strings for the dots */
5+
colors?: string[];
6+
/** Size of each dot */
7+
size?: number;
8+
/** Height of the bounce animation for the dots */
9+
bounceHeight?: number;
10+
/** Border radius of the dots */
11+
borderRadius?: number;
12+
/** Custom components to use instead of default dots */
13+
components?: React.ReactNode[];
14+
}
15+
16+
declare const LoadingDots: (props: LoadingDotsProps) => JSX.Element;
17+
18+
export default LoadingDots;

src/react-native-loading-dots.js

+11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ import { StyleSheet, Animated, Easing } from "react-native";
33

44
const defaultColors = ["#4dabf7", "#3bc9db", "#38d9a9", "#69db7c"];
55

6+
/**
7+
* React Component that creates a smooth loading animation with dots
8+
* or custom components
9+
* @param {number} dots
10+
* @param {string[]} colors
11+
* @param {number} size
12+
* @param {number} bounceHeight
13+
* @param {number} borderRadius
14+
* @param {React.ReactNode[]} components
15+
* @returns React.JSX.Element
16+
*/
617
function LoadingDots({
718
dots = 4,
819
colors = defaultColors,

0 commit comments

Comments
 (0)