提交 4b904170 编写于 作者: Q qiang

fix(App): 修复 backgroundColor、navigationBarBackgroundColor 设置为不支持的值时 iOS 设备显示为透明的问题

上级 d5d2139a
...@@ -30,7 +30,7 @@ function parseTitleNViewButtons (titleNView) { ...@@ -30,7 +30,7 @@ function parseTitleNViewButtons (titleNView) {
export function parseTitleNView (routeOptions) { export function parseTitleNView (routeOptions) {
const windowOptions = routeOptions.window const windowOptions = routeOptions.window
const titleNView = windowOptions.titleNView const titleNView = windowOptions.titleNView
routeOptions.meta.statusBarStyle = windowOptions.navigationBarTextStyle === 'black' ? 'dark' : 'light' routeOptions.meta.statusBarStyle = windowOptions.navigationBarTextStyle === 'black' ? 'dark' : 'light'
if ( // 无头 if ( // 无头
titleNView === false || titleNView === false ||
...@@ -54,12 +54,13 @@ export function parseTitleNView (routeOptions) { ...@@ -54,12 +54,13 @@ export function parseTitleNView (routeOptions) {
always: 'float' always: 'float'
} }
const navigationBarBackgroundColor = windowOptions.navigationBarBackgroundColor
const ret = { const ret = {
autoBackButton: !routeOptions.meta.isQuit, autoBackButton: !routeOptions.meta.isQuit,
titleText: titleImage === '' ? windowOptions.navigationBarTitleText || '' : '', titleText: titleImage === '' ? windowOptions.navigationBarTitleText || '' : '',
titleColor: windowOptions.navigationBarTextStyle === 'black' ? '#000000' : '#ffffff', titleColor: windowOptions.navigationBarTextStyle === 'black' ? '#000000' : '#ffffff',
type: titleNViewTypeList[transparentTitle], type: titleNViewTypeList[transparentTitle],
backgroundColor: windowOptions.navigationBarBackgroundColor || '#f8f8f8', backgroundColor: (/^#[a-z0-9]{6}$/i.test(navigationBarBackgroundColor) || navigationBarBackgroundColor === 'transparent') ? navigationBarBackgroundColor : '#f7f7f7',
tags: titleImage === '' ? [] : [{ tags: titleImage === '' ? [] : [{
tag: 'img', tag: 'img',
src: titleImage, src: titleImage,
...@@ -77,4 +78,4 @@ export function parseTitleNView (routeOptions) { ...@@ -77,4 +78,4 @@ export function parseTitleNView (routeOptions) {
} }
return ret return ret
} }
...@@ -45,7 +45,7 @@ export function parseWebviewStyle (id, path, routeOptions = {}) { ...@@ -45,7 +45,7 @@ export function parseWebviewStyle (id, path, routeOptions = {}) {
}) })
const backgroundColor = routeOptions.window.backgroundColor const backgroundColor = routeOptions.window.backgroundColor
if (backgroundColor) { if (/^#[a-z0-9]{6}$/i.test(backgroundColor) || backgroundColor === 'transparent') {
if (!webviewStyle.background) { if (!webviewStyle.background) {
webviewStyle.background = backgroundColor webviewStyle.background = backgroundColor
} }
...@@ -94,4 +94,4 @@ export function parseWebviewStyle (id, path, routeOptions = {}) { ...@@ -94,4 +94,4 @@ export function parseWebviewStyle (id, path, routeOptions = {}) {
} }
return webviewStyle return webviewStyle
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册