Skip to content

Commit

Permalink
refactor(Layout): 使用函数组件替换Class组件
Browse files Browse the repository at this point in the history
  • Loading branch information
nullptr-z committed Feb 25, 2023
1 parent 09cc7ef commit e99c529
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions packages/core/src/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,16 @@ export interface LayoutProps {
style?: ViewStyle;
}

export default class Layout extends PureComponent<LayoutProps> {
static Header = Header;
static Body = Body;
static Footer = Footer;
static Card = Card;
render() {
const { children, style } = this.props;
return <View style={[styles.container, style]}>{children}</View>;
}
export default function Layout(props: LayoutProps) {
const { children, style } = props;
return <View style={[styles.container, style]}>{children}</View>;
}

Layout.Header = Header;
Layout.Body = Body;
Layout.Footer = Footer;
Layout.Card = Card;

const styles = StyleSheet.create({
container: {
backgroundColor: '#ededed',
Expand Down

0 comments on commit e99c529

Please sign in to comment.