Application Android et IOS pour l'amicale des élèves https://play.google.com/store/apps/details?id=fr.amicaleinsat.application
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Test.tsx 4.0KB

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