Skip to content

Commit

Permalink
feat: Added type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Karthik-B-06 committed Oct 21, 2020
1 parent 6fabecf commit 4989b25
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 1 deletion.
38 changes: 38 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
declare module 'rn-segmented-control' {
import { ViewStyle, TextStyle } from "react-native"
import React from 'react'
export interface ShadowOffsetProps {
width: number,
height: number,
}

export interface ShadowStyleProps {
shadowColor: string,
shadowOffset: ShadowOffsetProps,
shadowOpacity: number,
shadowRadius: number,
elevation: number,
}

export interface SegmentedControlProps {
tabs: Array<string>;
onChange(index: number) :void;
currentIndex: number;
segmentedControlBackgroundColor?: string;
activeSegmentBackgroundColor?: string;
textColor?: string;
activeTextColor?: string;
activeTextWeight?: string;
paddingVertical?: number;
width?: number;
containerStyle?: ViewStyle;
textStyle?: TextStyle;
isRTL?: boolean;
theme?: "LIGHT" | "DARK";
shadowStyle?: ShadowStyleProps;
}

const SegmentedControl: React.FC<SegmentedControlProps>;

export default SegmentedControl;
}
35 changes: 35 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
"version": "0.2.6",
"description": "A simple and customizable React Native component to have a segmented control",
"main": "index.js",
"types": "index.d.ts",
"files": [
"src",
"index.d.ts"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand Down Expand Up @@ -31,6 +36,8 @@
"metro-react-native-babel-preset": "^0.60.0"
},
"dependencies": {
"prop-types": "^15.7.2"
"@types/react-native": "^0.63.27",
"prop-types": "^15.7.2",
"typescript": "next"
}
}

0 comments on commit 4989b25

Please sign in to comment.