Hidden Functions

I'm building an app that greatly benefits from dynamically being able to navigate to different screens based on context and user input. I noticed that using navigator.navigateTo([screen]) works, but doesn't look like it's officially supported or "supposed" to be used this way.

The same goes for alert.open(). I can see that when I use the UI to configure an alert, that's all it's calling behind the scenes, but when I try to call it from a Javascript block I end up with a blank alert window. Is there any documentation on how to use these functions properly/plans for supporting more dynamic alerting/navigation in the future?

EDIT: Apparently this post was flagged as spam? No really sure why because these are legitimate questions and limitations I'm running into when building mobile apps on a regular basis.

Hi @Travis_Witt,
Information on using navigator.navigateTo can be found here.

With regard to creating an alert from a JS block, the best way to do this is to add a success handler and select the Alert action from there because, you are right that the alert.open() function is not meant to be used explicitly in a js block. And if you want to display it dynamically, your logic could throw an error using throw new Error('error message here"') and this would not run the success handler. (You could also do this with navigation by selecting the Navigation action in a success handler. However, as described in the docs linked above, the navigator.navigateTo function is indeed made available to you in the js block )

I hope this helps! :smile:

Awesome, thanks. I must have missed the navigator documentation when I was looking!

Any idea why the alert function isn't available in the same way? It would be super helpful to be able to call it in a JS block/function rather than needing to tie it to an event handler.

@Travis_Witt,
No, I don't know why. ( I honestly didn't even know that this component existed until today! The alert does not exist outside of mobile apps. ). I will file a feature request to make this available, but meanwhile you can use the event handler workaround.