Created
July 4, 2018 09:00
-
-
Save behrends/1969d32ebdce129c4a34dfcd3ae91837 to your computer and use it in GitHub Desktop.
11:00 - Drei Zitate
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 React, { Component } from 'react'; | |
import { Button, StyleSheet, Text, View } from 'react-native'; | |
const data = [ | |
{ | |
text: | |
'Probleme kann man niemals mit derselben Denkweise lösen, durch die sie entstanden sind.', | |
author: 'Albert Einstein' | |
}, | |
{ | |
text: | |
'Man braucht nichts im Leben zu fürchten, man muss nur alles verstehen.', | |
author: 'Marie Curie' | |
}, | |
{ text: 'Nichts ist so beständig wie der Wandel.', author: 'Heraklit' } | |
]; | |
export default class App extends Component { | |
// return JSX code ---> Darstellung der Komponente im UI | |
render() { | |
const quote = data[0]; | |
return ( | |
// JSX | |
<View style={styles.container}> | |
<Text>{quote.text}</Text> | |
<Text>-- {quote.author}</Text> | |
<Button | |
title="Nächstes Zitat" | |
onPress={() => alert('alles klar, Pfeilfunktion!')} | |
/> | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
backgroundColor: 'white' | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment