@shopgate/engage
Version:
Shopgate's ENGAGE library.
12 lines • 1.43 kB
JavaScript
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{AndroidNavigationBar}from'@shopgate/native-modules';import{logger,appSupportsAndroidEdgeToEdge}from'@shopgate/engage/core/helpers';/**
* @typedef {Object} UpdateAndroidNavigationBarOptions
* @property {string} [color] Color for the navigation bar.
* Accepts hex, hex with alpha, rgb(), or rgba().
*/var lastOptions=null;/**
* Updates the Android navigation bar style based on the provided visual options.
* Typically used to match app UI to system navigation bar for a more native look and feel.
*
* @param {UpdateAndroidNavigationBarOptions} [options={}] Visual customization options for
* the nav bar.
*/export var updateAndroidNavigationBarColor=function updateAndroidNavigationBarColor(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};// Only necessary for Android devices with edge-to-edge screens
if(!appSupportsAndroidEdgeToEdge()){return;}var color=options.color;var needsUpdate=!lastOptions||options.color!==lastOptions.color;if(needsUpdate){try{AndroidNavigationBar.setColor({color:color});lastOptions=_extends({},options);}catch(e){logger.error('Error updating Android navigation bar color',e);}}};