-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ios.js
49 lines (42 loc) · 902 Bytes
/
index.ios.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
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
View,
} from 'react-native';
import AddBirthdayCard from 'AddBirthdayCard';
import BirthdayRow from 'BirthdayRow';
class Birthdays extends Component {
state: {
people: Person[],
} = {
people: [],
}
_savePerson = (person: Person) => {
let newPeople = this.state.people.slice(0);
newPeople.push(person);
this.setState({
people: newPeople,
});
};
render() {
return (
<View style={STYLES.root}>
<BirthdayRow person={this.state.people[0]} />
<AddBirthdayCard onSave={this._savePerson} />
</View>
);
}
}
const STYLES = StyleSheet.create({
root: {
marginTop: 20,
flex: 1,
},
});
AppRegistry.registerComponent('Birthdays', () => Birthdays);