From 67100103339848a622a456c334f6bae4fe771951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9=20Larivi=C3=A8re?= Date: Fri, 17 Apr 2020 10:02:09 +0200 Subject: [PATCH 1/2] 0.53 migration guide --- docs/Fabulous.XamarinForms/contents-views.md | 1 + .../migration-guide-to-0.53.md | 83 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 docs/Fabulous.XamarinForms/migration-guide-to-0.53.md diff --git a/docs/Fabulous.XamarinForms/contents-views.md b/docs/Fabulous.XamarinForms/contents-views.md index 045509d42..75cb93262 100644 --- a/docs/Fabulous.XamarinForms/contents-views.md +++ b/docs/Fabulous.XamarinForms/contents-views.md @@ -24,4 +24,5 @@ * [Tools](tools.html) * [Migration guide from v0.36 to v0.40](migration-guide-to-0.40.html) * [Migration guide from v0.43 to v0.50](migration-guide-to-0.50.html) +* [Migration guide from v0.52 to v0.53](migration-guide-to-0.53.html) * [Further Resources](index.html#further-resources) diff --git a/docs/Fabulous.XamarinForms/migration-guide-to-0.53.md b/docs/Fabulous.XamarinForms/migration-guide-to-0.53.md new file mode 100644 index 000000000..42bfaec57 --- /dev/null +++ b/docs/Fabulous.XamarinForms/migration-guide-to-0.53.md @@ -0,0 +1,83 @@ +Fabulous for Xamarin.Forms - Guide +======= + +{% include_relative contents.md %} + +Migrating from v0.52 to v0.53 +-------- + +Fabulous.XamarinForms 0.53 added the support for Xamarin.Forms 4.5, along with the new MediaElement control. +Take a look at [Xamarin.Forms 4.5 release notes](https://docs.microsoft.com/en-us/xamarin/xamarin-forms/release-notes/4.5/4.5.0) to know what changed. + +This MediaElement control uses `MediaSource` to load videos. +Since `ImageSource` and `MediaSource` are very close in usage and yet different, we introduced some renaming in Fabulous.XamarinForms to avoid naming collision. + +### `Image.Path` becomes `Image.ImagePath`, or just `ImagePath` + +Previously when loading an image from the file system, or from an URI, you would use `Image.Path` or just `Path` (this discriminated union name `Image` could be omitted). +To avoid collision with loading a video from a file system/URI, `Path` was renamed to `ImagePath`. Videos use `MediaPath`. + +_Old:_ +```fsharp +View.Image( + Source = Path "path/to/image.png" +) +``` + +_New:_ +```fsharp +View.Image( + Source = ImagePath "path/to/image.png" +) + +View.MediaElement( + Source = MediaPath "path/to/video.mp4" +) +``` + +### `Image.Byte` becomes `Image.ImageBytes` + +Previously when loading an image from a byte array, you would use `Image.Bytes` or just `Bytes` (this discriminated union name `Image` could be omitted). +To avoid future collision with loading a video and having consistent naming, `Bytes` was renamed to `ImageBytes`. + +_Old:_ +```fsharp +View.Image( + Source = Bytes myByteArray +) +``` + +_New:_ +```fsharp +View.Image( + Source = ImageBytes myByteArray +) +``` + +### `Image.Source` becomes `Image.ImageSource`, or just `ImageSource` + +Previously when loading an image from a custom Xamarin.Forms.ImageSource, you would use `Image.Source` or just `Source` (this discriminated union name `Image` could be omitted). +To avoid collision with loading a video from a custom Xamarin.Forms.ImageSource, `Source` was renamed to `ImageSrc` (abbreviated to avoid collision with `Xamarin.Forms.ImageSource`). Videos use `MediaSrc`. + +_Old:_ +```fsharp +let getImageSource() = ... + +View.Image( + Source = Source (getImageSource()) +) +``` + +_New:_ +```fsharp +let getImageSource() = ... +let getMediaSource() = ... + +View.Image( + Source = ImageSrc (getImageSource()) +) + +View.MediaElement( + Source = MediaSrc (getImageSource()) +) +``` \ No newline at end of file From e8fdc1a28b6466d05fbf9f72ecb5504a594fd0fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9=20Larivi=C3=A8re?= Date: Fri, 17 Apr 2020 10:04:00 +0200 Subject: [PATCH 2/2] Fix typo --- docs/Fabulous.XamarinForms/migration-guide-to-0.53.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Fabulous.XamarinForms/migration-guide-to-0.53.md b/docs/Fabulous.XamarinForms/migration-guide-to-0.53.md index 42bfaec57..e684e834a 100644 --- a/docs/Fabulous.XamarinForms/migration-guide-to-0.53.md +++ b/docs/Fabulous.XamarinForms/migration-guide-to-0.53.md @@ -78,6 +78,6 @@ View.Image( ) View.MediaElement( - Source = MediaSrc (getImageSource()) + Source = MediaSrc (getMediaSource()) ) ``` \ No newline at end of file