diff --git a/src/components/BottomNavigation.js b/src/components/BottomNavigation.js index f71222a..6bd4c84 100644 --- a/src/components/BottomNavigation.js +++ b/src/components/BottomNavigation.js @@ -732,7 +732,7 @@ class BottomNavigation extends React.Component, State> { }) ) : ( @@ -753,7 +753,7 @@ class BottomNavigation extends React.Component, State> { }) ) : ( diff --git a/src/components/Button.js b/src/components/Button.js index c9523de..04edec5 100644 --- a/src/components/Button.js +++ b/src/components/Button.js @@ -207,7 +207,7 @@ class Button extends React.Component { {icon && loading !== true ? ( - + ) : null} {loading ? ( diff --git a/src/components/Checkbox.ios.js b/src/components/Checkbox.ios.js index 3143668..82d780e 100644 --- a/src/components/Checkbox.ios.js +++ b/src/components/Checkbox.ios.js @@ -67,7 +67,7 @@ class Checkbox extends React.Component { diff --git a/src/components/Checkbox.js b/src/components/Checkbox.js index 6c6a19f..9c97bba 100644 --- a/src/components/Checkbox.js +++ b/src/components/Checkbox.js @@ -147,7 +147,7 @@ class Checkbox extends React.Component { diff --git a/src/components/Chip.js b/src/components/Chip.js index f2051fe..fd57998 100644 --- a/src/components/Chip.js +++ b/src/components/Chip.js @@ -75,7 +75,7 @@ class Chip extends React.Component { return ( - {icon ? : null} + {icon ? : null} { {onDelete ? ( - + ) : null} diff --git a/src/components/CrossFadeIcon.js b/src/components/CrossFadeIcon.js index 6037a39..391ce83 100644 --- a/src/components/CrossFadeIcon.js +++ b/src/components/CrossFadeIcon.js @@ -105,7 +105,7 @@ class CrossFadeIcon extends React.Component { }, ]} > - + ) : null} { }, ]} > - + ); diff --git a/src/components/DrawerItem.js b/src/components/DrawerItem.js index 9fb28de..6eb6290 100644 --- a/src/components/DrawerItem.js +++ b/src/components/DrawerItem.js @@ -81,7 +81,7 @@ class DrawerItem extends React.Component { return ( - {icon && } + {icon && } React.Node) - // This will be removed in next major version - | React.Node; + | ((props: IconProps) => React.Node); type IconProps = { color: string, @@ -41,7 +39,7 @@ type IconProps = { }; type Props = IconProps & { - name: IconSource, + source: IconSource, }; const isImageSource = (source: any) => @@ -72,23 +70,23 @@ export const isValidIcon = (source: any) => export const isEqualIcon = (a: any, b: any) => a === b || getIconId(a) === getIconId(b); -const Icon = ({ name, color, size, ...rest }: Props) => { - if (typeof name === 'string') { +const Icon = ({ source, color, size, ...rest }: Props) => { + if (typeof source === 'string') { return ( ); - } else if (isImageSource(name)) { + } else if (isImageSource(source)) { return ( { ]} /> ); - } else if (typeof name === 'function') { - return name({ color, size }); + } else if (typeof source === 'function') { + return source({ color, size }); } - return ( - - {(name: any)} - - ); + return null; }; export default Icon; const styles = StyleSheet.create({ - container: { - alignItems: 'center', - justifyContent: 'center', - overflow: 'hidden', - }, icon: { backgroundColor: 'transparent', }, diff --git a/src/components/List/ListAccordion.js b/src/components/List/ListAccordion.js index bce7e7d..cda9e30 100644 --- a/src/components/List/ListAccordion.js +++ b/src/components/List/ListAccordion.js @@ -4,7 +4,7 @@ import color from 'color'; import * as React from 'react'; import { View, StyleSheet } from 'react-native'; import TouchableRipple from '../TouchableRipple'; -import Icon from '../Icon'; +import Icon, { type IconSource } from '../Icon'; import Text from '../Typography/Text'; import withTheme from '../../core/withTheme'; import type { Theme } from '../../types'; @@ -21,7 +21,7 @@ type Props = { /** * Icon to display for the `ListAccordion`. */ - icon?: React.Node, + icon?: IconSource, /** * Content of the section. @@ -101,7 +101,7 @@ class ListAccordion extends React.Component { ]} > { { description && styles.multiline, ]} > - {avatar || ( - - )} + {avatar || + (icon ? ( + + ) : null)} ) : null} @@ -116,7 +117,7 @@ class ListItem extends React.Component { {avatar && icon ? ( - + ) : null} diff --git a/src/components/RadioButton.ios.js b/src/components/RadioButton.ios.js index 56037d4..99ab401 100644 --- a/src/components/RadioButton.ios.js +++ b/src/components/RadioButton.ios.js @@ -85,7 +85,7 @@ class RadioButton extends React.Component { diff --git a/src/components/Searchbar.js b/src/components/Searchbar.js index c6fef10..32fa59e 100644 --- a/src/components/Searchbar.js +++ b/src/components/Searchbar.js @@ -147,7 +147,7 @@ class Searchbar extends React.Component { rippleColor={rippleColor} onPress={onIconPress} color={iconColor} - name={icon || 'search'} + source={icon || 'search'} /> { color={iconColor} rippleColor={rippleColor} onPress={this._handleClearPress} - name="close" + source="close" /> ) : null} diff --git a/src/components/Toolbar/ToolbarAction.js b/src/components/Toolbar/ToolbarAction.js index 3b5c239..d1d6faf 100644 --- a/src/components/Toolbar/ToolbarAction.js +++ b/src/components/Toolbar/ToolbarAction.js @@ -59,7 +59,7 @@ export default class ToolbarAction extends React.Component { ); diff --git a/src/components/Toolbar/ToolbarBackAction.js b/src/components/Toolbar/ToolbarBackAction.js index 5d99f0b..d10c59f 100644 --- a/src/components/Toolbar/ToolbarBackAction.js +++ b/src/components/Toolbar/ToolbarBackAction.js @@ -29,7 +29,7 @@ const ToolbarBackAction = (props: Props) => { const icon = Platform.OS === 'ios' ? ({ color }) => ( - + ) : 'arrow-back'; diff --git a/src/components/TouchableIcon.js b/src/components/TouchableIcon.js index 494d61e..a33f66a 100644 --- a/src/components/TouchableIcon.js +++ b/src/components/TouchableIcon.js @@ -9,7 +9,7 @@ import Icon from './Icon'; import type { IconSource } from './Icon'; type Props = { - name: IconSource, + source: IconSource, color: string, size?: number, onPress: ?Function, @@ -17,7 +17,7 @@ type Props = { }; const TouchableIcon = ({ - name, + source, color: iconColor, size = 24, onPress, @@ -43,7 +43,7 @@ const TouchableIcon = ({ {...rest} > - + );