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

iOS PickerCell IsEnabled not reflecting properly #185

Open
1 of 2 tasks
AlvinKwong opened this issue Sep 14, 2021 · 2 comments
Open
1 of 2 tasks

iOS PickerCell IsEnabled not reflecting properly #185

AlvinKwong opened this issue Sep 14, 2021 · 2 comments

Comments

@AlvinKwong
Copy link

Description

My app has a page that allows users to adjust the settings. But the settings will expire in 1 minute. After that, the cells will be greyed out and not allow to be configured.
The problem happens that when the user navigates to this page, one of the picker cells is enabled, though the flag is false. But after scrolling down and up again, that picker cell becomes disabled. Therefore it is suspected that there is some caching issue when reflecting the isEnabled status of the cell.
This only happens on iOS and does not happen on Android.

(For more Information, the picker cell "Recovery Detection Angle" and "Sensing Timer" are binding the same boolean in their IsEnabled properties. Therefore it should not be the program issue as if the flag is not updated properly, both cells would be enabled/disabled at the same time.)

Steps to Reproduce

  1. Create a page with a SettingsView
  2. Bind the isEnabled Flag of the cells to the ViewModels boolean properties.
  3. Set the boolean properties to false in OnNavigatedTo() method.
  4. Navigate to this page, some of the cells that are supposed to be disabled are enabled.
  5. Scroll down and up again, the cells now become disabled.

Platforms

  • Android
  • iOS

Basic Information

  • AiForms.SettingsView 1.3.28
  • Xamarin.Forms 5.0.0.2083

Video

iOS_isEnabled_Issue.mp4
@AlvinKwong
Copy link
Author

More information
For that problematic picker cell, I changed to isEnabled="False" such that it should always be disabled. But the problem persists that when just navigates to the page, the picker cell is still enabled. Once scroll down and back again, the picker cell becomes disabled.

The only difference between this problematic picker cell and other picker cells is that the ItemSource of the problematic picker cell updates dynamically. When the "Fall Detection Angle" value changes, the "Recovery Detection Angle" item source will update accordingly to the "Fall Detection Angle" value. Other picker cells' item sources are initialized in the view model constructor and will not changed.

@AlvinKwong
Copy link
Author

I have found a workaround for this issue.
Currently the isEnabled is initialized in the method OnNavigatedTo because it is determined by the navigation parameter.
Since I use Prism.Forms, I can implement the IInitialize interface which its method Initialize(INavigationParameters parameters) is executed before OnNavigatedTo. After moving the codes from OnNavigatedTo to Initialize, the picker cell state is now reflected properly when the page shows up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant