File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,17 +110,14 @@ function onIconPropertyChanged(data) {
110110 var icon = data . newValue ;
111111 var iconDrawable = null ;
112112
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+
117114 var newImageView = null ;
118115
119116 if ( ImageSource . isFileOrResourcePath ( icon ) ) {
120117 iconDrawable = ImageSource . fromFileOrResource ( icon ) ;
121118
122119 //Set the new one
123- if ( iconDrawable ) {
120+ if ( iconDrawable !== null ) {
124121 newImageView = UIImageView . alloc ( ) . initWithImage ( iconDrawable . ios ) ;
125122 }
126123 } else {
@@ -130,8 +127,16 @@ function onIconPropertyChanged(data) {
130127 newImageView . frame = CGRectMake ( 0 , 0 , 40 , 40 ) ; //resize
131128
132129 }
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 ( ) ;
133136
134- button . addSubview ( newImageView ) ;
137+ //Add the new guy
138+ button . addSubview ( newImageView ) ;
139+ }
135140}
136141common . Fab . iconProperty . metadata . onSetNativeValue = onIconPropertyChanged ;
137142
You can’t perform that action at this time.
0 commit comments