onboardsync-react-native
Version:
Expo SDK for OnboardSync - Remote onboarding configuration platform with A/B testing
51 lines • 2.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.StatusBarHelper = void 0;
const react_native_1 = require("react-native");
const colorUtils_1 = require("./colorUtils");
class StatusBarHelper {
static saveCurrentState() {
if (react_native_1.Platform.OS === 'ios') {
this.originalStyle = react_native_1.StatusBar.currentHeight || 'dark-content';
}
else {
this.originalStyle = 'dark-content';
this.originalBackgroundColor = 'transparent';
this.originalTranslucent = true;
}
}
static updateForColor(backgroundColor) {
const isDark = colorUtils_1.ColorUtils.isColorDark(backgroundColor);
const style = isDark ? 'light-content' : 'dark-content';
console.log(`[OnboardSync] Updating status bar - Background: ${backgroundColor}, Style: ${style}`);
react_native_1.StatusBar.setBarStyle(style, true);
if (react_native_1.Platform.OS === 'android') {
react_native_1.StatusBar.setBackgroundColor(backgroundColor, true);
react_native_1.StatusBar.setTranslucent(false);
}
}
static updateForTheme(style) {
const barStyle = style === 'light' ? 'light-content' : 'dark-content';
console.log(`[OnboardSync] Updating status bar for theme: ${style} -> ${barStyle}`);
react_native_1.StatusBar.setBarStyle(barStyle, true);
}
static restore() {
if (this.originalStyle) {
react_native_1.StatusBar.setBarStyle(this.originalStyle, true);
}
if (react_native_1.Platform.OS === 'android') {
if (this.originalBackgroundColor) {
react_native_1.StatusBar.setBackgroundColor(this.originalBackgroundColor, true);
}
if (this.originalTranslucent !== null) {
react_native_1.StatusBar.setTranslucent(this.originalTranslucent);
}
}
console.log('[OnboardSync] Restored original status bar settings');
}
}
exports.StatusBarHelper = StatusBarHelper;
StatusBarHelper.originalStyle = null;
StatusBarHelper.originalBackgroundColor = null;
StatusBarHelper.originalTranslucent = null;
//# sourceMappingURL=statusBarHelper.js.map