-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Shell and BackButtonBehaviour/OnBackButtonPressed #14
Comments
Hello @gaelian Unfortunately Shell is only partially supported in Fabulous for technical reasons, so I would recommend against using it for the moment. Regarding your question,
e.g. View.Shell(
items = [
View.ShellContent(
content = View.ContentPage(
shellBackButtonBehavior = View.BackButtonBehavior(
command = fun () -> dispatch BackButtonClicked
)
)
)
]
) |
Hi @TimLariviere, I appreciate the quick response. I have been looking quite intently at the Fabimals example app, do I understand correctly in that the workarounds displayed in the source for that app represent the partial support you allude to (e.g. Routes.fs, etc)? If so, I'm hoping that I can still make it work, as otherwise, Shell seems quite perfect for what I'm trying to do. Beyond what is shown in Fabimals, are there any other "gotchas" that one should be aware of when using Shell with Fabulous? |
Yes. The thing with Shell is that it has its own routing mechanism that prevents Fabulous from knowing what's happening. Also if you need to pass parameters to a page you're navigating to (e.g. Hence the need for a custom |
Ah, I see. That's very good to know. Yes, that's probably a show stopper on using Shell for me. Too bad. :( But just out of interest, one more Shell question: I note in the Shell documentation they discuss efficient page loading. Is this something that Fabulous can or at some point will be able to take advantage of? Taking your previous example... View.Shell(
items = [
View.ShellContent(
content = View.ContentPage(
shellBackButtonBehavior = View.BackButtonBehavior(
command = fun () -> dispatch BackButtonClicked
)
)
)
]
) Is use of the |
Yes, it's already using it. |
That's great. So wishing I could use Shell right now. You're doing a great job with this stuff, Tim. I'm really liking Fabulous now that I'm somewhat past F# breaking my brain. I look forward to seeing the Xamarin guys hopefully making Shell more accessible to Fabulous in the future. |
I you want to "hijack" the "hardware backbutton", you can use the navigating-event from the shell. If you don't want that the app will be closed und "e.Cancel()" to stop and implement a behaviour you want. The "e.Source" is something with "ShellXXXX.Pop" (Enum) in case you press the android back button. Don't know anything about iOS. But maybe you can uses this instead of the override backbutton thingy. At least it works for me. |
Is there a way to "hijack" the back button behavior when NOT using a shell? i.e., just using a NavigationPage with a ContentPage child? |
Question / Discussion
New to Fabulous. I'm using the XF Shell for a Fabulous XF app I'm writing, currently attempting to understand how one would use BackButtonBehaviour and OnBackButtonPressed in the Fabulous DSL.
I've gotten this far:
Or perhaps this far:
Similarly, I'm not sure how to override OnBackButtonPressed in the context of Fabulous. Can anyone provide some example code?
The text was updated successfully, but these errors were encountered: