Skip to content

Commit 621e7e6

Browse files
committed
Revert "fix: fix HMR issue on Android (nativescript-vue#461)" as it does not work with {N}-5.2 but works with {N}-5.3
This reverts commit 595d2a0.
1 parent c6e9dcf commit 621e7e6

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

platform/nativescript/runtime/components/frame.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,32 @@ export default {
157157

158158
// replace the controllers instead of pushing directly
159159
frame._ios.controller.setViewControllersAnimated(newControllers, false)
160+
} else {
161+
const frameId = frame._android.frameId
162+
frame._isBack = false
163+
backstackEntry.frameId = frameId
164+
165+
const manager = frame._getFragmentManager()
166+
const currentEntry = frame._currentEntry
167+
168+
const newFragmentTag = `fragment${frameId}[-1]`
169+
const newFragment = frame.createFragment(backstackEntry, newFragmentTag)
170+
const animated = false
171+
const navigationTransition = null
172+
173+
const transaction = manager.beginTransaction()
174+
_setAndroidFragmentTransitions(
175+
animated,
176+
navigationTransition,
177+
currentEntry,
178+
backstackEntry,
179+
transaction,
180+
frameId
181+
)
182+
transaction.remove(currentEntry.fragment)
183+
transaction.replace(frame.containerViewId, newFragment, newFragmentTag)
184+
transaction.commitAllowingStateLoss()
160185
}
161-
// Note: in the Android platform there is nothing to do, as the
162-
// page is able to change without the need of replacing the last
163-
// navigation entry
164-
165-
// reset HMR checking flag
166186
resetHMRChecking()
167187
},
168188

platform/nativescript/runtime/components/list-view.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default {
5151

5252
mounted() {
5353
if (!this.$templates) {
54-
return
54+
return;
5555
}
5656

5757
this.$refs.listView.setAttribute(
@@ -69,9 +69,9 @@ export default {
6969
},
7070
onItemLoading(args) {
7171
if (!this.$templates) {
72-
return
72+
return;
7373
}
74-
74+
7575
const index = args.index
7676
const items = args.object.items
7777

0 commit comments

Comments
 (0)