@quintype/native-components 2.29.1-beta.4 → 2.29.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/native-components",
|
|
3
|
-
"version": "2.29.
|
|
3
|
+
"version": "2.29.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
"lint-staged": "^10.5.3",
|
|
17
17
|
"prop-types": "15.7.2",
|
|
18
18
|
"quintype-js": "1.2.1",
|
|
19
|
-
"react-csv-reader": "^4.0.0",
|
|
20
19
|
"react-htmltext": "^0.40.2",
|
|
21
20
|
"react-native-fast-image": ">=8.3.2",
|
|
22
21
|
"react-native-image-pan-zoom": "^2.1.12",
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View,
|
|
1
|
+
import React, {useContext} from 'react';
|
|
2
|
+
import { View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
AppTheme
|
|
5
|
+
} from "@quintype/native-components";
|
|
6
|
+
import Icon from "react-native-vector-icons/MaterialIcons";
|
|
7
|
+
import { Text } from '@quintype/native-components/src/components/Text';
|
|
8
|
+
import {styles as paginationStyles} from "./styles";
|
|
3
9
|
|
|
4
10
|
const Pagination = ({ currentPage, totalPages, onPageChange }) => {
|
|
11
|
+
const { theme } = useContext(AppTheme);
|
|
12
|
+
const { COLORS, FONT_SIZE } = theme;
|
|
13
|
+
const styles = paginationStyles(COLORS, FONT_SIZE);
|
|
14
|
+
if(totalPages == 1) return null;
|
|
5
15
|
const range = 2;
|
|
6
16
|
|
|
7
17
|
const getPages = () => {
|
|
@@ -33,18 +43,17 @@ const Pagination = ({ currentPage, totalPages, onPageChange }) => {
|
|
|
33
43
|
onPress={() => handlePageChange(currentPage - 1)}
|
|
34
44
|
disabled={currentPage === 1}
|
|
35
45
|
style={[styles.arrow, currentPage === 1 && styles.disabled]}>
|
|
36
|
-
<
|
|
46
|
+
<Icon style={styles.iconStyle} name="arrow-back-ios-new" color={COLORS.BRAND_BLACK} size={FONT_SIZE.h5}/>
|
|
37
47
|
</TouchableOpacity>
|
|
38
48
|
|
|
39
49
|
{pages.map((page, index) => (
|
|
40
50
|
<TouchableOpacity
|
|
41
51
|
key={index}
|
|
42
52
|
onPress={() => handlePageChange(page)}
|
|
43
|
-
|
|
53
|
+
disabled={page === '...'}
|
|
44
54
|
style={[
|
|
45
55
|
styles.pageButton,
|
|
46
56
|
page === currentPage && styles.activePage,
|
|
47
|
-
|
|
48
57
|
]}
|
|
49
58
|
>
|
|
50
59
|
<Text style={styles.pageText}>
|
|
@@ -52,61 +61,16 @@ const Pagination = ({ currentPage, totalPages, onPageChange }) => {
|
|
|
52
61
|
</Text>
|
|
53
62
|
</TouchableOpacity>
|
|
54
63
|
))}
|
|
55
|
-
|
|
56
64
|
<TouchableOpacity
|
|
57
65
|
onPress={() => handlePageChange(currentPage + 1)}
|
|
58
66
|
disabled={currentPage === totalPages}
|
|
59
|
-
style={[styles.arrow, currentPage === totalPages && styles.disabled]}>
|
|
60
|
-
|
|
67
|
+
style={[styles.arrow,{backgroundColor:COLORS.BRAND_WHITE}, currentPage === totalPages && styles.disabled]}>
|
|
68
|
+
|
|
69
|
+
<Icon style={styles.iconStyle} name="arrow-forward-ios" color={COLORS.BRAND_BLACK} size={FONT_SIZE.h5}/>
|
|
61
70
|
</TouchableOpacity>
|
|
62
71
|
</View>
|
|
63
72
|
);
|
|
64
73
|
};
|
|
65
74
|
|
|
66
|
-
const styles = StyleSheet.create({
|
|
67
|
-
container: {
|
|
68
|
-
flexDirection: 'row',
|
|
69
|
-
alignItems: 'center',
|
|
70
|
-
justifyContent: 'center',
|
|
71
|
-
marginVertical: 20,
|
|
72
|
-
|
|
73
|
-
marginHorizontal:20,
|
|
74
|
-
borderRadius:5
|
|
75
|
-
},
|
|
76
|
-
arrow: {
|
|
77
|
-
padding: 5,
|
|
78
|
-
borderRadius: 5,
|
|
79
|
-
backgroundColor: '#f0f0f0',
|
|
80
|
-
height:38,
|
|
81
|
-
paddingHorizontal:10
|
|
82
|
-
},
|
|
83
|
-
arrowText: {
|
|
84
|
-
fontSize: 20,
|
|
85
|
-
color: '#000',
|
|
86
|
-
},
|
|
87
|
-
pageButton: {
|
|
88
|
-
marginHorizontal: 5,
|
|
89
|
-
padding: 10,
|
|
90
|
-
borderRadius: 5,
|
|
91
|
-
backgroundColor: '#f0f0f0',
|
|
92
|
-
height:38,
|
|
93
|
-
paddingHorizontal:12
|
|
94
|
-
},
|
|
95
|
-
pageText: {
|
|
96
|
-
fontSize: 16,
|
|
97
|
-
color: '#000',
|
|
98
|
-
},
|
|
99
|
-
activePage: {
|
|
100
|
-
backgroundColor: '#993366',
|
|
101
|
-
height:38,
|
|
102
|
-
padding: 10,
|
|
103
|
-
},
|
|
104
|
-
disabled: {
|
|
105
|
-
opacity: 0.5,
|
|
106
|
-
},
|
|
107
|
-
disabledText: {
|
|
108
|
-
color: '#ccc',
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
75
|
|
|
112
76
|
export default Pagination;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const styles = (COLORS, FONT_SIZE) => StyleSheet.create({
|
|
4
|
+
container: {
|
|
5
|
+
flexDirection: 'row',
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
justifyContent: 'center',
|
|
8
|
+
marginVertical: 20,
|
|
9
|
+
marginHorizontal:20,
|
|
10
|
+
borderRadius:5,
|
|
11
|
+
},
|
|
12
|
+
arrow: {
|
|
13
|
+
padding: 5,
|
|
14
|
+
borderRadius: 5,
|
|
15
|
+
backgroundColor: COLORS.BRAND_WHITE,
|
|
16
|
+
height:38,
|
|
17
|
+
paddingHorizontal:10,
|
|
18
|
+
shadowColor: "rgba(190,190,190,0.3)",
|
|
19
|
+
shadowOffset: { width: 0, height: 2.0 },
|
|
20
|
+
shadowOpacity: 1,
|
|
21
|
+
shadowRadius: 4,
|
|
22
|
+
elevation: 10,
|
|
23
|
+
},
|
|
24
|
+
arrowText: {
|
|
25
|
+
fontSize: 20,
|
|
26
|
+
color: COLORS.BRAND_BLACK,
|
|
27
|
+
},
|
|
28
|
+
pageButton: {
|
|
29
|
+
marginHorizontal: 2,
|
|
30
|
+
padding: 10,
|
|
31
|
+
borderRadius: 5,
|
|
32
|
+
backgroundColor: COLORS.BRAND_WHITE,
|
|
33
|
+
minHeight:38,
|
|
34
|
+
paddingHorizontal:12,
|
|
35
|
+
shadowColor: "rgba(190,190,190,0.3)",
|
|
36
|
+
shadowOffset: { width: 0, height: 2.0 },
|
|
37
|
+
shadowOpacity: 1,
|
|
38
|
+
shadowRadius: 4,
|
|
39
|
+
elevation: 100,
|
|
40
|
+
},
|
|
41
|
+
pageText: {
|
|
42
|
+
color: COLORS.BRAND_BLACK,
|
|
43
|
+
fontSize:FONT_SIZE.h6
|
|
44
|
+
},
|
|
45
|
+
activePage: {
|
|
46
|
+
borderColor: COLORS.BRAND_1,
|
|
47
|
+
minHeight:38,
|
|
48
|
+
padding: 10,
|
|
49
|
+
borderWidth:1
|
|
50
|
+
},
|
|
51
|
+
disabled: {
|
|
52
|
+
opacity: 0.5,
|
|
53
|
+
},
|
|
54
|
+
disabledText: {
|
|
55
|
+
color: COLORS.MONO6,
|
|
56
|
+
},
|
|
57
|
+
iconStyle:{
|
|
58
|
+
alignSelf: 'center',
|
|
59
|
+
marginTop:7
|
|
60
|
+
}
|
|
61
|
+
});
|
|
@@ -19,15 +19,13 @@ export const Table = ({ card }) => {
|
|
|
19
19
|
{},
|
|
20
20
|
);
|
|
21
21
|
|
|
22
|
-
const tableData =
|
|
22
|
+
const tableData = headerData;
|
|
23
23
|
const [filteredData, setFilteredData] = React.useState([]);
|
|
24
24
|
const [activePage, setActivePage] = React.useState(1);
|
|
25
25
|
|
|
26
26
|
useEffect(()=>{
|
|
27
27
|
const nextData = tableData.slice(Math.max(0, (activePage - 1) * 10), activePage * 10);
|
|
28
|
-
|
|
29
|
-
setFilteredData(nextData)
|
|
30
|
-
}
|
|
28
|
+
setFilteredData([tableHeaderRow].concat(nextData))
|
|
31
29
|
},[activePage])
|
|
32
30
|
|
|
33
31
|
const renderTableBody = () => (
|
|
@@ -50,7 +48,7 @@ export const Table = ({ card }) => {
|
|
|
50
48
|
|
|
51
49
|
return (
|
|
52
50
|
<>
|
|
53
|
-
<Pagination currentPage={activePage} totalPages={tableData.length / 10} onPageChange={onPageChange}/>
|
|
51
|
+
{filteredData.length > 1 && <Pagination currentPage={activePage} totalPages={parseInt(tableData.length % 10 === 0 ? tableData.length /10 : tableData.length /10+1)} onPageChange={onPageChange}/>}
|
|
54
52
|
<ScrollView horizontal>
|
|
55
53
|
<View style={styles.tableContainer}>
|
|
56
54
|
{filteredData && <View>{renderTableBody()}</View>}
|