Reactiveui: IScreen.Router.Navigate.Execute not working with ReactiveUI 7 on Xamarin.Forms

Created on 23 Sep 2016  路  5Comments  路  Source: reactiveui/ReactiveUI

_Note_: for support questions, please ask on StackOverflow: https://stackoverflow.com/questions/tagged/reactiveui . This repository's issues are reserved for feature requests and bug reports.

Do you want to request a _feature_ or report a _bug_?
bug

What is the current behavior?
When calling HostScreen.Router.Navigate.Execute(new SamplePageViewModel(viewModel)); the screen won't update.
From what I could see the the viewModel ctor gets called but the view ctor don't.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
RX 7 (problematic): https://github.com/GiusepeCasagrande/RoutingSimpleSample/tree/master
RX 6.5 (working): https://github.com/GiusepeCasagrande/RoutingSimpleSample/tree/ReactiveUI_6_5

What is the expected behavior?
The new screen been pushed.

What is the motivation / use case for changing the behavior?

Which versions of ReactiveUI, and which platform / OS are affected by this issue? Did this work in previous versions of ReativeUI? Please also test with the latest stable and snapshot (http://docs.reactiveui.net/en/contributing/snapshot/index.html) versions.
ReactiveUI 7
Xamarin Studio 6.1, Xamarin.Froms 2.32
I tested with: iOS 9 and 10, Android API 22+

Used to work on RxUI 6.5

Other information (e.g. stacktraces, related issues, suggestions how to fix)

outdated

Most helpful comment

All of the navigation components are implemented using ReactiveCommands
https://github.com/reactiveui/ReactiveUI/blob/rxui7-master/src/ReactiveUI/RoutingState.cs

So the Observable and the laziness just come from how one initiates and interacts with ReactiveCommands

By itself this isn't necessarily a justification for the Observable :-) But kind of is

With it being an Observable now it's easy to just do things reactively

Navigate.Execute(new SamplePageViewModel(viewModel)).Catch().Subscribe();

Navigate.Execute(new SamplePageViewModel(viewModel)).DoSomething().Subscribe();

Navigate.Execute(new SamplePageViewModel(viewModel)).Log().Subscribe();

DoStuff.SelectMany(_=> Navigate.Execute(new SamplePageViewModel(viewModel))).DoOtherStuffAfterDoneNavigating()

Those might not be the best examples but why be opinionated and limit the user with a "void" that executes immediately vs an Observable that allows you to do things based on the result/completion/failure of the navigation?

All 5 comments

I just stumbled above the same problem while trying to do everyting like in Paul's Evolve App.

Execute returns IObservable<T>, and is lazy. You must subscribe to it for anything to happen.

What the sense in having that an Observable?

All of the navigation components are implemented using ReactiveCommands
https://github.com/reactiveui/ReactiveUI/blob/rxui7-master/src/ReactiveUI/RoutingState.cs

So the Observable and the laziness just come from how one initiates and interacts with ReactiveCommands

By itself this isn't necessarily a justification for the Observable :-) But kind of is

With it being an Observable now it's easy to just do things reactively

Navigate.Execute(new SamplePageViewModel(viewModel)).Catch().Subscribe();

Navigate.Execute(new SamplePageViewModel(viewModel)).DoSomething().Subscribe();

Navigate.Execute(new SamplePageViewModel(viewModel)).Log().Subscribe();

DoStuff.SelectMany(_=> Navigate.Execute(new SamplePageViewModel(viewModel))).DoOtherStuffAfterDoneNavigating()

Those might not be the best examples but why be opinionated and limit the user with a "void" that executes immediately vs an Observable that allows you to do things based on the result/completion/failure of the navigation?

If you think this further I think it would be worthwhile to consider the possibility to return Data from a NavigatedTo page back to the previous page and return this through this Observable.

Was this page helpful?
0 / 5 - 0 ratings