Repository navigation
Closed
Labels
Description
Working with next of tns-core-modules and nativescript-angular and navigating withnsRouterLink and then back with the hardware button is causing a crash.
Steps to reproduce:
-
Use this demo branch
-
Load the app and the initial page will load with a closed sidedrawer. Navigation through the sidedrawer and back (to "Details") is working as expected.
-
Navigate to the same details page via nsRouterLink by pressing the page upper content and then navigate back and the application will crash with:
JS: NavigationEnd(id: 4, url: '/info', urlAfterRedirects: '/info/app-info')
JS: NavigationEnd(id: 4, url: '/info', urlAfterRedirects: '/info/app-info')
JS: Router Event: Scroll
JS: Scroll(anchor: 'null', position: 'null')
JS: Scroll(anchor: 'null', position: 'null')
System.err: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
System.err: at android.view.ViewGroup.addViewInner(ViewGroup.java:5122)
System.err: at android.view.ViewGroup.addView(ViewGroup.java:4953)
System.err: at android.view.ViewGroup.addView(ViewGroup.java:4893)
System.err: at android.view.ViewGroup.addView(ViewGroup.java:4866)
System.err: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1425)
System.err: at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1750)
System.err: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1819)
System.err: at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797)
System.err: at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2590)
System.err: at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2377)
System.err: at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2332)
System.err: at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2239)
System.err: at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:700)
...
package.json content using next
"dependencies": {
"@angular/common": "~6.1.0",
"@angular/compiler": "~6.1.0",
"@angular/core": "~6.1.0",
"@angular/forms": "~6.1.0",
"@angular/http": "~6.1.0",
"@angular/platform-browser": "~6.1.0",
"@angular/platform-browser-dynamic": "~6.1.0",
"@angular/router": "~6.1.0",
"nativescript-angular": "^6.2.0-2018-09-14-01",
"nativescript-app-center": "^1.0.3",
"nativescript-cardview": "^3.1.1",
"nativescript-permissions": "^1.2.3",
"nativescript-plugin-firebase": "^6.8.1",
"nativescript-social-share": "^1.5.1",
"nativescript-theme-core": "^1.0.4",
"nativescript-ui-sidedrawer": "^4.3.0",
"reflect-metadata": "~0.1.8",
"rxjs": "^6.0.0",
"tns-core-modules": "^4.3.0-2018-09-14-01",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular/compiler-cli": "~6.1.0",
"@ngtools/webpack": "~6.2.0",
"nativescript-dev-typescript": "~0.7.3",
"nativescript-dev-webpack": "^0.17.0-2018-09-14-01",
"tns-platform-declarations": "^4.2.0",
"typescript": "~2.7.2"
},The above case is working as expected with official versions of nativescript-angular and tns-core-modules. The navigation also works when routerExtensions is used ins tead of nsRouterLink
Workaround
this._routerExtensions.navigate(
[path], {
transition: {
name: "fade",
duration: 300,
}
}
)
Activity
[-]Navigation via nsRouterLink and back crashing the native back navigation[/-][+][Next] Navigation via nsRouterLink and back crashing the native back navigation[/+]NickIliev commentedon Sep 25, 2018
Issue reproducible only on Android (works as expected on iOS).
A simplified scenario to reproduce the case in this branch.
Steps to reproduce:
nsRouterLinkNickIliev commentedon Sep 25, 2018
Reported here as well.
NickIliev commentedon Sep 27, 2018
Possibly related to the usage of the Android Fragment Manager as the issue is now reproducible with Core projects
[-][Next] Navigation via nsRouterLink and back crashing the native back navigation[/-][+][Next] Back Navigation crashing the app w/ The specified child already has a parent[/+]NickIliev commentedon Sep 27, 2018
This issue was moved to NativeScript/NativeScript#6312