11import React from 'react' ;
22import { View , Text , StyleSheet , Dimensions , ScrollView } from 'react-native' ;
33import BodyRow from './BodyRow' ;
4+ import { colors } from '../utils'
45
56interface TableProps {
67 data : Array < Object > ;
@@ -26,7 +27,7 @@ const Table = ({ data, columns, rowKey, horizontal = true, style }: TableProps)
2627
2728 return (
2829 < ScrollView style = { [ styles . conW , style ] } horizontal = { horizontal } >
29- < View >
30+ < ScrollView horizontal = { ! horizontal } >
3031 < View style = { styles . conTitle } >
3132 { columns . map ( ( itm , idx ) => (
3233 < View
@@ -44,40 +45,34 @@ const Table = ({ data, columns, rowKey, horizontal = true, style }: TableProps)
4445 key = { key }
4546 columns = { columns }
4647 record = { item }
47- style = { { borderBottomWidth : idx === data . length - 1 ? 0 : 1 } }
48+ style = { { borderBottomWidth : idx === data . length - 1 ? 1 : 1 } }
4849 />
4950 ) ;
5051 } ) }
5152 { data . length === 0 && < Text style = { styles . noDataText } > 暂无数据...</ Text > }
52- </ View >
53+ </ ScrollView >
5354 </ ScrollView >
5455 ) ;
5556} ;
5657
5758const styles = StyleSheet . create ( {
5859 title : {
59- backgroundColor : '#fff' ,
60+ backgroundColor : colors . white ,
6061 height : 30 ,
6162 } ,
6263 conTitle : {
6364 flexDirection : 'row' ,
64- borderBottomWidth : 1 ,
65- borderColor : '#E5E5E5' ,
65+ borderWidth : 1 ,
66+ borderColor : colors . colorsPalette . dark70 ,
6667 } ,
6768 content : {
68- color : '#888888' ,
69- } ,
70- conn : {
71- flexDirection : 'row' ,
72- borderBottomWidth : 1 ,
73- borderColor : '#E5E5E5' ,
69+ color : colors . colorsPalette . dark30 ,
7470 } ,
75-
7671 contRight : {
7772 borderRightWidth : 1 ,
7873 flex : 1 ,
79- borderRightColor : '#E5E5E5' ,
80- borderBottomColor : '#E5E5E5' ,
74+ borderRightColor : colors . colorsPalette . dark70 ,
75+ borderBottomColor : colors . colorsPalette . dark70 ,
8176 color : '#888888' ,
8277 flexDirection : 'row' ,
8378 alignItems : 'center' ,
@@ -86,30 +81,14 @@ const styles = StyleSheet.create({
8681 paddingBottom : 5 ,
8782 } ,
8883 conW : {
89- borderTopLeftRadius : 5 ,
90- borderTopRightRadius : 5 ,
91- // overflow: 'hidden',
92- borderWidth : 1 ,
93- borderTopWidth : 0 ,
94- borderColor : '#E5E5E5' ,
95- // marginTop: 10,
96- width : Dimensions . get ( 'window' ) . width ,
97- backgroundColor : '#fff' ,
98- // marginBottom: 20
84+ backgroundColor : colors . white ,
9985 } ,
10086 noDataText : {
10187 color : '#888888' ,
10288 textAlign : 'center' ,
10389 paddingTop : 4 ,
10490 paddingBottom : 4 ,
105- } ,
106- row : {
107- flex : 1 ,
108- flexDirection : 'row' ,
109- justifyContent : 'center' ,
110- borderBottomWidth : 1 ,
111- borderColor : '#E5E5E5' ,
112- } ,
91+ }
11392} ) ;
11493
11594export default Table ;
0 commit comments