@@ -89,28 +89,31 @@ export default class RichTextToolbar extends Component {
89
89
return this . props . unselectedButtonStyle ? this . props . unselectedButtonStyle : styles . defaultUnselectedButton ;
90
90
}
91
91
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 } } />
95
97
} 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 } } />
97
100
} else {
98
101
return undefined ;
99
102
}
100
103
}
101
104
102
105
_defaultRenderAction ( action , selected ) {
103
- const icon = this . _getButtonIcon ( action ) ;
106
+ const icon = this . _getButtonIcon ( action , selected ) ;
104
107
return (
105
108
< TouchableOpacity
106
109
key = { action }
107
110
style = { [
108
- { height : 50 , width : 50 , justifyContent : 'center' } ,
111
+ { height : 50 , width : 50 , justifyContent : 'center' , alignItems : 'center' } ,
109
112
selected ? this . _getButtonSelectedStyle ( ) : this . _getButtonUnselectedStyle ( )
110
113
] }
111
114
onPress = { ( ) => this . _onPress ( action ) }
112
115
>
113
- { icon ? < Image source = { icon } style = { { tintColor : selected ? this . props . selectedIconTint : this . props . iconTint } } /> : null }
116
+ { icon ? icon : null }
114
117
</ TouchableOpacity >
115
118
) ;
116
119
}
0 commit comments