Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
zhangzhonghua
/
BoneHouse_Business_APP
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
277611d3
authored
Dec 28, 2021
by
peii
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
兼容header高度问题
(cherry picked from commit
0ebc1a32
)
parent
6bc908a3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
app/utils/Utils.js
src/components/header/header.tsx
app/utils/Utils.js
View file @
277611d3
...
@@ -63,7 +63,7 @@ const screenH = Dimensions.get('window').height;
...
@@ -63,7 +63,7 @@ const screenH = Dimensions.get('window').height;
export
const
isIphoneX
=
()
=>
{
export
const
isIphoneX
=
()
=>
{
return
(
return
(
Platform
.
OS
===
'ios'
&&
Platform
.
OS
===
'ios'
&&
screenH
>
=
728
screenH
>
736
)
)
};
};
...
...
src/components/header/header.tsx
View file @
277611d3
/*
/*
* @FilePath: /BoneHouse_
Hospital
_APP/src/components/header/header.tsx
* @FilePath: /BoneHouse_
Business
_APP/src/components/header/header.tsx
* @Author: peii
* @Author: peii
* @Date: 2021-06-06 13:28:41
* @Date: 2021-06-06 13:28:41
* @LastEditTime: 2021-1
0-09 11:38:11
* @LastEditTime: 2021-1
2-28 16:37:50
* @LastEditors: peii
* @LastEditors: peii
* @Vision: 1.0
* @Vision: 1.0
* @Description:
* @Description:
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
// @ts-nocheck
// @ts-nocheck
import
React
,
{
useState
,
useEffect
}
from
'react'
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
View
,
StatusBar
,
Platform
,
Text
,
Image
,
TouchableOpacity
}
from
'react-native'
import
{
View
,
StatusBar
,
Platform
,
Text
,
Image
,
TouchableOpacity
}
from
'react-native'
import
Resolution
from
'../../components/common/Resolution'
import
{
g
,
isIphoneX
}
from
'../../utils/utils'
import
{
g
,
isIphoneX
}
from
'../../utils/utils'
import
{
primary_color
}
from
'../../assets/styles/base'
import
{
primary_color
}
from
'../../assets/styles/base'
import
styles
from
'./header.styl'
import
styles
from
'./header.styl'
...
@@ -20,12 +21,20 @@ import styles from './header.styl'
...
@@ -20,12 +21,20 @@ import styles from './header.styl'
function
header
({
title
,
backgroundColor
=
primary_color
,
back
=
true
,
backCallback
=
()
=>
{},
children
})
{
function
header
({
title
,
backgroundColor
=
primary_color
,
back
=
true
,
backCallback
=
()
=>
{},
children
})
{
const
[
statusHeight
]
=
useState
(
Platform
.
OS
===
'android'
?
0
:
isIphoneX
()
?
44
:
20
)
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
// const height = Platform.OS === 'android' ? 0 : isIphoneX() ? 44 : 20
// setStatusHeight(height)
// setStatusHeight(height)
// store.setHeaderHeight(height + 58)
// store.setHeaderHeight(height + 58)
// }, [])
const
res
=
Resolution
.
get
()
let
height
=
barHeight
/
res
.
scale
if
(
isIphoneX
())
{
height
+=
4
}
setHeaderHeight
(
height
)
},
[])
return
(
return
(
<
View
style=
{
g
(
styles
,
'header'
)
}
>
<
View
style=
{
g
(
styles
,
'header'
)
}
>
...
@@ -35,7 +44,7 @@ function header({ title, backgroundColor = primary_color, back = true, backCallb
...
@@ -35,7 +44,7 @@ function header({ title, backgroundColor = primary_color, back = true, backCallb
</
View
>
</
View
>
{
/* 标题栏 */
}
{
/* 标题栏 */
}
<
View
style=
{
g
(
styles
,
'header-bar'
)
}
>
<
View
style=
{
[
g
(
styles
,
'header-bar'
),
{
height
:
barHeight
}]
}
>
{
/* 返回按钮 */
}
{
/* 返回按钮 */
}
{
!!
back
&&
(
{
!!
back
&&
(
<
TouchableOpacity
<
TouchableOpacity
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment