Application Android et IOS pour l'amicale des élèves
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.

Preview.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // @flow
  2. import * as React from 'react';
  3. import {View} from 'react-native';
  4. import {withTheme} from 'react-native-paper';
  5. import type {Grid} from "./GridComponent";
  6. import GridComponent from "./GridComponent";
  7. type Props = {
  8. items: Array<Grid>,
  9. }
  10. class Preview extends React.PureComponent<Props> {
  11. getGrids() {
  12. let grids = [];
  13. for (let i = 0; i < this.props.items.length; i++) {
  14. grids.push(this.getGridRender(this.props.items[i], i));
  15. }
  16. return grids;
  17. }
  18. getGridRender(item: Grid, index: number) {
  19. return <GridComponent
  20. width={item[0].length}
  21. height={item.length}
  22. grid={item}
  23. containerMaxHeight={50}
  24. containerMaxWidth={50}
  25. backgroundColor={'transparent'}
  26. key={index.toString()}
  27. />;
  28. };
  29. render() {
  30. if (this.props.items.length > 0) {
  31. return (
  32. <View>
  33. {this.getGrids()}
  34. </View>
  35. );
  36. } else
  37. return null;
  38. }
  39. }
  40. export default withTheme(Preview);