|
@@ -1,156 +0,0 @@
|
1
|
|
-import { useNavigation } from '@react-navigation/core';
|
2
|
|
-import { StackNavigationProp } from '@react-navigation/stack';
|
3
|
|
-import React from 'react';
|
4
|
|
-import { Animated, View } from 'react-native';
|
5
|
|
-import { Text } from 'react-native-paper';
|
6
|
|
-import {
|
7
|
|
- Collapsible,
|
8
|
|
- useCollapsibleHeader,
|
9
|
|
-} from 'react-navigation-collapsible';
|
10
|
|
-import CollapsibleFlatList from '../components/Collapsible/CollapsibleFlatList';
|
11
|
|
-import FeedItem from '../components/Home/FeedItem';
|
12
|
|
-import WebSectionList from '../components/Screens/WebSectionList';
|
13
|
|
-import withCollapsible from '../utils/withCollapsible';
|
14
|
|
-import { FeedItemType } from './Home/HomeScreen';
|
15
|
|
-import i18n from 'i18n-js';
|
16
|
|
-import CollapsibleSectionList from '../components/Collapsible/CollapsibleSectionList';
|
17
|
|
-
|
18
|
|
-// export default function Test() {
|
19
|
|
-// const {
|
20
|
|
-// onScroll /* Event handler */,
|
21
|
|
-// onScrollWithListener /* Event handler creator */,
|
22
|
|
-// containerPaddingTop /* number */,
|
23
|
|
-// scrollIndicatorInsetTop /* number */,
|
24
|
|
-// /* Animated.AnimatedValue contentOffset from scrolling */
|
25
|
|
-// positionY /* 0.0 ~ length of scrollable component (contentOffset)
|
26
|
|
-// /* Animated.AnimatedInterpolation by scrolling */,
|
27
|
|
-// translateY /* 0.0 ~ -headerHeight */,
|
28
|
|
-// progress /* 0.0 ~ 1.0 */,
|
29
|
|
-// opacity /* 1.0 ~ 0.0 */,
|
30
|
|
-// } = useCollapsibleHeader();
|
31
|
|
-
|
32
|
|
-// const renderItem = () => {
|
33
|
|
-// return (
|
34
|
|
-// <View
|
35
|
|
-// style={{
|
36
|
|
-// marginTop: 50,
|
37
|
|
-// marginBottom: 50,
|
38
|
|
-// }}
|
39
|
|
-// >
|
40
|
|
-// <Text>TEST</Text>
|
41
|
|
-// </View>
|
42
|
|
-// );
|
43
|
|
-// };
|
44
|
|
-
|
45
|
|
-// return (
|
46
|
|
-// <Animated.FlatList
|
47
|
|
-// onScroll={onScroll}
|
48
|
|
-// contentContainerStyle={{ paddingTop: containerPaddingTop }}
|
49
|
|
-// scrollIndicatorInsets={{ top: scrollIndicatorInsetTop }}
|
50
|
|
-// data={[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}
|
51
|
|
-// renderItem={renderItem}
|
52
|
|
-// />
|
53
|
|
-// );
|
54
|
|
-// }
|
55
|
|
-
|
56
|
|
-type Props = {
|
57
|
|
- navigation: StackNavigationProp<any>;
|
58
|
|
- collapsibleStack: Collapsible;
|
59
|
|
-};
|
60
|
|
-
|
61
|
|
-const DATA_URL =
|
62
|
|
- 'https://etud.insa-toulouse.fr/~amicale_app/v2/dashboard/dashboard_data.json';
|
63
|
|
-const FEED_ITEM_HEIGHT = 500;
|
64
|
|
-
|
65
|
|
-const REFRESH_TIME = 1000 * 20; // Refresh every 20 seconds
|
66
|
|
-class Test extends React.Component<Props> {
|
67
|
|
- createDataset = (): Array<{
|
68
|
|
- title: string;
|
69
|
|
- data: [] | Array<FeedItemType>;
|
70
|
|
- id: string;
|
71
|
|
- }> => {
|
72
|
|
- return [
|
73
|
|
- {
|
74
|
|
- title: 'title',
|
75
|
|
- data: [
|
76
|
|
- {
|
77
|
|
- id: '0',
|
78
|
|
- message: 'message',
|
79
|
|
- image: '',
|
80
|
|
- link: '',
|
81
|
|
- page_id: 'amicale.deseleves',
|
82
|
|
- time: 0,
|
83
|
|
- url: '',
|
84
|
|
- video: '',
|
85
|
|
- },
|
86
|
|
- {
|
87
|
|
- id: '1',
|
88
|
|
- message: 'message',
|
89
|
|
- image: '',
|
90
|
|
- link: '',
|
91
|
|
- page_id: 'amicale.deseleves',
|
92
|
|
- time: 0,
|
93
|
|
- url: '',
|
94
|
|
- video: '',
|
95
|
|
- },
|
96
|
|
- {
|
97
|
|
- id: '2',
|
98
|
|
- message: 'message',
|
99
|
|
- image: '',
|
100
|
|
- link: '',
|
101
|
|
- page_id: 'amicale.deseleves',
|
102
|
|
- time: 0,
|
103
|
|
- url: '',
|
104
|
|
- video: '',
|
105
|
|
- },
|
106
|
|
- ],
|
107
|
|
- id: '0',
|
108
|
|
- },
|
109
|
|
- ];
|
110
|
|
- };
|
111
|
|
- getRenderItem = ({ item }: { item: FeedItemType }) => (
|
112
|
|
- <FeedItem item={item} height={FEED_ITEM_HEIGHT} />
|
113
|
|
- );
|
114
|
|
-
|
115
|
|
- render() {
|
116
|
|
- const renderItem = () => {
|
117
|
|
- return (
|
118
|
|
- <View
|
119
|
|
- style={{
|
120
|
|
- marginTop: 50,
|
121
|
|
- marginBottom: 50,
|
122
|
|
- }}
|
123
|
|
- >
|
124
|
|
- <Text>TEST</Text>
|
125
|
|
- </View>
|
126
|
|
- );
|
127
|
|
- };
|
128
|
|
-
|
129
|
|
- const props = this.props;
|
130
|
|
- // return (
|
131
|
|
- // <CollapsibleFlatList
|
132
|
|
- // data={[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}
|
133
|
|
- // renderItem={renderItem}
|
134
|
|
- // />
|
135
|
|
- // );
|
136
|
|
- // return (
|
137
|
|
- // <CollapsibleSectionList
|
138
|
|
- // sections={[{ title: '', data: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }]}
|
139
|
|
- // renderItem={renderItem}
|
140
|
|
- // />
|
141
|
|
- // );
|
142
|
|
- return (
|
143
|
|
- <WebSectionList
|
144
|
|
- createDataset={this.createDataset}
|
145
|
|
- autoRefreshTime={REFRESH_TIME}
|
146
|
|
- refreshOnFocus
|
147
|
|
- fetchUrl={DATA_URL}
|
148
|
|
- renderItem={this.getRenderItem}
|
149
|
|
- itemHeight={FEED_ITEM_HEIGHT}
|
150
|
|
- showError={false}
|
151
|
|
- />
|
152
|
|
- );
|
153
|
|
- }
|
154
|
|
-}
|
155
|
|
-
|
156
|
|
-export default Test;
|