-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Hi Mr. Larivière,
I recently started to use Fabulous with .NET MAUI, but I cannot get the View.map function working.
ChatGPT didn't get me any further and I didn't receive a response yet on my question on StackOverFlow.
Do you have some documentation on View.map or NavigationPage or do you know why it fails for me?
P.S here is my question from StackOverflow:
I want to write an app in F# Fabulous.MAUI and follow the example from Fabulous where each page is written in a separate file.
I used the template from Fabulous.MAUI in app.fs but reduced it to two widgets: a label and a button.
The below code is in app.fs
open Fabulous
open Fabulous.Maui
open Microsoft.Maui
open Microsoft.Maui.Accessibility
open type Fabulous.Maui.View
module App =
type Model = {
FirstpageModel: firstpage.Model
}
type Msg =
| FirstPageMsg of firstpage.Msg
let init () = {
FirstpageModel = firstpage.init ()
}
let update msg model =
match msg with
| FirstPageMsg f1 -> { model with FirstpageModel = firstpage.update f1 model.FirstpageModel }
let view model =
NavigationPage () {
View.map FirstPageMsg (firstpage.view model.FirstpageModel)
}
let program = Program.stateful init update view
The code in FirstPage.fs file is:
module firstpage
open Fabulous
open Fabulous.Maui
open Microsoft.Maui.Accessibility
open Microsoft.Maui
open type Fabulous.Maui.View
type Model = { Name: string }
type Msg = | Clicked
let init () = { Name = "Alex"}
let update msg model =
match msg with
| Clicked -> { model with Name = "Verca"}
let view model =
Application(
ContentPage(
(VStack (spacing =25.) {
Label($"Hello, {model.Name}")
.semantics(SemanticHeadingLevel.Level1)
.font(size = 32.)
.centerTextHorizontal()
Button("Click", Clicked)
})
)
)
The error I receive is in the file app.fs on line View.map FirstPageMsg (firstpage.view model.FirstpageModel).
The error in this line:
No overloads match for method 'Yield'