generated from demchenkoalex/react-native-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
88 lines (83 loc) · 3.23 KB
/
App.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
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, { useState } from 'react'
import { StyleSheet, SafeAreaView, Text, View, TouchableOpacity } from 'react-native'
import Table from 'react-native-responsive-table-view'
const App = () => {
const [tableName, setTableName] = useState('normal');
return (
<SafeAreaView style={{height:'100%'}}>
<View style={styles.buttonsContainer}>
<TouchableOpacity onPress={()=> setTableName('normal')}>
<Text>Normal</Text>
</TouchableOpacity>
<TouchableOpacity onPress={()=> setTableName("scrollable")}>
<Text>Scrollable</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => setTableName("columns")}>
<Text>Different columns</Text>
</TouchableOpacity>
</View>
<View style={styles.container}>
<Table isScrollable={false} style={{display: tableName === 'normal' ? 'flex':'none'}}>
<Table.Row isLastStyle={{borderBottomWidth:0}}>
<Table.Cell><Text>text 1</Text></Table.Cell>
<Table.Cell><Text>text 2</Text></Table.Cell>
</Table.Row>
<Table.Row isLastStyle={{borderBottomWidth:0}}>
<Table.Cell><Text>text 3</Text></Table.Cell>
<Table.Cell><Text>text 4</Text></Table.Cell>
</Table.Row>
<Table.Row isLastStyle={{borderBottomWidth:0}}>
<Table.Cell><Text>text 5</Text></Table.Cell>
<Table.Cell><Text>text 6</Text></Table.Cell>
</Table.Row>
</Table>
<Table isScrollable={true} style={{display: tableName === 'scrollable' ? 'flex':'none'}}>
<Table.Row isLastStyle={{borderBottomWidth:0}}>
<Table.Cell><Text>text 1</Text></Table.Cell>
<Table.Cell><Text>text 2</Text></Table.Cell>
</Table.Row>
<Table.Row isLastStyle={{borderBottomWidth:0}}>
<Table.Cell><Text>text 3</Text></Table.Cell>
<Table.Cell><Text>text 4</Text></Table.Cell>
</Table.Row>
<Table.Row isLastStyle={{borderBottomWidth:0}}>
<Table.Cell><Text>text 5</Text></Table.Cell>
<Table.Cell><Text>text 6</Text></Table.Cell>
</Table.Row>
</Table>
<Table isScrollable={true} style={{display: tableName === 'columns' ? 'flex':'none'}}>
<Table.Row isLastStyle={{borderBottomWidth:0}}>
<Table.Cell><Text>text 1</Text></Table.Cell>
</Table.Row>
<Table.Row isLastStyle={{borderBottomWidth:0}}>
<Table.Cell><Text>text 2</Text></Table.Cell>
<Table.Cell><Text>text 3</Text></Table.Cell>
</Table.Row>
<Table.Row isLastStyle={{borderBottomWidth:0}}>
<Table.Cell><Text>text 4</Text></Table.Cell>
<Table.Cell><Text>text 5</Text></Table.Cell>
<Table.Cell><Text>text 6</Text></Table.Cell>
</Table.Row>
</Table>
</View>
</SafeAreaView>
)
}
const styles = StyleSheet.create({
buttonsContainer:{
display:'flex',
flexDirection:'row',
justifyContent:'space-around',
alignItems:'center',
paddingHorizontal:24
},
container:{
display:'flex',
flexDirection:'row',
justifyContent:'center',
alignItems:'center',
height:'100%',
paddingHorizontal:24
}
})
export default App