TypeError: Cannot read property 'getFragmentManager' of undefined

235 Views Asked by At

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'getFragmentManager' of undefined. This error is popping when I run my nativescript angular application. It says something wrong in my account.component.ts. Why this error is occurs and how to fix this issue?

Click here to see error image

Give any solution for this issue.

ts file:

ngOnInit(){

    if (isAndroid) {
            
            
             const dialogFragment = application.android.foregroundActivity.getFragmentManager().findFragmentByTag("dialog");
            
            if (dialogFragment) {
                utils.ad.dismissSoftInput(dialogFragment.getDialog().getCurrentFocus());
            } else {
                utils.ad.dismissSoftInput();
            }
     }
}

1

There are 1 best solutions below

0
On

Is seems your problem is discussed here: https://github.com/NativeScript/NativeScript/issues/5307