I tried mocking NavigationParameters and it is setting GetNavigationMode() as NULL. Is there any better way to mock an extension method?
Didn't work out for me. But your reference helped me to find a solution, that compiled (maybe it is a version issue, I use Prism 7.1:
var navParams = (INavigationParametersInternal)new NavigationParameters();
navParams.Add("__NavigationMode", NavigationMode.New);
This was bugging me for a while as well, and I finally found something that is at least a workaround. This issue shows that you can actually add internal parameters to the NavigationParameters, it just doesn't show up in intellisense. My test code ended up looking something like:
var navParams = new NavigationParameters();
navParams.AddInternalParameter("__NavigationMode", NavigationMode.Back);
Hope this helps!
As noted by #thomas-kison, the AddInternalParameter api no longer seems to exist. A search through the Prism repo only brings up the issue referenced by #batesiiic in their answer.
To add to #thomas-kison's answer by addressing #esteban-chornet's question, what I've found is that this solution will work by passing in the INavigationParametersInternal argument as INavigationParameters:
// arrange:
var navParams = (INavigationParametersInternal)new NavigationParameters();
navParams.Add("__NavigationMode", NavigationMode.Back);
// act:
_myCoolPageViewModel.OnNavigatedTo(navParams as INavigationParameters);
// assert whatever should happen in OnNavigatedTo given a NavigationMode of NavigationMode.Back
Hope this helps someone out!
Related
I hope somebody can help me here, because I am trying to solve this already for hours now :)
I have a Firestore-collection "hochzeiten" with a timestamp-field "datum_ablauf".
The LowCode-plattform Flutterflow offers the possibility to use "Custom Functions" - and with this I want to get the value of the field "datum_ablauf" when handing over the DocumentReference to the function. So the template of the function (the part I can't really change) looks like this:
import 'dart:math' as math;
DateTime dateAblaufFromWeddingGEHTNED(DocumentReference currWedding) {
Well - I tried a lot and nothing worked, but here is my latest try:
currWedding.get().then((snapshot) {
DateTime datum = DateTime.parse(snapshot['datum_ablauf'].toDate().toString());
return datum;
});
Sadly I always get NUl, whatever I try.
Has somebody a hint for me?
Thanks!
I get an error with RKUIManager, or more precisely:
Could not invoke RKUIManager.manageChildren
It appears for example when I'm using firebase with React Native and try to set a reference in the constructor of a component with a prop. For ex:
messagesRef = FBRef.child("Messages").child(this.props.currentMeetingID)
If I change it to the following it works, and yes, I have checked if this.props.currentMeetingID is a legitimate value.
messagesRef = FBRef.child("Messages").child("123456789")
I can't seem to locate the problem nor reproduce it perfectly. I'm just trying to figure out if it's my machine or some kind of bug elsewhere.
Right now I'm just looking for info about what RKUIManager actually is.
If I nullcheck this.props.currentMeetingID I fix it, easy fix but nowhere to be found on the internet so I'll leave it here for anyone passing by. Probably me in a couple of weeks...
I want to change the title of the page after any route has been rendered, to the name of that route. This is the code I was using before:
Router.after(function(){document.title = this.route.name;});
The manual mentions using onAfterAction inside an individual route, but I'd like to do it globally?
You must have missed this : http://eventedmind.github.io/iron-router/#using-hooks
The correct syntax is straightforward :
Router.onAfterAction(function(){
// your hook definition
});
Note : The guide is for iron:router#1.0.0-pre2 which must be added to your app explicitly like this :
meteor add iron:router#1.0.0-pre2
But the Router.onAfterAction works fine in iron:router#0.9.X too.
I suggest using this.route.getName() instead of this.route.name, see more about this issue here :
https://github.com/EventedMind/iron-router/issues/878
The router.after(); method although has been deprecated will still be allowed in the code in terms of syntax. As discussed in the IRC chat the best approach is to use the new syntax.
Router.onAfterAction(function(){
document.title = this.route.name;
});
This should resolve what you are looking for.
Cheers !
Ryan
I have started to use Stackmob as a backend for a simple app I am building.
In stackmob I have set a relationship between two schema's and want to use '.fetchExpanded' to grab all of the data from stackmob, see this fiddle (will need to view the console to see the output):
http://jsfiddle.net/mcneela86/65Rax/
.fetchExtended(1);
The same code works using the '.fetch' instead of '.fetchExpanded'.
Has anyone come across this before?
Would really appreciate any help.
Ok, I found a work around for this.
Instead of using '.fetchExtended(1);' I will just use '.fetch();' and when I am defining the model I will change the following:
var Bike = StackMob.Model.extend({
schemaName: "bikes"
});
to:
var Bike = StackMob.Model.extend({
schemaName: "bikes?_expand=1"
});
This seems to remove the need for '.fetchExtended(1);'
Hope this helps someone else.
as I probably do not describe the problem in the right terms, I was not able to get an answer with google. Please excuse!
In the following code, I would like to replace 'hardcoded' identifier COMMENT with the variable editedField. How to do that?
var editedField:String = event.dataField;
if (model.multipleProcessingData[i][editedInformationProductNO].COMMENT != null{
...
}
Make sure you wrap this in try/catch block for NPE's, as you'll eventually find one with this many [] accessors.
A better, more OOP, would be to have an accessor function on your model that you can pass your data to:
model.getEditedField(i, editedInformatioNProductNO, editedField)
This will make it easier to troubleshoot and add good error messages to your app if things don't turn out like you expected.
var editedField:String = event.dataField;
if (model.multipleProcessingData[i][editedInformationProductNO][editedField] != null{
...
}