Merge pull request #6617 from NativeScript/release-5.0.4

Release 5.0.4
This commit is contained in:
Svetoslav
2018-11-26 13:02:26 +02:00
committed by GitHub
5 changed files with 32 additions and 21 deletions

View File

@ -1,3 +1,14 @@
<a name="5.0.4"></a>
## [5.0.4](https://github.com/NativeScript/NativeScript/compare/5.0.3...5.0.4) (2018-11-26)
### Bug Fixes
* **android-fragment:** child already has a parent ([#6589](https://github.com/NativeScript/NativeScript/issues/6589)) ([5b9b335](https://github.com/NativeScript/NativeScript/commit/5b9b335))
* **back-navigation:** app freeze on going back in parent frame with states ([#6595](https://github.com/NativeScript/NativeScript/issues/6595)) ([fc1f8c1](https://github.com/NativeScript/NativeScript/commit/fc1f8c1))
<a name="5.0.3"></a> <a name="5.0.3"></a>
## [5.0.3](https://github.com/NativeScript/NativeScript/compare/5.0.2...5.0.3) (2018-11-20) ## [5.0.3](https://github.com/NativeScript/NativeScript/compare/5.0.2...5.0.3) (2018-11-20)

View File

@ -1,7 +1,7 @@
{ {
"name": "tns-core-modules", "name": "tns-core-modules",
"description": "Telerik NativeScript Core Modules", "description": "Telerik NativeScript Core Modules",
"version": "5.0.3", "version": "5.0.4",
"homepage": "https://www.nativescript.org", "homepage": "https://www.nativescript.org",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -616,7 +616,7 @@ export function goBack(): boolean {
if (parentFrame && parentFrame.canGoBack()) { if (parentFrame && parentFrame.canGoBack()) {
parentFrameCanGoBack = true; parentFrameCanGoBack = true;
} else { } else {
parentFrame = <FrameBase>getAncestor(top, "Frame"); parentFrame = <FrameBase>getAncestor(parentFrame, "Frame");
} }
} }

View File

@ -834,6 +834,24 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
entry.viewSavedState = null; entry.viewSavedState = null;
} }
// fixes 'java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first'.
// on app resume in nested frame scenarios with support library version greater than 26.0.0
// HACK: this whole code block shouldn't be necessary as the native view is supposedly removed from its parent
// right after onDestroyView(...) is called but for some reason the fragment view (page) still thinks it has a
// parent while its supposed parent believes it properly removed its children; in order to "force" the child to
// lose its parent we temporarily add it to the parent, and then remove it (addViewInLayout doesn't trigger layout pass)
const nativeView = page.nativeViewProtected;
if (nativeView != null) {
const parentView = nativeView.getParent();
if (parentView instanceof android.view.ViewGroup) {
if (parentView.getChildCount() === 0) {
parentView.addViewInLayout(nativeView, -1, new org.nativescript.widgets.CommonLayoutParams());
}
parentView.removeView(nativeView);
}
}
return page.nativeViewProtected; return page.nativeViewProtected;
} }
@ -873,24 +891,6 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
traceError(`${fragment}.onDestroy: entry has no resolvedPage`); traceError(`${fragment}.onDestroy: entry has no resolvedPage`);
return null; return null;
} }
// fixes 'java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first'.
// on app resume in nested frame scenarios with support library version greater than 26.0.0
// HACK: this whole code block shouldn't be necessary as the native view is supposedly removed from its parent
// right after onDestroyView(...) is called but for some reason the fragment view (page) still thinks it has a
// parent while its supposed parent believes it properly removed its children; in order to "force" the child to
// lose its parent we temporarily add it to the parent, and then remove it (addViewInLayout doesn't trigger layout pass)
const nativeView = page.nativeViewProtected;
if (nativeView != null) {
const parentView = nativeView.getParent();
if (parentView instanceof android.view.ViewGroup) {
if (parentView.getChildCount() === 0) {
parentView.addViewInLayout(nativeView, -1, new org.nativescript.widgets.CommonLayoutParams());
}
parentView.removeView(nativeView);
}
}
} }
@profile @profile

View File

@ -1,6 +1,6 @@
{ {
"name": "tns-platform-declarations", "name": "tns-platform-declarations",
"version": "5.0.3", "version": "5.0.4",
"description": "Platform-specific TypeScript declarations for NativeScript for accessing native objects", "description": "Platform-specific TypeScript declarations for NativeScript for accessing native objects",
"main": "", "main": "",
"scripts": { "scripts": {