diff --git a/types/expo__vector-icons/expo__vector-icons-tests.tsx b/types/expo__vector-icons/expo__vector-icons-tests.tsx new file mode 100644 index 0000000000..14ccbc7aa4 --- /dev/null +++ b/types/expo__vector-icons/expo__vector-icons-tests.tsx @@ -0,0 +1,111 @@ +import * as React from 'react'; +import { View, Text, TabBarIOS } from 'react-native'; +import { createIconSet, MaterialIcons, FontAwesome, Ionicons } from 'expo__vector-icons'; + +const glyphMap = { + custom: 58918 +}; + +const CustomIcon = createIconSet(glyphMap, 'FontCustom', 'FontCustom.ttf'); + +const CustomIconButton = CustomIcon.Button; +const CustomIconTabBarItem = CustomIcon.TabBarItem; +const CustomIconTabBarItemIOS = CustomIcon.TabBarItemIOS; +const CustomIconToolbarAndroid = CustomIcon.ToolbarAndroid; +const CustomIcongetImageSource = CustomIcon.getImageSource; + +class Example extends React.Component { + handleButton() { + console.log('You pressed me'); + } + + render() { + return ( + + {/* Normal Icon */} + + + {/* Icon button */} + this.handleButton()} + > + + Login with Facebook + + + + ); + } +} + +class TabTest extends React.Component<{}, { selectedTab: string }> { + constructor() { + super({}); + + this.state = { + selectedTab: 'tab1' + }; + } + + render() { + return ( + + this.setState({ selectedTab: 'tab1' })} + > + + + + this.setState({ selectedTab: 'tab2' })} + > + + + + ); + } +} + +class TestCustomIcon extends React.Component { + constructor() { + super({}); + } + + handleButton() { + console.log('You pressed me'); + } + + render() { + return ( + + {/* Custom Icon */} + + + {/* Custom Icon button */} + this.handleButton()} + > + + Hello CustomIcon! + + + + ); + } +} diff --git a/types/expo__vector-icons/index.d.ts b/types/expo__vector-icons/index.d.ts new file mode 100644 index 0000000000..ccc71fc93e --- /dev/null +++ b/types/expo__vector-icons/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for @expo/vector-icons 6.2 +// Project: https://github.com/expo/vector-icons +// Definitions by: Hyeonsu Lee +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from 'react'; +import { TextProperties } from 'react-native'; + +export { createIconSet, createIconSetFromFontello, createIconSetFromIcoMoon } from 'react-native-vector-icons'; +export { default as Entypo } from 'react-native-vector-icons/Entypo'; +export { default as EvilIcons } from 'react-native-vector-icons/EvilIcons'; +export { default as Feather } from 'react-native-vector-icons/Feather'; +export { default as FontAwesome } from 'react-native-vector-icons/FontAwesome'; +export { default as Foundation } from 'react-native-vector-icons/Foundation'; +export { default as Ionicons } from 'react-native-vector-icons/Ionicons'; +export { default as MaterialCommunityIcons } from 'react-native-vector-icons/MaterialCommunityIcons'; +export { default as MaterialIcons } from 'react-native-vector-icons/MaterialIcons'; +export { default as Octicons } from 'react-native-vector-icons/Octicons'; +export { default as SimpleLineIcons } from 'react-native-vector-icons/SimpleLineIcons'; +export { default as Zocial } from 'react-native-vector-icons/Zocial'; diff --git a/types/expo__vector-icons/tsconfig.json b/types/expo__vector-icons/tsconfig.json new file mode 100644 index 0000000000..9eb44c222f --- /dev/null +++ b/types/expo__vector-icons/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "expo__vector-icons-tests.tsx" + ] +} diff --git a/types/expo__vector-icons/tslint.json b/types/expo__vector-icons/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/expo__vector-icons/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }