update
This commit is contained in:
parent
a9ad0114db
commit
da93cfd8fc
17
App.js
17
App.js
|
@ -5,7 +5,7 @@ import { Button, StyleSheet, View } from 'react-native';
|
||||||
import Quote from './js/components/Quote';
|
import Quote from './js/components/Quote';
|
||||||
|
|
||||||
const data = [
|
const data = [
|
||||||
{ text: "Zitat1", author: "Author 1" },
|
{ text: "Lernen ist Erfahrung. Alles andere ist einfach nur Information.", author: "Albert Einstein" },
|
||||||
{ text: "Zitat2", author: "Author 2" },
|
{ text: "Zitat2", author: "Author 2" },
|
||||||
{ text: "Zitat3", author: "Author 3" },
|
{ text: "Zitat3", author: "Author 3" },
|
||||||
{ text: "Zitat4", author: "Author 4" },
|
{ text: "Zitat4", author: "Author 4" },
|
||||||
|
@ -29,9 +29,12 @@ export default class App extends Component {
|
||||||
return (
|
return (
|
||||||
//JSX
|
//JSX
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
|
<Button title="New" onPress={() => alert('Add new')}></Button>
|
||||||
<Quote text={quote.text} author={quote.author} />
|
<Quote text={quote.text} author={quote.author} />
|
||||||
<Button title="Nächstes Zitat" onPress={() => this.setState({ index: nextIndex })} />
|
<View style={styles.button}>
|
||||||
<Button title="Letztes Zitat" onPress={() => this.setState({ index: prevIndex })} />
|
<Button title="Nächstes Zitat" onPress={() => this.setState({ index: nextIndex })} />
|
||||||
|
<Button title="Letztes Zitat" onPress={() => this.setState({ index: prevIndex })} />
|
||||||
|
</View>
|
||||||
<StatusBar style="auto" />
|
<StatusBar style="auto" />
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
@ -42,8 +45,14 @@ export default class App extends Component {
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: '#fff',
|
backgroundColor: '#F2F0FF',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
|
elevation: 100,
|
||||||
|
|
||||||
|
},
|
||||||
|
button: {
|
||||||
|
position: 'absolute',
|
||||||
|
bottom: 5,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { Component, Fragment } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { Text, StyleSheet } from 'react-native'
|
import { Text, StyleSheet, View } from 'react-native'
|
||||||
|
|
||||||
export default class Quote extends Component {
|
export default class Quote extends Component {
|
||||||
render() {
|
render() {
|
||||||
|
@ -15,12 +15,17 @@ export default class Quote extends Component {
|
||||||
|
|
||||||
|
|
||||||
// Methode 2
|
// Methode 2
|
||||||
<Fragment>
|
/*<Fragment>
|
||||||
<Text style={styles.text}>{text}</Text>
|
<Text style={styles.text}>{text}</Text>
|
||||||
<Text style={styles.author}>— {author}</Text>
|
<Text style={styles.author}>— {author}</Text>
|
||||||
</Fragment>);
|
</Fragment>);
|
||||||
|
*/
|
||||||
|
|
||||||
|
// View -> Style
|
||||||
|
<View style={styles.container}>
|
||||||
|
<Text style={styles.text}>{text}</Text>
|
||||||
|
<Text style={styles.author}>— {author}</Text>
|
||||||
|
</View>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,19 +42,37 @@ const styleAuthor = { fontSize: 15, fontsStyle: 'italic', color: 'red' };
|
||||||
|
|
||||||
// StyleSheet.create({...styles...})
|
// StyleSheet.create({...styles...})
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
//paddingLeft: 20,
|
||||||
|
//paddingRight:20.
|
||||||
|
paddingHorizontal: 20, // -> padding (left and right)
|
||||||
|
borderColor: 'red',
|
||||||
|
margin: 25,
|
||||||
|
borderRadius: 20,
|
||||||
|
backgroundColor: 'white',
|
||||||
|
|
||||||
|
//Shadow for Android
|
||||||
|
elevation: 5,
|
||||||
|
|
||||||
|
//Shadow for IOS and Web
|
||||||
|
shadowOpacity: 0.25,
|
||||||
|
shadowOffset: {
|
||||||
|
width: 0,
|
||||||
|
height: 0.75,
|
||||||
|
},
|
||||||
|
shadowRadius: 1.5,
|
||||||
|
},
|
||||||
text: {
|
text: {
|
||||||
fontSize: 25,
|
fontSize: 25,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
color: 'black',
|
color: 'black',
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
// View Styles
|
// View Style
|
||||||
borderWidth: 2,
|
|
||||||
borderColor: 'red'
|
|
||||||
|
|
||||||
},
|
},
|
||||||
author: {
|
author: {
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
fontStyle: 'italic',
|
fontStyle: 'italic',
|
||||||
|
textAlign: 'right',
|
||||||
color: 'green'
|
color: 'green'
|
||||||
}
|
}
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user