diff --git a/packages/core/accessibility/index.ios.ts b/packages/core/accessibility/index.ios.ts index 3d0945eaf..758a9fb11 100644 --- a/packages/core/accessibility/index.ios.ts +++ b/packages/core/accessibility/index.ios.ts @@ -73,18 +73,18 @@ function ensureNativeClasses() { ]); nativeFocusedNotificationObserver = Application.ios.addNotificationObserver(UIAccessibilityElementFocusedNotification, (args: NSNotification) => { - const uiView = args.userInfo.objectForKey(UIAccessibilityFocusedElementKey) as UIView; - if (!uiView.tag) { + const uiView = args.userInfo?.objectForKey(UIAccessibilityFocusedElementKey) as UIView; + if (!uiView?.tag) { return; } const rootView = Application.getRootView(); // We use the UIView's tag to find the NativeScript View by its domId. - let view = rootView.getViewByDomId(uiView.tag); + let view = rootView.getViewByDomId(uiView?.tag); if (!view) { for (const modalView of >rootView._getRootModalViews()) { - view = modalView.getViewByDomId(uiView.tag); + view = modalView.getViewByDomId(uiView?.tag); if (view) { break; }