Skip to content

Commit f6fd8b6

Browse files
committed
fix(activityindicator): ios crash on closing page
1 parent 57266a4 commit f6fd8b6

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/activityindicator/index.ios.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,16 @@ export class ActivityIndicator extends ActivityIndicatorBase {
3333

3434
private updateStrokeRadius(width: number, height: number) {
3535
// radius is maxed to 72
36-
const min = Math.min(Math.min(width, height), 144);
37-
const strokeWidth = min / 25;
38-
const scale = Screen.mainScreen.scale;
36+
const nativeView = this.nativeViewProtected;
37+
if (nativeView) {
38+
const min = Math.min(Math.min(width, height), 144);
39+
const strokeWidth = min / 25;
40+
const scale = Screen.mainScreen.scale;
3941

40-
const radius = min / 2 - strokeWidth / 2;
41-
this.nativeViewProtected.strokeWidth = strokeWidth;
42-
this.nativeViewProtected.radius = radius / scale;
42+
const radius = min / 2 - strokeWidth / 2;
43+
nativeView.strokeWidth = strokeWidth;
44+
nativeView.radius = radius / scale;
45+
}
4346
}
4447

4548
public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void {

0 commit comments

Comments
 (0)