Skip to main content
Version: Next

Screen life cycle events

Understanding screen onStart and onEnd

Whenever a screen is mounted and unmounted, there are two methods gets called for each screen.

onStart:

This method is called whenever screen is mounted.

const screen = {
name: 'WelcomeScreen',
screen: {
v1: [text, ...],
},
onStart:({setUi, getUi, moduleParams })=>{
// do something on screen mounted
  }
};

onResume:

This method is called whenever screen is focused

const screen = {
name: 'WelcomeScreen',
screen: {
v1: [text, ...],
},
onResume:({setUi, getUi, moduleParams })=>{
// do something on screen unmounted
}
}; 

onPause:

This method is called whenever screen is out of focus.

const screen = {
name: 'WelcomeScreen',
screen: {
v1: [text, ...],
},
onPause:({setUi, getUi, moduleParams })=>{
// do something on screen out of focus
}
}; 

onEnd:

This method is called whenever screen is unmounted

const screen = {
name: 'WelcomeScreen',
screen: {
v1: [text, ...], 
},
onEnd:({setUi, getUi, moduleParams })=>{
// do something on screen unmounted
}
};