-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
From @NickIliev on September 14, 2018 14:5
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 a siingle image that holds the nsrouterlink navigaiton..
-
Navigate to the info page by pressing the image 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,
}
}
)Copied from original issue: NativeScript/nativescript-angular#1516