Commit 277611d3 by peii

兼容header高度问题

(cherry picked from commit 0ebc1a32)
parent 6bc908a3
......@@ -63,7 +63,7 @@ const screenH = Dimensions.get('window').height;
export const isIphoneX = () => {
return (
Platform.OS === 'ios' &&
screenH >= 728
screenH > 736
)
};
......
/*
* @FilePath: /BoneHouse_Hospital_APP/src/components/header/header.tsx
* @FilePath: /BoneHouse_Business_APP/src/components/header/header.tsx
* @Author: peii
* @Date: 2021-06-06 13:28:41
* @LastEditTime: 2021-10-09 11:38:11
* @LastEditTime: 2021-12-28 16:37:50
* @LastEditors: peii
* @Vision: 1.0
* @Description:
......@@ -10,6 +10,7 @@
// @ts-nocheck
import React, { useState, useEffect } from 'react'
import { View, StatusBar, Platform, Text, Image, TouchableOpacity } from 'react-native'
import Resolution from '../../components/common/Resolution'
import { g, isIphoneX } from '../../utils/utils'
import { primary_color } from '../../assets/styles/base'
import styles from './header.styl'
......@@ -20,12 +21,20 @@ import styles from './header.styl'
function header({ title, backgroundColor = primary_color, back = true, backCallback = () => {}, children }) {
const [statusHeight] = useState(Platform.OS === 'android' ? 0 : isIphoneX() ? 44 : 20)
const [barHeight, setHeaderHeight] = useState(58)
// useEffect(() => {
useEffect(() => {
// const height = Platform.OS === 'android' ? 0 : isIphoneX() ? 44 : 20
// setStatusHeight(height)
// store.setHeaderHeight(height + 58)
// }, [])
const res = Resolution.get()
let height = barHeight / res.scale
if (isIphoneX()) {
height += 4
}
setHeaderHeight(height)
}, [])
return (
<View style={g(styles, 'header')}>
......@@ -35,7 +44,7 @@ function header({ title, backgroundColor = primary_color, back = true, backCallb
</View>
{/* 标题栏 */}
<View style={g(styles, 'header-bar')}>
<View style={[g(styles, 'header-bar'), { height: barHeight }]}>
{/* 返回按钮 */}
{!!back && (
<TouchableOpacity
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment