diff --git a/types/react-native-vector-icons/Icon.d.ts b/types/react-native-vector-icons/Icon.d.ts index 3ae4916eea..353cbbb08d 100644 --- a/types/react-native-vector-icons/Icon.d.ts +++ b/types/react-native-vector-icons/Icon.d.ts @@ -5,7 +5,7 @@ import { TextProperties, TouchableHighlightProperties, TouchableNativeFeedbackProperties, - TabBarIOSProperties, + TabBarItemProperties, ToolbarAndroidProperties } from 'react-native'; @@ -90,51 +90,6 @@ export interface IconButtonProps extends IconProps, TouchableHighlightProperties export type ImageSource = any; -export interface TabBarIOSProps extends TabBarIOSProperties { - /** - * Name of the default icon (similar to TabBarIOS.Item icon) - * - * @type {string} - * @memberof TabBarIOSProps - */ - iconName: string; - - /** - * Name of the selected icon (similar to TabBarIOS.Item selectedIcon). - * - * @default iconName - * @type {string} - * @memberof TabBarIOSProps - */ - selectedIconName: string; - - /** - * Size of the icon. - * - * @default 30 - * @type {number} - * @memberof TabBarIOSProps - */ - iconSize: number; - - /** - * Color of the icon - * - * @type {string} - * @memberof TabBarIOSProps - */ - iconColor: string; - - /** - * Color of the selected icon. - * - * @default iconColor - * @type {string} - * @memberof TabBarIOSProps - */ - selectedIconColor: string; -} - export interface ToolbarAndroidProps extends ToolbarAndroidProperties { /** * Name of the navigation logo icon @@ -182,6 +137,53 @@ export interface ToolbarAndroidProps extends ToolbarAndroidProperties { iconColor: string; } +export interface TabBarItemIOSProps extends TabBarItemProperties { + /** + * Name of the default icon (similar to TabBarIOS.Item icon) + * + * @type {string} + * @memberof TabBarIOSItemProps + */ + iconName: string; + + /** + * Name of the selected icon (similar to TabBarIOS.Item selectedIcon) + * + * Defaults to iconName + * + * @type {string} + * @memberof TabBarIOSItemProps + */ + selectedIconName?: string; + + /** + * Size of the icon + * + * @default 30 + * @type {number} + * @memberof TabBarIOSItemProps + */ + iconSize?: number; + + /** + * Color of the icon + * + * @type {string} + * @memberof TabBarIOSItemProps + */ + iconColor?: string; + + /** + * Color of the selected icon. + * + * Defaults to iconColor + * + * @type {string} + * @memberof TabBarIOSItemProps + */ + selectedIconColor?: string; +} + export class Icon extends React.Component { static getImageSource( name: string, @@ -192,6 +194,6 @@ export class Icon extends React.Component { export namespace Icon { class ToolbarAndroid extends React.Component {} - class TabBarIOS extends React.Component {} + class TabBarItemIOS extends React.Component {} class Button extends React.Component {} } diff --git a/types/react-native-vector-icons/react-native-vector-icons-tests.tsx b/types/react-native-vector-icons/react-native-vector-icons-tests.tsx index 270c8fbdc4..ea61e6690b 100644 --- a/types/react-native-vector-icons/react-native-vector-icons-tests.tsx +++ b/types/react-native-vector-icons/react-native-vector-icons-tests.tsx @@ -1,7 +1,8 @@ import * as React from 'react'; -import { View, Text } from 'react-native'; +import { View, Text, TabBarIOS } from 'react-native'; import MaterialIcon from 'react-native-vector-icons/MaterialIcons'; import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'; +import Ionicon from 'react-native-vector-icons/Ionicons'; class Example extends React.Component<{}, {}> { handleButton() { @@ -28,3 +29,43 @@ class Example extends React.Component<{}, {}> { ); } } + +class TabTest extends React.Component { + constructor() { + super(); + + this.state = { + selectedTab: 'tab1' + }; + } + + render() { + return ( + + this.setState({selectedTab: 'tab1'})} + > + + + + this.setState({selectedTab: 'tab2'})} + > + + + + ); + } +}