Last active
September 24, 2022 11:11
-
-
Save lucasferreira/20e9efa18f777bde127bc897f484b79f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { StatusBar } from "expo-status-bar"; | |
import { StyleSheet, SafeAreaView, ScrollView, View, Text } from "react-native"; | |
import { Provider as PaperProvider, Button } from "react-native-paper"; | |
import KittenCard from "./components/KittenCard"; | |
export default function App() { | |
return ( | |
<PaperProvider> | |
<StatusBar style="auto" translucent={false} /> | |
<SafeAreaView style={{ flex: 1 }}> | |
<ScrollView> | |
<KittenCard | |
style={{ borderWidth: 2, borderColor: "red", marginBottom: 32 }} | |
image="https://placekitten.com/390/240" | |
title="Teste do primeiro gatinho" | |
buttonLabel="Saiba mais sobre este gatinho" | |
buttonPress={() => { | |
alert("Clicou no primeiro botão"); | |
}} | |
> | |
<Text>Texto de apoio falando sobre o gatinho bonito</Text> | |
<View style={{ width: 30, height: 30, backgroundColor: "green", marginBottom: 21 }} /> | |
<Text>Mais texto</Text> | |
<Button mode="outlined" onPress={() => {}}> | |
Pouco botão né | |
</Button> | |
</KittenCard> | |
<KittenCard | |
style={{ marginBottom: 21 }} | |
image="https://www.fillmurray.com/390/240" | |
title="Teste do outro" | |
buttonPress={() => { | |
alert("Clicou no bill murray"); | |
}} | |
/> | |
<KittenCard | |
title="Teste do terceiro" | |
text="Texto de apoio falando sobre o gatinho bonito" | |
buttonPress={() => { | |
alert("Clicou no último"); | |
}} | |
/> | |
</ScrollView> | |
</SafeAreaView> | |
</PaperProvider> | |
); | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
padding: 16, | |
}, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Card, Button } from "react-native-paper"; | |
export default function KittenCard({ image, title, children, buttonLabel = "Clique aqui", buttonPress, ...props }) { | |
return ( | |
<Card {...props}> | |
{image && <Card.Cover source={{ uri: image }} />} | |
<Card.Title title={title} /> | |
{children && <Card.Content>{children}</Card.Content>} | |
<Card.Actions> | |
<Button mode="contained" onPress={buttonPress}> | |
{buttonLabel} | |
</Button> | |
</Card.Actions> | |
</Card> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment