-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHomeScreen.js
81 lines (75 loc) · 1.89 KB
/
HomeScreen.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import React from 'react';
import { Text, ScrollView } from 'react-native';
import { SafeAreaView } from 'react-native';
import { Link } from '@react-navigation/native';
import { connect } from 'react-redux';
import BottomNavigation from './BottomNavigation';
import { Button } from 'react-native-elements';
import styles from './styles';
import Screen from './Screen';
const HomeScreen = ({ navigation, generalSettings, groceryItems }) => {
const BUTTONS = [
{
id: 'groceries',
title: `Groceries (${groceryItems.length})`,
to: 'Groceries',
imageUri: ''
},
{
id: 'chores',
title: 'Chores',
to: 'Chores',
imageUri: ''
},
{
id: 'meals',
title: 'Meals',
to: 'Meals',
imageUri: '',
},
{
id: 'points',
title: 'Points',
to: 'Points',
imageUri: ''
},
{
id: 'bathroomStatus',
title: 'Bathroom Status',
to: 'BathroomStatus',
imageUri: ''
}
];
return (
<Screen screenName="Home" navigation={navigation}>
<Text style={styles.homeScreen.greetingStyle}><Link to="/Settings">{generalSettings.greetingText || "Hello"}</Link></Text>
<ScrollView style={{flex: 1}}>
{
BUTTONS.map(b => (
<Button
key={b.id}
title={b.title}
type={styles.homeScreen.buttonType}
buttonStyle={styles.homeScreen.buttonStyle}
titleStyle={styles.homeScreen.buttonTitleStyle}
rounded={true}
onPress={() => navigation.navigate(b.to)}
/>
))
}
</ScrollView>
</Screen>
);
}
const mapStateToProps = state => {
return {
generalSettings: state.generalSettings,
groceryItems: state.groceryItems
}
}
const mapDispatchToProps = dispatch => ({
})
export default connect(
mapStateToProps,
mapDispatchToProps
)(HomeScreen)