Skip to content

Commit

Permalink
Add missing yields
Browse files Browse the repository at this point in the history
  • Loading branch information
TimLariviere committed Feb 2, 2023
1 parent d61f6f4 commit 82e8a69
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
namespace Fabulous.Maui.Compatibility

open System.Runtime.CompilerServices
open Fabulous
open Fabulous.StackAllocatedCollections
open Microsoft.Maui

type IFabCompatLayoutOfView =
inherit IFabCompatLayout

module CompatLayoutOfView =
let Children =
Attributes.defineListWidgetCollection "LayoutOfWidget_Children" (fun target -> (target :?> Microsoft.Maui.Controls.Layout).Children)

[<Extension>]
type CollectionBuilderExtensions =
[<Extension>]
static member inline Yield
(
_: CollectionBuilder<'msg, #IFabCompatLayoutOfView, IView>,
x: WidgetBuilder<'msg, 'itemType>
) : Content<'msg> =
{ Widgets = MutStackArray1.One(x.Compile()) }

[<Extension>]
static member inline Yield
(
_: CollectionBuilder<'msg, #IFabCompatLayoutOfView, IView>,
x: WidgetBuilder<'msg, Memo.Memoized<#IView>>
) : Content<'msg> =
{ Widgets = MutStackArray1.One(x.Compile()) }
21 changes: 20 additions & 1 deletion src/Fabulous.Maui/Compatibility/Views/_CompatView.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ namespace Fabulous.Maui.Compatibility
open System.Runtime.CompilerServices
open Fabulous
open Fabulous.Maui
open Fabulous.StackAllocatedCollections
open Microsoft.Maui
open Microsoft.Maui.Controls

Expand Down Expand Up @@ -84,4 +85,22 @@ type CompatViewModifiers =

[<Extension>]
static member inline gestureRecognizers<'msg, 'marker when 'marker :> IFabCompatView>(this: WidgetBuilder<'msg, 'marker>) =
WidgetHelpers.buildAttributeCollection<'msg, 'marker, IGestureRecognizer> CompatView.GestureRecognizers this
WidgetHelpers.buildAttributeCollection<'msg, 'marker, IFabCompatGestureRecognizer> CompatView.GestureRecognizers this

[<Extension>]
type CompatViewYieldExtensions =
[<Extension>]
static member inline Yield
(
_: AttributeCollectionBuilder<'msg, #IFabCompatView, IFabCompatGestureRecognizer>,
x: WidgetBuilder<'msg, #IFabCompatGestureRecognizer>
) : Content<'msg> =
{ Widgets = MutStackArray1.One(x.Compile()) }

[<Extension>]
static member inline Yield
(
_: AttributeCollectionBuilder<'msg, #IFabCompatView, IFabCompatGestureRecognizer>,
x: WidgetBuilder<'msg, Memo.Memoized<#IFabCompatGestureRecognizer>>
) : Content<'msg> =
{ Widgets = MutStackArray1.One(x.Compile()) }
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
namespace Fabulous.Maui

open System.Runtime.CompilerServices
open Microsoft.Maui
open Microsoft.Maui.Graphics
open Microsoft.Maui.Handlers.Defaults
open Fabulous
open Fabulous.Maui.Controls

module ButtonStroke =
let CornerRadius =
Expand Down

0 comments on commit 82e8a69

Please sign in to comment.