Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setStatusBarStyleAndroid(containerBackgroundColor, backgroundColor, statusBarStyle = {}) {
// Android cannot resolve interpolated values for animated status bar
// background colors so we fall back to default Android status bar styling
if (isAnimatedStyleValue(containerBackgroundColor)) {
StatusBar.setBackgroundColor('rgba(0, 0, 0, 0.2)');
StatusBar.setBarStyle('default');
} else {
StatusBar.setBackgroundColor(containerBackgroundColor);
}
if (isAnimatedStyleValue(backgroundColor)) {
this.backgroundListenerId = addAnimatedValueListener(backgroundColor, () => {
this.resolveStatusBarStyle(backgroundColor);
});
}
this.resolveStatusBarStyle(backgroundColor, true);
if (!_.isUndefined(statusBarStyle.transluscent)) {
StatusBar.setTranslucent(statusBarStyle.transluscent);
setStatusBarStyleAndroid(containerBackgroundColor, backgroundColor, statusBarStyle = {}) {
// Android cannot resolve interpolated values for animated status bar
// background colors so we fall back to default Android status bar styling
if (isAnimatedStyleValue(containerBackgroundColor)) {
StatusBar.setBackgroundColor('rgba(0, 0, 0, 0.2)');
StatusBar.setBarStyle('default');
} else {
StatusBar.setBackgroundColor(containerBackgroundColor);
}
if (isAnimatedStyleValue(backgroundColor)) {
this.backgroundListenerId = addAnimatedValueListener(backgroundColor, () => {
this.resolveStatusBarStyle(backgroundColor);
});
}
this.resolveStatusBarStyle(backgroundColor, true);
if (!_.isUndefined(statusBarStyle.transluscent)) {
StatusBar.setTranslucent(statusBarStyle.transluscent);
setStatusBarStyleIos(statusBarColor, backgroundColor, hasImage) {
if (isAnimatedStyleValue(backgroundColor) && !Device.isIphoneX && !Device.isIphoneXR) {
// If the backgroundColor is animated, we want to listen for
// color changes, so that we can update the bar style as the
// animation runs.
this.backgroundListenerId = addAnimatedValueListener(backgroundColor, () => {
this.resolveStatusBarStyle(backgroundColor);
});
}
// Set the bar style based on the current background color value
hasImage ?
this.resolveStatusBarStyle(statusBarColor, true) :
this.resolveStatusBarStyle(backgroundColor, true);
}
setStatusBarStyleAndroid(containerBackgroundColor, backgroundColor, statusBarStyle = {}) {
// Android cannot resolve interpolated values for animated status bar
// background colors so we fall back to default Android status bar styling
if (isAnimatedStyleValue(containerBackgroundColor)) {
StatusBar.setBackgroundColor('rgba(0, 0, 0, 0.2)');
StatusBar.setBarStyle('default');
} else {
StatusBar.setBackgroundColor(containerBackgroundColor);
}
if (isAnimatedStyleValue(backgroundColor)) {
this.backgroundListenerId = addAnimatedValueListener(backgroundColor, () => {
this.resolveStatusBarStyle(backgroundColor);
});
}
this.resolveStatusBarStyle(backgroundColor, true);
if (!_.isUndefined(statusBarStyle.transluscent)) {
StatusBar.setTranslucent(statusBarStyle.transluscent);
}
}
setStatusBarStyleIos(statusBarColor, backgroundColor, hasImage) {
if (isAnimatedStyleValue(backgroundColor) && !Device.isIphoneX && !Device.isIphoneXR) {
// If the backgroundColor is animated, we want to listen for
// color changes, so that we can update the bar style as the
// animation runs.
this.backgroundListenerId = addAnimatedValueListener(backgroundColor, () => {
this.resolveStatusBarStyle(backgroundColor);
});
}
// Set the bar style based on the current background color value
hasImage ?
this.resolveStatusBarStyle(statusBarColor, true) :
this.resolveStatusBarStyle(backgroundColor, true);
}
setStatusBarStyleAndroid(containerBackgroundColor, backgroundColor, statusBarStyle = {}) {
// Android cannot resolve interpolated values for animated status bar
// background colors so we fall back to default Android status bar styling
if (isAnimatedStyleValue(containerBackgroundColor)) {
StatusBar.setBackgroundColor('rgba(0, 0, 0, 0.2)');
StatusBar.setBarStyle('default');
} else {
StatusBar.setBackgroundColor(containerBackgroundColor);
}
if (isAnimatedStyleValue(backgroundColor)) {
this.backgroundListenerId = addAnimatedValueListener(backgroundColor, () => {
this.resolveStatusBarStyle(backgroundColor);
});
}
this.resolveStatusBarStyle(backgroundColor, true);
if (!_.isUndefined(statusBarStyle.transluscent)) {
StatusBar.setTranslucent(statusBarStyle.transluscent);
}
}