This repository was archived by the owner on Apr 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 127
/
Copy pathApp.js
88 lines (82 loc) · 1.99 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
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
import React from 'react'
import { View, StyleSheet, Image } from 'react-native'
import BottomNavigation, {
IconTab,
Badge
} from 'react-native-material-bottom-navigation'
import Icon from '@expo/vector-icons/MaterialCommunityIcons'
export default class App extends React.Component {
state = {
activeTab: 'games'
}
tabs = [
{
key: 'games',
label: 'Games',
barColor: '#388E3C',
pressColor: 'rgba(255, 255, 255, 0.16)',
icon: 'gamepad-variant'
},
{
key: 'movies-tv',
label: 'Movies & TV',
barColor: '#00695C',
pressColor: 'rgba(255, 255, 255, 0.16)',
icon: 'movie'
},
{
key: 'music',
label: 'Music',
barColor: '#6A1B9A',
pressColor: 'rgba(255, 255, 255, 0.16)',
icon: 'music-note'
},
{
key: 'books',
label: 'Books',
barColor: '#1565C0',
pressColor: 'rgba(255, 255, 255, 0.16)',
icon: 'book'
}
]
state = {
activeTab: this.tabs[0].key
}
renderIcon = icon => ({ isActive }) => (
<Icon size={24} color="white" name={icon} />
)
renderTab = ({ tab, isActive }) => (
<IconTab
isActive={isActive}
showBadge={tab.key === 'movies-tv'}
renderBadge={() => <Badge>2</Badge>}
key={tab.key}
label={tab.label}
renderIcon={this.renderIcon(tab.icon)}
/>
)
render() {
return (
<View style={{ flex: 1, backgroundColor: 'white' }}>
<View style={{ flex: 1, justifyContent: 'flex-end' }}>
<Image
source={require('./cut.png')}
style={{
resizeMode: 'contain',
width: 412,
bottom: -120,
opacity: 0.5
}}
/>
</View>
<BottomNavigation
tabs={this.tabs}
activeTab={this.state.activeTab}
onTabPress={newTab => this.setState({ activeTab: newTab.key })}
renderTab={this.renderTab}
useLayoutAnimation
/>
</View>
)
}
}