Skip to content

Commit b586a31

Browse files
committed
fix(ImageHeader):优化ImageHeader图片头部组件组件
1 parent 1e3255a commit b586a31

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

packages/core/src/ImageHeader/README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
### 1. 基础示例 ImageHeader
66

7-
```jsx
7+
<!--DemoStart-->
8+
```jsx mdx:preview&background=#bebebe29
89
import React, { Component } from 'react';
910
import { ImageHeader,Avatar } from '@uiw/react-native';
1011
import { View, Text } from 'react-native';
@@ -13,7 +14,7 @@ function Demo () {
1314
return (
1415
<ImageHeader
1516
safeBgColor='#010101'
16-
headerHeight={150}
17+
headerHeight={200}
1718
headerLeft={<></>}
1819
>
1920
<View style={{
@@ -65,6 +66,8 @@ function Demo () {
6566
}
6667
export default Demo
6768
```
69+
<!--End-->
70+
6871
## ImageHeader 组件 API
6972

7073
| 属性 | 必填 | 说明 | 类型 | 默认值 |
@@ -74,12 +77,13 @@ export default Demo
7477
| headerLeft | `false` | 头部左侧内容 | `ReactNode` | |
7578
| headerLeftColor | `false` | 左侧返回键和字体颜色 | `string` | `theme.colors.primaryColor` |
7679
| headerBackgroundColor | `false` | 头部背景颜色 | `string` | `transparent` |
77-
| headerBackgroundImg | `true` | 头部背景图片 | `ImageSourcePropType` | |
80+
| safeBgColor | `true` | 设置全局背景色 | `string` | |
7881
| headerHeight | `false` | 头部高度 | `number` | |
7982
| onPress | `false` | 左边图标点击事件 | `() => void` | |
8083
| showLeft | `false` | 是否显示左边图标 | `boolean` | `true` |
84+
| statusBarStyle | `false` | 设置状态栏颜色 | `'default' | 'dark-content' | 'light-content'` | `default` |
8185

82-
## AnimateHeader 组件 API
86+
<!-- ## AnimateHeader 组件 API
8387
8488
| 属性 | 必填 | 说明 | 类型 | 默认值 |
8589
| --- | --- | --- | --- | --- |
@@ -93,4 +97,4 @@ export default Demo
9397
| headerLeftColor | `false` | 左侧返回键和字体颜色 | `string` | `theme.colors.primaryColor` |
9498
| headerBackgroundColor | `false` | 头部背景颜色 | `string` | `transparent` |
9599
| onPress | `false` | 左边按钮点击事件 | `() => void` | |
96-
| showLeft | `false` | 是否显示左边图标 | `boolean` | `true` |
100+
| showLeft | `false` | 是否显示左边图标 | `boolean` | `true` | -->

packages/core/src/ImageHeader/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { FC, PropsWithChildren, ReactNode } from 'react';
22
import { Text, SafeAreaView, StatusBar, TouchableOpacity, View, Platform } from 'react-native';
3-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
43
import { Theme } from '../theme';
54
import { useTheme } from '@shopify/restyle';
65

@@ -37,7 +36,6 @@ export type ImageHeaderProps = PropsWithChildren<{
3736

3837
const ImageHeader: FC<ImageHeaderProps> = (props) => {
3938
const theme = useTheme<Theme>();
40-
const insets = useSafeAreaInsets();
4139

4240
const {
4341
headerRight,
@@ -71,7 +69,7 @@ const ImageHeader: FC<ImageHeaderProps> = (props) => {
7169
<SafeAreaView style={{ width: '100%', height: headerHeight, backgroundColor: safeBgColor }}>
7270
<Flex
7371
style={{
74-
paddingTop: isIOS ? insets.top + theme.spacing.x2 : theme.spacing.x5,
72+
paddingTop: isIOS ? theme.spacing.x2 : theme.spacing.x5,
7573
paddingBottom: theme.spacing.x2,
7674
paddingRight: theme.spacing.x3,
7775
backgroundColor: headerBackgroundColor,

website/src/routes/menus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const componentMenus: MenuData[] = [
4343
{ path: '/components/transitionImage', name: 'TransitionImage 图片过渡' },
4444
{ path: '/components/verificationCode', name: 'VerificationCode 验证码倒计时组件' },
4545
{ path: '/components/loginPage', name: 'LoginPage 登录页组件' },
46-
{ path: '/components/imageHeader', name: 'imageHeader 图片头部组件' },
46+
{ path: '/components/imageHeader', name: 'ImageHeader 图片头部组件' },
4747

4848
{ divider: true, name: 'Data Display 信息录入' },
4949
{ path: '/components/checkbox', name: 'CheckBox 复选框' },

0 commit comments

Comments
 (0)