-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ios.js
More file actions
93 lines (84 loc) · 2.45 KB
/
index.ios.js
File metadata and controls
93 lines (84 loc) · 2.45 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
Text,
TabBarIOS,
StyleSheet,
View
} from 'react-native';
import PlaceMap from './place_map';
import AddPlace from './add_place';
class myApp extends Component {
constructor() {
super();
this.state = {
selectedTab: 0,
annotations: [
{
title: 'Smithsonian Museum',
latitude: 38.8980,
longitude: -77.0230
},
{
title: 'UMCP',
latitude: 38.9869,
longitude: -76.9426
},
{
title: 'Arlington',
latitude: 38.8783,
longitude: -77.0687
}
]
};
}
handleTabPress(tab) {
this.setState({ selectedTab: tab })
}
handleAddPlace(annotation) {
const annotations = this.state.annotations.slice();
annotations.push(annotation);
this.setState({ annotations });
}
render() {
return (
<TabBarIOS>
<TabBarIOS.Item
systemIcon="favorites"
selected={this.state.selectedTab === 0}
onPress={this.handleTabPress.bind(this, 0)}
>
<PlaceMap annotations={this.state.annotations} />
{/* <View style={styles.view}>
<Text style={styles.text}>Favorite Places</Text>
</View> */}
</TabBarIOS.Item>
<TabBarIOS.Item
title="Place"
icon={require('./assets/pin.png')}
selected={this.state.selectedTab === 1}
onPress={this.handleTabPress.bind(this, 1)}
>
<AddPlace onAddPlace={this.handleAddPlace.bind(this)} />
</TabBarIOS.Item>
</TabBarIOS>
);
}
}
const styles = StyleSheet.create({
text: {
textAlign: 'center',
color: '#333333',
marginTop: 50,
},
view: {
backgroundColor: '#fed',
flex: 1
}
});
AppRegistry.registerComponent('myApp', () => myApp);