UNPKG

@applicaster/zapp-react-native-ui-components

Version:

Applicaster Zapp React Native ui components for the Quick Brick App

41 lines (35 loc) 1.15 kB
/** * This function helps to decide wether the menu should be presented on the screen * based on route and / or screen Data * * is similar to the navbar, except that it covers scenarios where only the navbar (and not) * the menu, will be hidden * * - playable screens * - qb_search_screen * - screen hooks that specify showNavBar or presentFullScreen * - screens or nested screens that have allow_screen_plugin_presentation set to true * * @param {String} route current route of the screen * @param {Object} screenData payload associated with the currently presented screen * @returns {Boolean} */ export function isMenuVisible(route, screenData) { if (route.includes("playable")) { return false; } if (screenData.type === "qb_search_screen") { return false; } if (screenData?.hookPlugin) { const hookPlugin = screenData?.hookPlugin?.module; return hookPlugin?.showNavBar || hookPlugin?.presentFullScreen !== true; } if ( screenData?.general?.allow_screen_plugin_presentation || screenData?.targetScreen?.general?.allow_screen_plugin_presentation ) { return false; } return true; }