reactiveui / sextant Goto Github PK
View Code? Open in Web Editor NEWA ReactiveUI navigation library for Xamarin.Forms
License: MIT License
A ReactiveUI navigation library for Xamarin.Forms
License: MIT License
Is your feature request related to a problem? Please describe.
Currently Sextant don't support Xamarin.Forms.Shell and neither does shell support any MVVM Framework.
Describe the solution you'd like
Once a solution is born from this issue: xamarin/Xamarin.Forms#5166
I suggest to discuss this with the Xamarin team to see how we can make our life easier.
Describe alternatives you've considered
Describe suggestions on how to achieve the feature
Additional context
AFAIK they are still working on a specification and that should be share soon, so let's be ready to participate.
When I do PushModal from my viewmodel, the modal shows just fine. But as a good citizen I added a "Close" Toolbar button in the top right corner so that the user can opt out of the modal. The button is never shown because the modal doesn't have a NavigationPage.
I've used similiar frameworks before and I think MvvmCross has an option to "WrapInNavigationPage" when pushing modals.
An alternate solution would perhaps be to do this by using interactions, but that might trick the IViewStackService
There should be an option to wrap it in a NavigationPage.
Additional context
Screenshot nr 2 is the modal page without the NavigationBar.
Describe the bug
After creating a new project with Xamarin.Forms and Sextant 1.6 I get this error
Could not resolve type with token 01000005 from typeref (expected class 'Sextant.SextantHelper' in assembly 'Sextant, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null')
If I downgrade to 1.5.5 everything works.
Steps To Reproduce
@RLittlesII already created a sample that shows the issue: https://github.com/RLittlesII/Sextant.Sample
Expected behavior
No errors :)
Screenshots
Environment
Additional context
It's a mess right now. Plain and simple.
Break into folders, separate classes into responsibilities and think into how I wanna to approach it in the future.
Maybe extract the Xamarin.Forms to another project so other platforms could be used instead?
I want to have a reusable viewmodel that can emit results back to the calling viewmodel.
If we can get something like a NavigateForResult
with a generic type then that would be neat. Interactions are great but I believe they are best for very simple dialogs and simple results. What about a complex object? What if it's prompted as a popup, but as a full page? Yes we can subscribe to events from the ViewModel before passing it through to Navigate.Execute()
but that just returns a IRoutableViewModel
object and will make the pipeline less neat :D
ChooseContacts = ReactiveCommand.CreateFromObservable(() =>
HostScreen.Router.NavigateForResult.Execute(new ContactsResultViewModel())
.Select(contacts => /* transform result */));
We can do it by making a generic IRoutableViewModel<TResult>
so the routing commands can listen to it's result.
Is your feature request related to a problem? Please describe.
Currently there is a need to depend on Xamarin.Forms in order to use Sextant.
Describe the solution you'd like
I think moving forward we will need to move the Xamarin.Forms implementation into a Sextant.XamForms
library. This will allow us to target other platforms easier with the root namespace Sextant
, similar to what we do with ReactiveUI.Events
packages.
I just started experimenting with routing (UWP app), so while I have fresh eyes, some thoughts:
RoutingState
to Router
"Routing state" implies a container of state data rather than a class responsible for navigation actions. "Router" seems a better name for a class that actually handles routing. This is further reinforced by the fact that even on the IScreen
interface, the RoutingState
property name is "Router". IMO, Router
is both more apt and concise.
Today, we have a handful of commands hanging off RoutingState
along with a ObservableCollection called "NavigationStack" (note that here it's not even a stack in the data structures sense of the term). It would be better to introduce a new class, NavigationStack
with the following signature:
public class NavigationStack
{
ReactiveCommand<Unit> Advance { get; }
ReactiveCommand<Unit> Backtrack { get; }
IRoutableViewModel Current { get; }
}
This would leave no ambiguity about what the commands do. If there is value in it, the class can implement ObservableCollection to enable subscribing to notifications. Router
would then have a read-only property named NavigationStack
.
Is there value in Navigate being a command? Writing router.Navigate.Execute(vm)
feels clunky. Would be better to have Navigate
be a method, and have a companion Navigating
observable property on Router
. Another benefit is that the method can have an (optional) bool reset
attribute, thus letting us drop the NavigateAndReset
command on Router
.
When you have a NavigationViewModel + ViewModel and call a PushModal, Sextant is instantiating the VM twice.
That's because the way the NavigationView(Model) and regular View(Model)s are registered in the factory.
Is your feature request related to a problem? Please describe.
Sextant is a navigation library built for Xamarin.Forms. A few Xamarin.Forms projects I have used have had RgPopup implemented for use. Currently there is a separate navigation structure for the pop up pages.
Describe the solution you'd like
I would like to create a Sextant.RgPopup package that explicitly brings https://github.com/rotorgames/Rg.Plugins.Popup into Sextant and handles some of the boilerplate code to get it up and running.
Describe alternatives you've considered
The alternative I have is re implement this same package under my own name and use it. I have already done this for a few projects and would like a centralized standard place to keep this up to date.
Describe suggestions on how to achieve the feature
Wrap the provided IPopupNavigation
in all the Sextant goodness.
Additional context
Other MVVM Frameworks that support XF have a plugin for this package for XF.
The current version of the app is pretty much TPL with no direct support to Rx.
Blazor has a basic navigation stack, you provide a interface you can override. Investigate if it's worth overriding.
Add nuspec attributes to csproj for nuget metadata
It just (don't) work.
Describe the bug
package 1.5.5 works as expected in iOS
package 1.6.1 with Linker behavior (Link Framework SDK's only)
Fails to build
MTOUCH : error MT2101: Can't resolve the reference 'Sextant.NavigationView Sextant.SextantHelper::Initialize(System.Reactive.Concurrency.IScheduler,System.Reactive.Concurrency.IScheduler,ReactiveUI.IViewLocator)', referenced from the method 'System.Void XXX.App::.ctor()' in 'Sextant, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null'.
package 1.6.1 with Linker behavior (Don't Link)
Crashes on Startup with System.TypeLoadException has been thrown Sextant.SextantHelper
The iOS dll is getting loaded instead of the .netstandard also if configured:
<ItemGroup>
<Reference Include="Sextant">
<HintPath>$(NugetPackagesPath)\sextant\1.6.1\lib\netstandard2.0\Sextant.dll</HintPath>
</Reference>
</ItemGroup>
Environment
Updating above Sextant 1.7.3 throws an exception if page is pushed modal on android and ios (Tested by debugging on Simulator/Emulator)
The Exception is: "Page must not already have a parent..."
See small testproject updated with myget sextant:
bochos-bln/TabbedPageSextantSample@cf9f5aa
Steps To Reproduce
Start the App, press "First Modal Button"
Expected behavior
Modal Page Pushed (like with Sextant 1.7.3
... but App Crashes
Environment
Additional context
Describe the bug
PopToRoot
doesn't clear the navigation stack. It only clears the View
.
Expected behavior
When PopToRoot
is called the ViewStackService.PageStack
should clear
Be useful to add the concept of animation/non-animated support stacks in their own interface.
Feature Request
I would like to achieve the following behavior:
Once I navigate to a page, I would like to remove the previous page from the stack. Something like
this
.HostScreen
.Router
.NavigateAndRemovePrevious
.Execute(targetViewModel)
.Subscribe()
.DisposeWith(Subscriptions);
What is the current behavior?
I tried mimicking this behavior by manually removing the previous entry from the Router's NavigationStack but that resulted in an animated back navigation then forward navigation to my target vm.
Investigate if uno requires anything beyond the basic UWP and adding support for it. This will have a dependency on UWP support.
Is your feature request related to a problem? Please describe.
Add benchmark dotnet to the repository.
Describe the bug
When running ./build.sh
on a local Mac I get the error
/[redacted]/ReactiveUI/sextant/tools/ReactiveUI.Cake.Recipe.1.0.88/parameters.cake(147,45): error CS1061: 'ITFBuildProvider' does not contain a definition for 'IsRunningOnAzurePipelinesHosted' and no accessible extension method 'IsRunningOnAzurePipelinesHosted' accepting a first argument of type 'ITFBuildProvider' could be found (are you missing a using directive or an assembly reference?)
/[redacted]/sextant/tools/ReactiveUI.Cake.Recipe.1.0.88/parameters.cake(147,100): error CS1061: 'ITFBuildProvider' does not contain a definition for 'IsRunningOnAzurePipelines' and no accessible extension method 'IsRunningOnAzurePipelines' accepting a first argument of type 'ITFBuildProvider' could be found (are you missing a using directive or an assembly reference?)
Steps To Reproduce
./build.sh
Expected behavior
A successful build.
Screenshots
Environment
Additional context
Hi, I spotted an issue when I try to implement "AbsoluteLayout" In any page...
My code looks kind of like this:
<rxui:ReactiveContentPage
x:Class="SmartDemo.View.InicioV"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:rxui="clr-namespace:ReactiveUI.XamForms"
xmlns:vm="clr-namespace:SmartDemo.ViewModel"
Title="Inicio"
x:TypeArguments="vm:InicioVM">
<ContentPage.Content>
<!-- Status -->
<Button
x:Name="Btn_status"
BackgroundColor="{StaticResource GENERICButtonColor}"
Font="35, Bold"
HeightRequest="150"
Image="off.png"
Text="Desconectado."
VerticalOptions="StartAndExpand"
WidthRequest="200" />
</StackLayout>
</ContentView>
I was trying to add an "Overlay" page to work as a "MasterDetail" or something...
First solution I tried: "Add and do some mods:
1.- At my first stacklayout I added this
"StackLayout AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
AbsoluteLayout.LayoutFlags="All">
[... this stacklayout content]
</StackLayout"
2.- Then I created a "ContentView" right after the end of the previous stacklayotu:
<!-- Overlay -->
<ContentView x:Name="overlay"
AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
AbsoluteLayout.LayoutFlags="All"
IsVisible="False"
BackgroundColor="#C0808080"
Padding="10, 0">
<StackLayout Orientation="Vertical"
BackgroundColor="White"
HeightRequest="175"
WidthRequest="300"
HorizontalOptions="Center"
VerticalOptions="Start"
Margin="0,20,0,0" >
<Label BackgroundColor="Black" FontSize="18" TextColor="White" HorizontalOptions="Fill" Text="Im an Overlay" />
</StackLayout>
</ContentView>
I tried to compile and run severaltimes the code and it broke everytime... So I decided to remove piece by piece of the code... until I reached the point where I had to remove the "" then everything went ok... but then the content on my page disappeared and I was able only to summon the "content view" trhoughout (whenever I keep the ContentView, If I delete the content view code everything goes ok)
So It seems that "AbsoluteLayout" gives problems whenever I try to work along with it...
Still maybe I'm doing something wrong with my code... I'll leave the full code here:
<rxui:ReactiveContentPage
x:Class="SmartDemo.View.InicioV"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:rxui="clr-namespace:ReactiveUI.XamForms"
xmlns:vm="clr-namespace:SmartDemo.ViewModel"
Title="Inicio"
x:TypeArguments="vm:InicioVM">
<ContentPage.Content>
<!-- Status -->
<Button
x:Name="Btn_status"
BackgroundColor="{StaticResource GENERICButtonColor}"
Font="35, Bold"
HeightRequest="150"
Image="off.png"
Text="Desconectado."
VerticalOptions="StartAndExpand"
WidthRequest="200" />
</StackLayout>
<!-- OVERLAY -->
<ContentView
x:Name="Beta"
BackgroundColor="Red"
IsVisible="False">
<StackLayout Margin="0,0,50,0" BackgroundColor="Wheat">
<Label
BackgroundColor="Black"
FontSize="18"
Text="CAPITAL CITIES"
TextColor="White" />
<StackLayout HorizontalOptions="Center">
<Button x:Name="Close_btn" FontSize="Large" />
</StackLayout>
</StackLayout>
</ContentView>
</ContentPage.Content>
Hi, I already ran the original code and I happen to have a very weird issue.
Whenever I reach the "Second Modal" and press the "Push Page" button nothing happnes. However, when I do "pop modals" I happen to come across with the pages that I actually "Pushed" on the Second Modal... which can be described like this:
At frist:
Home Page -> First Modal -> Second modal (PUSH)
After push:
Home Page -> Pushed Page from second modal -> First Modal -> Second Modal
After poping pushed page:
Home Page -> First Modal -> Second Modal
I dont know if I made my self clear, any ways, I'm tyring to figure out what is going on but I happen to hae the exact same issue when working along with my own solution...
Thank you!
Sextant/src/Sextant/Navigation/ViewStackServiceBase.cs
Lines 36 to 41 in 354add4
TODO
comment in 354add4. It's been assigned to @RLittlesII because they committed the code.We should have WPF support.
Should be able to base it off the transition control that ReactiveUI navigation currently uses.
Is your feature request related to a problem? Please describe.
Currently all we have is the ability to tell Sextant to animate or not.
Describe the solution you'd like
I have seen a few custom animation libraries for Xamarin.Forms. What I would like is from Sextant is the ability to abstract platform level animations and allow better support for animations. Change the API from taking a bool
to maybe an enumeration where the consumer can dictate which platform animation to use. What would be great is the ability to provide your own animations that have platform specific implementations.
Describe suggestions on how to achieve the feature
The following are extensions that should get us where we want to be in some fashion.
Is your feature request related to a problem? Please describe.
There is no support for UWP native currently.
Describe the solution you'd like
Please add support for the UWP navigation stack.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.
Currently to use Sextant you have to take a dependency on Genesis.Logging. We need a way to log Sextant internal information, without depending on a third party framework.
Describe the solution you'd like
A clear and concise description of what you want to happen.
I would like Sextant to provide and ILogger
and a default implementation. Then any consumer can implement Sextant's ILogger
and log Sextant output to a third party framework of their choosing.
This is to support future platforms.
Consider removing the activator here
One way to remove it would be to do something like
public static void RegisterNavigation<TView, TViewModel>(IScheduler mainThreadScheduler = null, IScheduler backgroundScheduler = null, IViewLocator viewLocator = null)
where TView : new, IPageView, IViewFor
where TViewModel : class, IPageViewModel
{
var bgScheduler = mainThreadScheduler ?? RxApp.TaskpoolScheduler;
var mScheduler = backgroundScheduler ?? RxApp.MainThreadScheduler;
var vLocator = viewLocator ?? Locator.Current.GetService<IViewLocator>();
Locator.CurrentMutable.Register(
() => new TView { Scheduler = mScheduler, BackgroundScheduler = bgScheduler, ViewLocator = vLocator },
typeof(IViewFor<TViewModel>),
"NavigationView");
}
Updating Sextant dependencies to the following versions. This gets us to System.Reactive 4.x which has performance improvements.
Fix the Sextant Navigation Parameter Sample to work with ReactiveUI Bindings
Our routing is something that should be overhauled in the future. It is far too prescriptive and platform-specific. ReactiveUI should really provide a general routing mechanism that cares not about how you manifest it in the view. All that logic should be written โ_once_โ (instead of per platform like we have now) and shared with simple shims to integrate at the UI level.
This is a great opportunity to look around and see how others are doing it. @rid00z has mentioned over beers he has suggestions from implementing this type of logic as part of his framework FreshMvvm.
Additionally MvvmCross has the notion of handling this behavior via Presenters
@jcmm33's team has done a significant amount of work on-top of ReactiveUI and have implemented their own presenter solution. Maybe this is a chance to use this implementation as the golden standard and off-load the burden from his team of having to maintain their own.
Suggested leads for this topic are @jcmm33, @rid00z, @codemillmatt and of course @kentcb / @flagbug
Is your feature request related to a problem? Please describe.
I can only use Sextant for Xamarin.Forms
Describe the solution you'd like
I want to use Sextant for Xamarin.iOS
Describe alternatives you've considered
None.
Describe suggestions on how to achieve the feature
Implement iView
using a UINavigationController
for iOS
Sextant/src/Sextant/Navigation/ViewStackServiceBase.cs
Lines 36 to 41 in 370a424
TODO
comment in 370a424 when #75 was merged. cc @reactiveui.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.