Thanks for the help @davebollinger. Having to add a code on each scene is something that I was trying to avoid.
I was able to find a simple fix for the bug with a single code/require.
This is my solution:
rb-composer.lua
local composer = require "composer" composer.\_gotoScene = composer.gotoScene composer.gotoScene = function(sceneName, options) local currScene = composer.getScene( composer.getSceneName( "current" ) ) if currScene then if currScene.\_currEventName == "show" and currScene.\_currEventPhase == "will" then --print("current Scene is on 'SHOW - WILL'. Let's not execute the gotoScene now due to composer bug. Let's try again in a few so the scene can be on 'SHOW - DID'") return timer.performWithDelay(10, function() composer.gotoScene(sceneName, options) end) end end composer.\_gotoScene(sceneName, options) end composer.\_newScene = composer.newScene composer.newScene = function() local scene = composer.\_newScene() function scene.trap\_event(event) scene.\_currEventName = event.name scene.\_currEventPhase = event.phase end scene:addEventListener( "create", scene.trap\_event ) scene:addEventListener( "show", scene.trap\_event ) scene:addEventListener( "hide", scene.trap\_event ) scene:addEventListener( "destroy", scene.trap\_event ) return scene end
and on my main.lua I just require that file:
require "rb-composer"
That file (rb-composer) basically adds to every scene its last event info and also overwrites the composer.gotoScene forcing it to check if the current scene is not on a show/will phase. If it is, it delays the gotoScene until it is not.
That solution allows me to avoid the bug and not require me to make any other change on my project.
Thanks for all the help guys.