-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFooter.tsx
56 lines (44 loc) · 1.98 KB
/
Footer.tsx
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
// Footer.tsx
import React from 'react';
import { View, TouchableOpacity, Image, Text } from 'react-native';
import GraphContent from './GraphContent';
import HomeContent from './HomeContent';
import ControlContent from './ControlContent';
import SettingContent from './SettingContent';
type Section = 'Home' | 'Control' | 'Graph' | 'Settings';
interface FooterProps {
onSectionPress: (section: Section) => void;
activeSection: Section;
}
const Footer: React.FC<FooterProps> = ({ onSectionPress, activeSection }) => {
const handleSectionPress = (section: Section) => {
onSectionPress(section);
};
return (
<View
style={{
flexDirection: 'row',
justifyContent: 'space-around',
padding: 10,
backgroundColor: '#d6dbbd',
}}>
<TouchableOpacity onPress={() => handleSectionPress('Graph')}>
<Image source={require('./assets/graph.png')} style={{ width: 30, height: 30 }} />
<Text style={{ color: activeSection === 'Graph' ? '#ff6600' : '#1a1a00' }}>Graph</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => handleSectionPress('Home')}>
<Image source={require('./assets/home.png')} style={{ width: 30, height: 30 }} />
<Text style={{ color: activeSection === 'Home' ? '#ff6600' : '#1a1a00' }}>Home</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => handleSectionPress('Control')}>
<Image source={require('./assets/button.png')} style={{ width: 30, height: 30 }} />
<Text style={{ color: activeSection === 'Control' ? '#ff6600' : '#1a1a00' }}>Control</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => handleSectionPress('Settings')}>
<Image source={require('./assets/SETTING.png')} style={{ width: 30, height: 30 }} />
<Text style={{ color: activeSection === 'Settings' ? '#ff6600' : '#1a1a00' }}>Setting</Text>
</TouchableOpacity>
</View>
);
};
export default Footer;