From 08753baeb10aa77c437e56ff665b8a6028cad380 Mon Sep 17 00:00:00 2001 From: Ifiok Jr <1160934+ifiokjr@users.noreply.github.com> Date: Sun, 17 Sep 2017 23:11:16 +0100 Subject: [PATCH] feat(react-native-elements): add utility exports --- types/react-native-elements/index.d.ts | 40 +++++++++++++++++++ .../react-native-elements-tests.tsx | 9 ++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/types/react-native-elements/index.d.ts b/types/react-native-elements/index.d.ts index fd03584dfa..d8d6c9d68b 100644 --- a/types/react-native-elements/index.d.ts +++ b/types/react-native-elements/index.d.ts @@ -2206,3 +2206,43 @@ export interface TileProps { * @see https://react-native-training.github.io/react-native-elements/API/tile/ */ export class Tile extends React.Component {} + +/** + * Colors + */ + +export interface Colors { + readonly primary: string; + readonly primary1: string; + readonly primary2: string; + readonly secondary: string; + readonly secondary2: string; + readonly secondary3: string; + readonly grey0: string; + readonly grey1: string; + readonly grey2: string; + readonly grey3: string; + readonly grey4: string; + readonly grey5: string; + readonly dkGreyBg: string; + readonly greyOutline: string; + readonly searchBg: string; + readonly disabled: string; + readonly white: string; + readonly error: string; + readonly [key: string]: string; +} + +export const colors: Colors; + +/* Utility Functions */ + +/** + * TODO make the Icon Type an export of the react-native-vector-icons type definitions. + */ +export function getIconType(type: IconType): any; + +/** + * Method to normalize size of fonts across devices + */ +export function normalize(size: number): number; diff --git a/types/react-native-elements/react-native-elements-tests.tsx b/types/react-native-elements/react-native-elements-tests.tsx index 2a722848e3..b6a8ba8c83 100644 --- a/types/react-native-elements/react-native-elements-tests.tsx +++ b/types/react-native-elements/react-native-elements-tests.tsx @@ -34,7 +34,10 @@ import { SwipeDeck, Tabs, Tab, - Tile + Tile, + colors, + getIconType, + normalize } from 'react-native-elements'; const { width, height } = Dimensions.get('window'); @@ -967,3 +970,7 @@ const TileTest: React.StatelessComponent = () => ( /> ); + +const CustomIcon = getIconType('material'); +const fontSize = normalize(20); +const white = colors.white;