Commit 61e7686a authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix(native): back from another tab goes home before closing the app

Co-Authored-By: 's avatarClaude Opus 5.5 <noreply@anthropic.com>
parent 78dc09f8
...@@ -24,12 +24,14 @@ export function init() { ...@@ -24,12 +24,14 @@ export function init() {
onNavTap: handleNavTap, onNavTap: handleNavTap,
// The shell's QR scanner answers requestScan() here: { text } or { error }. // The shell's QR scanner answers requestScan() here: { text } or { error }.
onScanResult: handleScanResult, onScanResult: handleScanResult,
// Android's back button: one scene back while there is one; false lets // Android's back button: one scene back while there is one, then home
// the shell close the app instead. // (the Play tab); false only there, and the shell closes the app.
onBack: () => { onBack: () => {
const before = scene.currentSceneId(); const before = scene.currentSceneId();
scene.pop(); scene.pop();
return scene.currentSceneId() !== before; if (scene.currentSceneId() !== before) return true;
if (scene.getCurrentWorld() !== 'play') { scene.switchWorld('play'); return true; }
return false;
}, },
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment