Created
July 4, 2018 08:03
-
-
Save behrends/f536aa3f23066c2e2582f18f843838fb to your computer and use it in GitHub Desktop.
10:05 - Aufbau Komponente
This file contains 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
// i.d.R. 3 Blöcke | |
// 1) imports | |
// ES 2015! | |
import React, { Component } from 'react'; | |
// verwendete UI-Komponenten und APIs importieren | |
import { Button, StyleSheet, Text, View } from 'react-native'; | |
// 2) Komponente | |
// ES 2015! | |
// React: komponentenbasiert, deklarativ | |
export default class App extends Component { | |
// return JSX code ---> Darstellung der Komponente im UI | |
render() { | |
return ( | |
// JSX | |
<View style={styles.container}> | |
<Text> | |
Probleme kann man niemals mit derselben Denkweise lösen, durch die sie | |
entstanden sind. | |
</Text> | |
<Text>--Albert Einstein</Text> | |
</View> | |
); | |
} | |
} | |
// 3) Styles | |
const styles = StyleSheet.create({ | |
container: { | |
// zentriere alles mittig | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
// Hintergrundfarbe setzen | |
backgroundColor: 'white', | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment