Skip to content

Commit

Permalink
Make Slider and Stepper min/max a struct tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
TimLariviere committed Jan 19, 2022
1 parent 279d906 commit 47a3fac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Fabulous.XamarinForms/ViewUpdaters.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ open Fabulous
open Xamarin.Forms

module ViewUpdaters =
let updateSliderMinMax (newValueOpt: (float * float) voption) (node: IViewNode) =
let updateSliderMinMax (newValueOpt: struct (float * float) voption) (node: IViewNode) =
let slider = node.Target :?> Slider

match newValueOpt with
Expand All @@ -22,7 +22,7 @@ module ViewUpdaters =
slider.SetValue(Slider.MinimumProperty, min)
slider.SetValue(Slider.MaximumProperty, max)

let updateStepperMinMax (newValueOpt: (float * float) voption) (node: IViewNode) =
let updateStepperMinMax (newValueOpt: struct (float * float) voption) (node: IViewNode) =
let stepper = node.Target :?> Stepper

match newValueOpt with
Expand Down
4 changes: 2 additions & 2 deletions src/Fabulous.XamarinForms/Xamarin.Forms.Core.Attributes.fs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ module Switch =

module Slider =
let MinimumMaximum =
Attributes.define<float * float> "Slider_MinimumMaximum" ViewUpdaters.updateSliderMinMax
Attributes.define<struct (float * float)> "Slider_MinimumMaximum" ViewUpdaters.updateSliderMinMax

let Value =
Attributes.defineBindable<float> Xamarin.Forms.Slider.ValueProperty
Expand Down Expand Up @@ -495,7 +495,7 @@ module Stepper =
Attributes.defineBindable<float> Xamarin.Forms.Stepper.IncrementProperty

let MinimumMaximum =
Attributes.define<float * float> "Stepper_MinimumMaximum" ViewUpdaters.updateStepperMinMax
Attributes.define<struct (float * float)> "Stepper_MinimumMaximum" ViewUpdaters.updateStepperMinMax

let Value =
Attributes.defineBindable<float> Xamarin.Forms.Stepper.ValueProperty
Expand Down
4 changes: 2 additions & 2 deletions src/Fabulous.XamarinForms/Xamarin.Forms.Core.fs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ type ViewBuilders private () =
ViewKeys.Slider,
Slider.Value.WithValue(value),
Slider.ValueChanged.WithValue(fun args -> onValueChanged args.NewValue |> box),
Slider.MinimumMaximum.WithValue(min, max)
Slider.MinimumMaximum.WithValue(struct (min, max))
)

static member inline ActivityIndicator<'msg>(isRunning: bool) =
Expand Down Expand Up @@ -398,7 +398,7 @@ type ViewBuilders private () =
ViewKeys.Stepper,
Stepper.Value.WithValue(value),
Stepper.ValueChanged.WithValue(fun args -> onValueChanged args.NewValue |> box),
Stepper.MinimumMaximum.WithValue((min, max))
Stepper.MinimumMaximum.WithValue(struct (min, max))
)

static member inline ListView<'msg, 'itemData, 'itemMarker when 'itemMarker :> ICell>(items: seq<'itemData>) =
Expand Down

0 comments on commit 47a3fac

Please sign in to comment.