| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7df8038 commit db33cf3
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -200,17 +200,17 @@ function initializeNativeClasses() { | |||
| 200 | 200 | } | |
| 201 | 201 | ||
| 202 | 202 | finishUpdate(container: android.view.ViewGroup): void { | |
| 203 | - if (this.mCurTransaction != null) { | ||
| 204 | - (<any>this.mCurTransaction).commitNowAllowingStateLoss(); | ||
| 205 | - this.mCurTransaction = null; | ||
| 206 | - } | ||
| 203 | + this._commitCurrentTransaction(); | ||
| 207 | 204 | } | |
| 208 | 205 | ||
| 209 | 206 | isViewFromObject(view: android.view.View, object: java.lang.Object): boolean { | |
| 210 | 207 | return (<android.support.v4.app.Fragment>object).getView() === view; | |
| 211 | 208 | } | |
| 212 | 209 | ||
| 213 | 210 | saveState(): android.os.Parcelable { | |
| 211 | + // Commit the current transaction on save to prevent "No view found for id 0xa" exception on restore. | ||
| 212 | + // Related to: https://github.com/NativeScript/NativeScript/issues/6466 | ||
| 213 | + this._commitCurrentTransaction(); | ||
| 214 | 214 | return null; | |
| 215 | 215 | } | |
| 216 | 216 | ||
@@ -221,8 +221,15 @@ function initializeNativeClasses() { | |||
| 221 | 221 | getItemId(position: number): number { | |
| 222 | 222 | return position; | |
| 223 | 223 | } | |
| 224 | - } | ||
| 225 | 224 | ||
| 225 | + private _commitCurrentTransaction() { | ||
| 226 | + if (this.mCurTransaction != null) { | ||
| 227 | + this.mCurTransaction.commitNowAllowingStateLoss(); | ||
| 228 | + this.mCurTransaction = null; | ||
| 229 | + } | ||
| 230 | + } | ||
| 231 | + } | ||
| 232 | + | ||
| 226 | 233 | PagerAdapter = FragmentPagerAdapter; | |
| 227 | 234 | } | |
| 228 | 235 | ||
@@ -713,4 +720,4 @@ function tryCloneDrawable(value: android.graphics.drawable.Drawable, resources: | |||
| 713 | 720 | } | |
| 714 | 721 | ||
| 715 | 722 | return value; | |
| 716 | - } | ||
| 723 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments