File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -110,17 +110,14 @@ function onIconPropertyChanged(data) {
110
110
var icon = data . newValue ;
111
111
var iconDrawable = null ;
112
112
113
- //Kill the old Image, cocoapod doesn't support changing it yet
114
- var button = fab . ios . subviews [ 0 ] ;
115
- var oldBadImageView = button . subviews [ 0 ] ;
116
- oldBadImageView . removeFromSuperview ( ) ;
113
+
117
114
var newImageView = null ;
118
115
119
116
if ( ImageSource . isFileOrResourcePath ( icon ) ) {
120
117
iconDrawable = ImageSource . fromFileOrResource ( icon ) ;
121
118
122
119
//Set the new one
123
- if ( iconDrawable ) {
120
+ if ( iconDrawable !== null ) {
124
121
newImageView = UIImageView . alloc ( ) . initWithImage ( iconDrawable . ios ) ;
125
122
}
126
123
} else {
@@ -130,8 +127,16 @@ function onIconPropertyChanged(data) {
130
127
newImageView . frame = CGRectMake ( 0 , 0 , 40 , 40 ) ; //resize
131
128
132
129
}
130
+
131
+ if ( newImageView !== null ) {
132
+ //Kill the old Image, cocoapod doesn't support changing it yet
133
+ var button = fab . ios . subviews [ 0 ] ;
134
+ var oldBadImageView = button . subviews [ 0 ] ;
135
+ oldBadImageView . removeFromSuperview ( ) ;
133
136
134
- button . addSubview ( newImageView ) ;
137
+ //Add the new guy
138
+ button . addSubview ( newImageView ) ;
139
+ }
135
140
}
136
141
common . Fab . iconProperty . metadata . onSetNativeValue = onIconPropertyChanged ;
137
142
You can’t perform that action at this time.
0 commit comments