Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Binding ReactiveCommand doesn't fire command correctly #2316

Closed
RLittlesII opened this issue Jan 17, 2020 · 5 comments
Closed

[BUG] Binding ReactiveCommand doesn't fire command correctly #2316

RLittlesII opened this issue Jan 17, 2020 · 5 comments

Comments

@RLittlesII
Copy link
Member

RLittlesII commented Jan 17, 2020

Describe the bug

Related To: #2299
Possibly Related: #2169

Steps To Reproduce
RefreshCommand = ReactiveCommand.CreateFromTask(async _ => await RefreshItemsAsync(), outputScheduler: RxApp.MainThreadScheduler);

<RefreshView IsRefreshing="{Binding IsRefreshing, Mode=OneWay}"
                     Command="{Binding RefreshCommand}">
        <ScrollView>
               ...
        </ScrollView>
</RefreshView>

Expected behavior

That I can bind a ReactiveCommand to a Xamarin.Forms Visual Element. Either in the XAML or in Code.

Screenshots

Environment

  • OS: iOS 13.3
  • Version ReactiveUI 11.1.1
  • Device: iOS Simulator and iPad 10,5"

Additional context

It seems there is an issue either with Binding the ReactiveCommand or the thread execution of the ReactiveCommand.

Works:

RefreshView
     .Events()
     .Refreshing
     .InvokeCommand(this, x => x.ViewModel.RefreshCommand);

Doesn't Work:

this.BindCommand(ViewModel, x => x.RefreshCommand, x => x.RefreshView);
@open-collective-bot
Copy link

Hey @RLittlesII 👋,

Thank you for contributing to our project financially. We will handle your issue with priority support. To make sure we don't forget how special you are, we added a priority label to your issue.

Thank you again for contributing 🎉!

@winterdouglas
Copy link

Hey @RLittlesII it seems you are doing the BindCommand wrongly (or you wrote it wrongly here in the thread).
I'm talking about this line:
this.BindCommand(ViewModel, x => x.RefreshCommand, x => x.RefreshView.IsRefreshing);

You are binding the IsRefreshing with the VM command, was that really the intention?

@RLittlesII
Copy link
Member Author

@winterdouglas It's just written wrong here.

this.BindCommand(ViewModel, x => x.RefreshCommand, x => x.RefreshView); doesn't work past the first pull.

@gsgou
Copy link

gsgou commented May 21, 2020

@RLittlesII you can close this as well as done for #2299
Tks for figuring out the relation to XF #9326 and
the workaround in the description 👍

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants