From d1b99e565ffd1912d89d0a54f37c086a960ea21a Mon Sep 17 00:00:00 2001 From: felixkrautschuk Date: Wed, 29 Mar 2023 15:50:01 +0200 Subject: [PATCH] fix(ios): crash "Cannot read properties of undefined (reading '0')" --- src/fab.ios.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fab.ios.ts b/src/fab.ios.ts index 426f9fc..41bf2b9 100644 --- a/src/fab.ios.ts +++ b/src/fab.ios.ts @@ -23,8 +23,8 @@ export class Fab extends FloatingActionButtonBase { if (newImageView !== null) { // Kill the old Image, cocoapod doesn't support changing it yet - const button = this.nativeView.subviews[0] as MNFloatingActionButton; - const oldBadImageView = button.subviews[0]; // this should be the image view inside the MNFloatingActionButton + const button = this.nativeView.subviews.objectAtIndex(0) as MNFloatingActionButton; + const oldBadImageView = button.subviews.objectAtIndex(0); // this should be the image view inside the MNFloatingActionButton oldBadImageView.removeFromSuperview(); // Add the new image to the button @@ -61,8 +61,8 @@ export class Fab extends FloatingActionButtonBase { const width = frame.size.width as number; const height = frame.size.height as number; - const button = this.nativeView.subviews[0] as MNFloatingActionButton; - const imageView = button.subviews[0]; // should be the image view inside the MNFloatingActionButton + const button = this.nativeView.subviews.objectAtIndex(0) as MNFloatingActionButton; + const imageView = button.subviews.objectAtIndex(0); // should be the image view inside the MNFloatingActionButton imageView.contentMode = UIViewContentMode.ScaleAspectFit; imageView.frame = CGRectMake(0, 0, width / 2, height / 2);