Files
vf_react/argon-pro-react-native/screens/Home.js
2026-01-13 15:10:13 +08:00

53 lines
1.2 KiB
JavaScript

import React from "react";
import { StyleSheet, Dimensions, ScrollView } from "react-native";
import { Block, theme, Text } from "galio-framework";
import { Card } from "../components";
import articles from "../constants/articles";
const { width } = Dimensions.get("screen");
class Home extends React.Component {
renderArticles = () => {
return (
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={styles.articles}
>
<Block flex>
<Card item={articles[0]} horizontal />
<Block flex row>
<Card
item={articles[1]}
style={{ marginRight: theme.SIZES.BASE }}
/>
<Card item={articles[2]} />
</Block>
<Card item={articles[3]} horizontal />
<Card item={articles[4]} full />
</Block>
</ScrollView>
);
};
render() {
return (
<Block flex center style={styles.home}>
{this.renderArticles()}
</Block>
);
}
}
const styles = StyleSheet.create({
home: {
width: width
},
articles: {
width: width - theme.SIZES.BASE * 2,
paddingVertical: theme.SIZES.BASE,
paddingHorizontal: 2
}
});
export default Home;