diff --git a/components/Lists/WebSectionList.js b/components/Lists/WebSectionList.js index b0ec351..779d661 100644 --- a/components/Lists/WebSectionList.js +++ b/components/Lists/WebSectionList.js @@ -172,6 +172,7 @@ export default class WebSectionList extends React.PureComponent { {/*$FlowFixMe*/} { this.colors = props.theme.colors; ConnectionManager.getInstance().addLoginStateListener((value) => this.onLoginStateChange(value)); this.state = { - active: 'Home', isLoggedIn: ConnectionManager.getInstance().isLoggedIn(), dialogVisible: false, }; } - showDisconnectDialog = () => this.setState({ dialogVisible: true }); + showDisconnectDialog = () => this.setState({dialogVisible: true}); - hideDisconnectDialog = () => this.setState({ dialogVisible: false }); + hideDisconnectDialog = () => this.setState({dialogVisible: false}); onLoginStateChange(isLoggedIn: boolean) { @@ -238,9 +236,10 @@ class SideBar extends React.PureComponent { style={styles.drawerCover} /> + {/*$FlowFixMe*/} diff --git a/screens/About/AboutScreen.js b/screens/About/AboutScreen.js index 9906098..ca7c942 100644 --- a/screens/About/AboutScreen.js +++ b/screens/About/AboutScreen.js @@ -244,9 +244,7 @@ class AboutScreen extends React.Component { @@ -269,17 +267,15 @@ class AboutScreen extends React.Component { {i18n.t('aboutScreen.author')} {i18n.t('aboutScreen.additionalDev')} @@ -299,9 +295,7 @@ class AboutScreen extends React.Component { {i18n.t('aboutScreen.technologies')} @@ -404,28 +398,24 @@ class AboutScreen extends React.Component { ); @@ -476,8 +466,6 @@ class AboutScreen extends React.Component { item.id} renderItem={this.getMainCard} /> diff --git a/screens/HomeScreen.js b/screens/HomeScreen.js index 6b85bbf..9c60f4e 100644 --- a/screens/HomeScreen.js +++ b/screens/HomeScreen.js @@ -117,16 +117,6 @@ class HomeScreen extends React.Component { this.props.navigation.navigate('SelfMenuScreen'); } - /** - * Extract a key for the given item - * - * @param item The item to extract the key from - * @return {*} The extracted key - */ - getKeyExtractor(item: Object) { - return item !== undefined ? item.id : undefined; - } - /** * Creates the dataset to be used in the FlatList * @@ -145,15 +135,11 @@ class HomeScreen extends React.Component { { title: '', data: dashboardData, - extraData: super.state, - keyExtractor: this.getKeyExtractor, id: SECTIONS_ID[0] }, { title: i18n.t('homeScreen.newsFeed'), data: newsData, - extraData: super.state, - keyExtractor: this.getKeyExtractor, id: SECTIONS_ID[1] } ]; diff --git a/screens/Proximo/ProximoMainScreen.js b/screens/Proximo/ProximoMainScreen.js index b60901d..c816cd5 100644 --- a/screens/Proximo/ProximoMainScreen.js +++ b/screens/Proximo/ProximoMainScreen.js @@ -142,7 +142,6 @@ class ProximoMainScreen extends React.Component { { title: '', data: this.generateData(fetchedData), - extraData: this.state, keyExtractor: this.getKeyExtractor } ]; diff --git a/screens/Proxiwash/ProxiwashScreen.js b/screens/Proxiwash/ProxiwashScreen.js index 1199974..f88b46a 100644 --- a/screens/Proxiwash/ProxiwashScreen.js +++ b/screens/Proxiwash/ProxiwashScreen.js @@ -272,14 +272,12 @@ class ProxiwashScreen extends React.Component { title: i18n.t('proxiwashScreen.dryers'), icon: 'tumble-dryer', data: data.dryers === undefined ? [] : data.dryers, - extraData: this.state, keyExtractor: this.getKeyExtractor }, { title: i18n.t('proxiwashScreen.washers'), icon: 'washing-machine', data: data.washers === undefined ? [] : data.washers, - extraData: this.state, keyExtractor: this.getKeyExtractor }, ]; diff --git a/screens/SelfMenuScreen.js b/screens/SelfMenuScreen.js index 32b359e..02a13df 100644 --- a/screens/SelfMenuScreen.js +++ b/screens/SelfMenuScreen.js @@ -56,7 +56,6 @@ class SelfMenuScreen extends React.Component { { title: '', data: [], - extraData: super.state, keyExtractor: this.getKeyExtractor } ]; @@ -69,7 +68,6 @@ class SelfMenuScreen extends React.Component { { title: DateManager.getInstance().getTranslatedDate(fetchedData[i].date), data: fetchedData[i].meal[0].foodcategory, - extraData: super.state, keyExtractor: this.getKeyExtractor, } ); diff --git a/screens/Tetris/GridManager.js b/screens/Tetris/GridManager.js index 4f0b0ca..f08ca26 100644 --- a/screens/Tetris/GridManager.js +++ b/screens/Tetris/GridManager.js @@ -5,7 +5,7 @@ import ScoreManager from "./ScoreManager"; import type {coordinates} from './Shapes/BaseShape'; -export type cell = {color: string, isEmpty: boolean}; +export type cell = {color: string, isEmpty: boolean, key: string}; export type grid = Array>; /** @@ -50,6 +50,7 @@ export default class GridManager { line.push({ color: this.#colors.tetrisBackground, isEmpty: true, + key: col.toString(), }); } return line; diff --git a/screens/Tetris/Piece.js b/screens/Tetris/Piece.js index 88d83d9..5293de9 100644 --- a/screens/Tetris/Piece.js +++ b/screens/Tetris/Piece.js @@ -57,6 +57,7 @@ export default class Piece { grid[coord[i].y][coord[i].x] = { color: this.#colors.tetrisBackground, isEmpty: true, + key: grid[coord[i].y][coord[i].x].key }; } } @@ -73,6 +74,7 @@ export default class Piece { grid[coord[i].y][coord[i].x] = { color: this.#currentShape.getColor(), isEmpty: false, + key: grid[coord[i].y][coord[i].x].key }; } } diff --git a/screens/Tetris/components/Cell.js b/screens/Tetris/components/Cell.js index 39e1051..6167e2c 100644 --- a/screens/Tetris/components/Cell.js +++ b/screens/Tetris/components/Cell.js @@ -5,9 +5,7 @@ import {View} from 'react-native'; import {withTheme} from 'react-native-paper'; type Props = { - color: string, - isEmpty: boolean, - id: string, + item: Object } class Cell extends React.PureComponent { @@ -20,17 +18,19 @@ class Cell extends React.PureComponent { } render() { + const item = this.props.item; return ( ); } diff --git a/screens/Tetris/components/Grid.js b/screens/Tetris/components/Grid.js index 39dd5cb..d61af89 100644 --- a/screens/Tetris/components/Grid.js +++ b/screens/Tetris/components/Grid.js @@ -11,11 +11,11 @@ type Props = { backgroundColor: string, height: number, width: number, - containerMaxHeight: number|string, - containerMaxWidth: number|string, + containerMaxHeight: number | string, + containerMaxWidth: number | string, } -class Grid extends React.Component{ +class Grid extends React.Component { colors: Object; @@ -25,22 +25,24 @@ class Grid extends React.Component{ } getRow(rowNumber: number) { - let cells = []; - for (let i = 0; i < this.props.width; i++) { - let cell = this.props.grid[rowNumber][i]; - let key = rowNumber + ':' + i; - cells.push(); - } - return( - + let cells = this.props.grid[rowNumber].map(this.getCellRender); + return ( + {cells} ); } + getCellRender = (item: Object) => { + return ; + }; + getGrid() { let rows = []; for (let i = 0; i < this.props.height; i++) { @@ -55,7 +57,7 @@ class Grid extends React.Component{ flexDirection: 'column', maxWidth: this.props.containerMaxWidth, maxHeight: this.props.containerMaxHeight, - aspectRatio: this.props.width/this.props.height, + aspectRatio: this.props.width / this.props.height, marginLeft: 'auto', marginRight: 'auto', }}> diff --git a/screens/Tetris/components/Preview.js b/screens/Tetris/components/Preview.js index a1e7893..48c4442 100644 --- a/screens/Tetris/components/Preview.js +++ b/screens/Tetris/components/Preview.js @@ -22,19 +22,24 @@ class Preview extends React.PureComponent { let grids = []; for (let i = 0; i < this.props.next.length; i++) { grids.push( - + this.getGridRender(this.props.next[i], i) ); } return grids; } + getGridRender(item: Object, index: number) { + return ; + }; + render() { if (this.props.next.length > 0) { return (