@@ -89,28 +89,31 @@ export default class RichTextToolbar extends Component {
8989 return this . props . unselectedButtonStyle ? this . props . unselectedButtonStyle : styles . defaultUnselectedButton ;
9090 }
9191
92- _getButtonIcon ( action ) {
93- if ( this . props . iconMap && this . props . iconMap [ action ] ) {
94- return this . props . iconMap [ action ] ;
92+ _getButtonIcon ( action , selected ) {
93+ if ( this . props . iconMap && React . isValidElement ( this . props . iconMap [ action ] ) ) {
94+ return this . props . iconMap [ action ]
95+ } else if ( this . props . iconMap && this . props . iconMap [ action ] ) {
96+ return < Image source = { this . props . iconMap [ action ] } style = { { tintColor : selected ? this . props . selectedIconTint : this . props . iconTint } } />
9597 } else if ( getDefaultIcon ( ) [ action ] ) {
96- return getDefaultIcon ( ) [ action ] ;
98+ const defaultImage = getDefaultIcon ( ) [ action ] ;
99+ return < Image source = { defaultImage } style = { { tintColor : selected ? this . props . selectedIconTint : this . props . iconTint } } />
97100 } else {
98101 return undefined ;
99102 }
100103 }
101104
102105 _defaultRenderAction ( action , selected ) {
103- const icon = this . _getButtonIcon ( action ) ;
106+ const icon = this . _getButtonIcon ( action , selected ) ;
104107 return (
105108 < TouchableOpacity
106109 key = { action }
107110 style = { [
108- { height : 50 , width : 50 , justifyContent : 'center' } ,
111+ { height : 50 , width : 50 , justifyContent : 'center' , alignItems : 'center' } ,
109112 selected ? this . _getButtonSelectedStyle ( ) : this . _getButtonUnselectedStyle ( )
110113 ] }
111114 onPress = { ( ) => this . _onPress ( action ) }
112115 >
113- { icon ? < Image source = { icon } style = { { tintColor : selected ? this . props . selectedIconTint : this . props . iconTint } } /> : null }
116+ { icon ? icon : null }
114117 </ TouchableOpacity >
115118 ) ;
116119 }
0 commit comments