Skip to content

Commit e99c529

Browse files
committed
refactor(Layout): 使用函数组件替换Class组件
1 parent 09cc7ef commit e99c529

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

packages/core/src/Layout/index.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,16 @@ export interface LayoutProps {
114114
style?: ViewStyle;
115115
}
116116

117-
export default class Layout extends PureComponent<LayoutProps> {
118-
static Header = Header;
119-
static Body = Body;
120-
static Footer = Footer;
121-
static Card = Card;
122-
render() {
123-
const { children, style } = this.props;
124-
return <View style={[styles.container, style]}>{children}</View>;
125-
}
117+
export default function Layout(props: LayoutProps) {
118+
const { children, style } = props;
119+
return <View style={[styles.container, style]}>{children}</View>;
126120
}
127121

122+
Layout.Header = Header;
123+
Layout.Body = Body;
124+
Layout.Footer = Footer;
125+
Layout.Card = Card;
126+
128127
const styles = StyleSheet.create({
129128
container: {
130129
backgroundColor: '#ededed',

0 commit comments

Comments
 (0)