Skip to content

Commit 99390ed

Browse files
author
hy
committed
fix:修复在黑暗主题下,下拉背景颜色还是白色的问题
1 parent f632265 commit 99390ed

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

example/examples/src/Layout/index.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React, {PureComponent} from 'react';
2-
import {StyleSheet, View, ViewProps, ViewStyle, SafeAreaView, ScrollView, ScrollViewProps, Text, TextStyle, Image, StyleProp} from 'react-native';
1+
import React, { PureComponent } from 'react';
2+
import { StyleSheet, View, ViewProps, ViewStyle, SafeAreaView, ScrollView, ScrollViewProps, Text, TextStyle, Image, StyleProp } from 'react-native';
33
import PropTypes from 'prop-types';
4-
import {Theme} from '@uiw/react-native';
5-
import {useTheme} from '@shopify/restyle';
4+
import { Theme } from '@uiw/react-native';
5+
import { useTheme } from '@shopify/restyle';
66

77
export interface HeaderProps {
88
title?: string;
@@ -15,7 +15,7 @@ export interface HeaderProps {
1515
}
1616

1717
const Header = (props: HeaderProps) => {
18-
const {children, title, description, style, hasLogo, titleStyle, descriptionStyle} = props;
18+
const { children, title, description, style, hasLogo, titleStyle, descriptionStyle } = props;
1919
const theme = useTheme<Theme>();
2020
const styles = createStyles({
2121
backgroundColor: theme.colors.background,
@@ -27,7 +27,7 @@ const Header = (props: HeaderProps) => {
2727
{title && <Text style={[styles.title, titleStyle]}>{title}</Text>}
2828
{hasLogo && (
2929
<View style={styles.logo}>
30-
<Image source={require('../image/logo.png')} style={{width: 103, height: 18}} />
30+
<Image source={require('../image/logo.png')} style={{ width: 103, height: 18 }} />
3131
</View>
3232
)}
3333
{description && <Text style={[styles.description, descriptionStyle]}>{description}</Text>}
@@ -43,7 +43,7 @@ export interface BodyProps extends ScrollViewProps {
4343
}
4444

4545
const Body = (props: BodyProps) => {
46-
const {children, style, isScroll, ...other} = props;
46+
const { children, style, isScroll, ...other } = props;
4747
const theme = useTheme<Theme>();
4848
const styles = createStyles({
4949
backgroundColor: theme.colors.background,
@@ -65,7 +65,7 @@ export interface FooterProps {
6565
}
6666

6767
const Footer = (props: FooterProps) => {
68-
const {children, copyright, style, isShowCopyRight, ...other} = props;
68+
const { children, copyright, style, isShowCopyRight, ...other } = props;
6969
const theme = useTheme<Theme>();
7070
const styles = createStyles({
7171
backgroundColor: theme.colors.background,
@@ -91,7 +91,7 @@ export interface CardProps extends ViewProps {
9191
}
9292

9393
const Card = (props: CardProps) => {
94-
const {title, titleStyle, bodyStyle, children, style, showTitle, extra, ...other} = props;
94+
const { title, titleStyle, bodyStyle, children, style, showTitle, extra, ...other } = props;
9595
const theme = useTheme<Theme>();
9696
const styles = createStyles({
9797
backgroundColor: theme.colors.background,
@@ -103,7 +103,7 @@ const Card = (props: CardProps) => {
103103
{extra ? (
104104
<View style={[styles.extra, styles.cardTitle]}>
105105
{showTitle && (
106-
<View style={{flex: 2}}>
106+
<View style={{ flex: 2 }}>
107107
<Text style={[titleStyle]}>{title}</Text>
108108
</View>
109109
)}
@@ -123,37 +123,37 @@ export interface ContainerProps extends ScrollViewProps {
123123
}
124124

125125
export const Container = (props: ContainerProps) => {
126-
const {children, ...others} = props;
126+
const { children, ...others } = props;
127127
const theme = useTheme<Theme>();
128128
const styles = createStyles({
129129
backgroundColor: theme.colors.background,
130130
shadowColor: theme.colors.border,
131131
color: theme.colors.primary_text,
132132
});
133133
return (
134-
<SafeAreaView style={{backgroundColor: '#ededed'}} {...others}>
135-
<ScrollView style={{height: '100%'}} {...others}>
134+
<SafeAreaView style={styles.body} {...others}>
135+
<ScrollView style={{ height: '100%' }} {...others}>
136136
{children}
137137
</ScrollView>
138138
</SafeAreaView>
139139
);
140140
};
141141

142-
export interface LayoutProps extends ViewProps {}
142+
export interface LayoutProps extends ViewProps { }
143143

144144
export default class Layout extends PureComponent<LayoutProps> {
145145
static Header = Header;
146146
static Body = Body;
147147
static Footer = Footer;
148148
static Card = Card;
149149
render() {
150-
const {children, style} = this.props;
150+
const { children, style } = this.props;
151151
const styles = createStyles({});
152152
return <View style={[styles.container, style]}>{children}</View>;
153153
}
154154
}
155155

156-
function createStyles({backgroundColor = '#F7F7F7', shadowColor = '#E6E6E6', color = '#9A9A9A'}) {
156+
function createStyles({ backgroundColor = '#F7F7F7', shadowColor = '#E6E6E6', color = '#9A9A9A' }) {
157157
return StyleSheet.create({
158158
container: {
159159
backgroundColor: backgroundColor,
@@ -167,7 +167,7 @@ function createStyles({backgroundColor = '#F7F7F7', shadowColor = '#E6E6E6', col
167167
paddingRight: 16,
168168
shadowColor: shadowColor,
169169
backgroundColor: backgroundColor,
170-
shadowOffset: {width: 0, height: 3},
170+
shadowOffset: { width: 0, height: 3 },
171171
shadowRadius: 3,
172172
// shadowOpacity: 0.8,
173173
shadowOpacity: 0,

0 commit comments

Comments
 (0)