I faced with the strange behavior of OnNavigatedTo in Prism. It works always on Android, but on iOS it not works for one of the pages. See code:
private void OnSpecialtyTapped() { _navigationService.NavigateAsync($"{nameof(SpecialtyFilterPage)}", useModalNavigation: false); }private void OnLocationTapped() { _navigationService.NavigateAsync($"{nameof(PlacesFilterPage)}", useModalNavigation: false); }private void OnTakeChosenSpecialties() { var parameters = new NavigationParameters { //{"ChosenSpecialtiesIds", CheckedSpecialties.Select(s => s.Id).ToList()} }; _navigationService.GoBackAsync(parameters); }private void OnTakeChosenPlaces() { var parameters = new NavigationParameters { //{"ChosenPlaces", CheckedPlaces.Select( p => new Models.PlaceParameter {Id=p.Id, Type=Convert.ToString(p.Type)}).ToList()} }; _navigationService.GoBackAsync(parameters); }public void OnNavigatedTo(NavigationParameters parameters) { if ( parameters.ContainsKey("ChosenSpecialtiesIds") ) { var chosenSpecialtiestIds = parameters["ChosenSpecialtiesIds"] as List<string>; if ( chosenSpecialtiestIds == null ) return; _filter.Services.Clear(); foreach ( var specialtiestId in chosenSpecialtiestIds ) { _filter.Services.Add(new ServiceParameter { Id = specialtiestId }); } } else if ( parameters.ContainsKey("ChosenPlaces") ) { var chosenPlaces = parameters["ChosenPlaces"] as List<PlaceParameter>; if ( chosenPlaces == null ) return; _filter.Places.Clear(); _filter.Places = chosenPlaces; } }
It works with Specialty and doesn't work on iOS with Places. I am using Prism 6.2.0 and Xamarin.Forms 2.3.3.193. I can't use newer version because of some bug.