Run a script on screen load

I have a script that runs great when linked to a ‘tap’ event on an element. However, I would like it to run as soon as the screen loads, I can’t seem to see how to do this.

Any help would be great :slight_smile:

Thank you!

Hi put it in a text value transformation script and set another dataslot to some value to test for one time execution

you insert it into your screen -> Template -> componentDidMount() function

If I have a switch before the first screen, to decide which screen loads first, is there a way of inserting this script on the switch?

The Switch has a Value transformer script so I’d test that one. Cannot say 100% if it works on your use case but you should try that.

I found it easier to just put a ‘loader’ dummy screen in at the start, enter some script into the did_mount section and redirect from there :slight_smile: thanks!