Skip to content

Commit 1f9b413

Browse files
committed
feat(ScreenRoot):增加StatusBarProps api
1 parent 2990f9f commit 1f9b413

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

example/examples/src/routes/ScreenRoot/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {ComProps} from '../../routes';
55

66
export interface ScreenRootProps extends ComProps {}
77

8-
export default class Demo extends React.Component<ScreenRootProps> {
8+
export default class ScreenRootDemo extends React.Component<ScreenRootProps> {
99
render() {
1010
const HeaderRight = () => (
1111
<TouchableOpacity onPress={() => {}}>

packages/core/src/ScreenRoot/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ import {
99
Platform,
1010
StatusBar,
1111
StyleProp,
12+
StatusBarProps,
1213
} from 'react-native';
1314
import Icon from '../Icon';
1415
import MaskLayer from '../MaskLayer';
1516

16-
export interface ScreenRootProps {
17+
export interface ScreenRootProps extends StatusBarProps {
1718
/**
1819
* 无需头部导航栏
1920
*/
@@ -49,6 +50,7 @@ export interface ScreenRootProps {
4950
pageType?: 'screen' | 'modal';
5051
children?: React.ReactNode;
5152
barStyle?: 'default' | 'light-content' | 'dark-content';
53+
statusBarProps?: StatusBarProps;
5254
}
5355

5456
const ScreenRoot = (props: ScreenRootProps) => {
@@ -79,6 +81,7 @@ const ScreenRoot = (props: ScreenRootProps) => {
7981
// 状态栏主题 default light-content dark-content
8082
barStyle = 'dark-content',
8183
headerRightStyle = {},
84+
statusBarProps = {},
8285
} = props;
8386

8487
const isScreen = pageType === 'screen';
@@ -144,7 +147,7 @@ const ScreenRoot = (props: ScreenRootProps) => {
144147

145148
return (
146149
<SafeAreaView style={[isScreen ? {} : { backgroundColor: modalBackgroundColor, ...rootStyle }, { flex: 1 }]}>
147-
<StatusBar barStyle={barStyle} backgroundColor="red" translucent={true} animated={true} />
150+
<StatusBar barStyle={barStyle} backgroundColor="red" translucent={true} animated={true} {...statusBarProps} />
148151
{loading && (
149152
<MaskLayer visible={loading} opacity={0.3}>
150153
<ActivityIndicator color="#333" size="large" style={{ marginTop: 300 }} />
@@ -197,7 +200,7 @@ const styles = StyleSheet.create({
197200
},
198201
title: {
199202
color: '#333',
200-
fontSize: 16,
203+
fontSize: 17,
201204
fontWeight: '600',
202205
},
203206
rightContainer: {

0 commit comments

Comments
 (0)