Problem with ui/frame on getFragmentCallbacks
See original GitHub issuePlease, provide the details below:
Application crashes when navigating back on several views really fast and with the activityBackPressedEvent cancelling the back button on first view.
Did you verify this is a real problem by searching [Stack Overflow]
Yes, I’ve searched and couldn’t find anything.
Tell us about the problem
I’ve created an app with some views and I need to block the back button ONLY on the first view with the activityBackPressedEvent. Basically I’ve done this on the navigatedTo function of the first view:
mainPage = args.object;
if(app.android) {
app.android.on(app.AndroidApplication.activityBackPressedEvent, backEvent);
}
And on the backEvent function I’ve put:
function backEvent(args) {
var currentPage = frameModule.topmost().currentPage;
if(mainPage == currentPage)
args.cancel = true;
}
Basically it works as expected except when I’m on view 5 and click several times on the back button, that’s when the app crashes:
Which platform(s) does your issue occur on?
Android
Please provide the following version numbers that your issue occurs with:
- CLI: 3.2.1
- Cross-platform modules: ~3.2.0
- Runtime(s): 3.2.0
Please tell us how to recreate the issue in as much detail as possible.
Create some views and the navigation between them like View 1 --> View 2 --> View 3 --> View 4 --> View 5 and click on the back button really fast a lot of times. Also, insert the code I’ve put on the description of my problem in the code of first view.
Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.
Already on the description of the problem.
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (7 by maintainers)
@pedromareis This should be fixed in master branch and will be included in 3.4 If possible please try it with @next of tns-core-modules and ping me back if issue is still present.
@tsonevn well, from what I see in the gif I don’t think you’re doing it exactly like I did… The problem only occurs if you tap quickly on the back button and multiple times. Could you try that?
Basically I don’t even give the app time to process all the taps on the back button and the app eventually crashes because of that.