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.2KB

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