-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
57 lines (51 loc) · 1.39 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import React, { Component } from 'react';
import { Container, Header, Body, Button, Icon, Left, Right, Tabs, Tab, Title } from 'native-base';
import PercentagesGrid from './app/percentagesGrid';
import RoundUpGrid from './app/roundUpGrid';
import { Alert } from 'react-native';
export default class Main extends Component {
constructor() {
super();
this.state = {
amount: ""
}
}
_showAlert = () => {
Alert.alert(
'About me',
'@GuillaumeHaben',
[
{text: 'OK'},
],
{ cancelable: false }
)
}
handleChangeAmount = (amount) => {
this.setState({amount});
}
render() {
return (
<Container style={{backgroundColor: "#fff"}}>
<Header hasTabs>
<Left></Left>
<Body>
<Title>SmarTip</Title>
</Body>
<Right>
<Button transparent onPress={this._showAlert}>
<Icon active type="MaterialIcons" name="info-outline"/>
</Button>
</Right>
</Header>
<Tabs initialPage={0}>
<Tab heading="Basic">
<PercentagesGrid amount={this.state.amount} onChange={this.handleChangeAmount.bind(this)}/>
</Tab>
<Tab heading="Rounded up">
<RoundUpGrid amount={this.state.amount} onChange={this.handleChangeAmount.bind(this)}/>
</Tab>
</Tabs>
</Container>
)
}
}