-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNavigation.js
50 lines (46 loc) · 1.15 KB
/
Navigation.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
import React from 'react';
import {StyleSheet, Text, SafeAreaView, TouchableOpacity, View} from 'react-native';
export default function Navigation(props) {
const NAV = [...Array(props.amount).keys()];
return (
<SafeAreaView style={styles.container}>
<View style={styles.fixer}>
{NAV.map((e, i) => (
<TouchableOpacity onPress={() => props.setTab(e)} style={[styles.navItem, props.current === e && styles.navItemCurrent]}>
<Text style={[styles.text, props.current === e && styles.textCurrent]}>Ex {e}</Text>
</TouchableOpacity>
))}
</View>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
backgroundColor: '#e9ecef',
},
fixer: {
flexDirection: 'row',
justifyContent: 'space-around',
paddingHorizontal: 8,
paddingVertical: 8,
},
navItem: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingVertical: 10,
},
navItemCurrent: {
backgroundColor: '#06f',
borderRadius: 6,
},
text: {
textAlign: 'center',
fontSize: 18,
fontWeight: 'bold',
color: '#06f'
},
textCurrent: {
color: '#fff'
}
});