-
Notifications
You must be signed in to change notification settings - Fork 3
[Architecture] Add lifecycle events to widget (mount, dismount, create, destroy) #25
Comments
In which order should this happen? Create -> Mount -> Dismount -> Destroy ? |
Yes. I think that's the good order. An example is ListView with virtualization |
Yes that sounds correct. e.g. like a extensionmethod ? StackLayout().onCreate(fun _ => printfn "OnCreate") |
I think instead of lambda we want it to accept a concrete message, or a function that creates a concrete message (in case we need to pass data in). like so StackLayout().onCreate(StackCreated)
// if we need to pass args
StackLayout().onCreate(fun args -> StackCreated args)
|
@SergejDK Yes, an extension method is good. That lambda should return a Contrary to what we do in v1 ( type Msg =
| LabelCreated
let labelRef = ViewRef<_>()
let update msg model =
match msg with
| LabelCreated ->
labelRef.Value.BackgroundColor <- Color.Blue
let view model =
StackLayout() {
Label("Text")
.reference(labelRef)
.onCreate(LabelCreated)
} |
No description provided.
The text was updated successfully, but these errors were encountered: