diff --git a/packages/core/src/platform/patch/react/getDefaultOptions.ios.js b/packages/core/src/platform/patch/react/getDefaultOptions.ios.js index 2ccee98d8..02e42f597 100644 --- a/packages/core/src/platform/patch/react/getDefaultOptions.ios.js +++ b/packages/core/src/platform/patch/react/getDefaultOptions.ios.js @@ -447,24 +447,20 @@ export function getDefaultOptions ({ type, rawOptions = {}, currentInject }) { useLayoutEffect(() => { const isCustom = pageConfig.navigationStyle === 'custom' - const opt = {} - if (__mpx_mode__ === 'android') { - // opt = { - // statusBarTranslucent: isCustom, - // statusBarStyle: pageConfig.statusBarStyle, // 枚举值 'auto' | 'dark' | 'light' 控制statusbar字体颜色 - // statusBarColor: isCustom ? 'transparent' : pageConfig.statusBarColor // 控制statusbar背景颜色 - // } - } navigation.setOptions({ headerShown: !isCustom, title: pageConfig.navigationBarTitleText || '', headerStyle: { backgroundColor: pageConfig.navigationBarBackgroundColor || '#000000' }, - // headerTitleAlign: 'center', - headerTintColor: pageConfig.navigationBarTextStyle || 'white', - ...opt + headerTintColor: pageConfig.navigationBarTextStyle || 'white' }) + if (__mpx_mode__ === 'android') { + ReactNative.StatusBar.setBarStyle(pageConfig.barStyle || 'dark-content') + ReactNative.StatusBar.setTranslucent(isCustom) // 控制statusbar是否占位 + const color = isCustom ? 'transparent' : pageConfig.statusBarColor + color && ReactNative.StatusBar.setBackgroundColor(color) + } }, []) const rootRef = useRef(null)