Skip to content

Instantly share code, notes, and snippets.

@behrends
Created July 4, 2018 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save behrends/1969d32ebdce129c4a34dfcd3ae91837 to your computer and use it in GitHub Desktop.
Save behrends/1969d32ebdce129c4a34dfcd3ae91837 to your computer and use it in GitHub Desktop.
11:00 - Drei Zitate
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