From 965ddd3cb2616edde586ad6472e9a66c3a5a06b7 Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Sun, 22 Mar 2020 17:02:00 +0100 Subject: [PATCH] Removed remaining flow errors --- components/WebSectionList.js | 4 +++- screens/About/AboutDependenciesScreen.js | 8 +++++++- screens/About/DebugScreen.js | 7 ++++++- screens/Planning/PlanningDisplayScreen.js | 10 ++++++---- screens/Tetris/Tetromino.js | 24 +++++++++++------------ utils/AsyncStorageManager.js | 1 + 6 files changed, 35 insertions(+), 19 deletions(-) diff --git a/components/WebSectionList.js b/components/WebSectionList.js index 3e2c58d..c3c96ff 100644 --- a/components/WebSectionList.js +++ b/components/WebSectionList.js @@ -37,7 +37,7 @@ export default class WebSectionList extends React.PureComponent { static defaultProps = { renderSectionHeader: null, stickyHeader: false, - updateData: null, + updateData: 0, }; webDataManager: WebDataManager; @@ -213,7 +213,9 @@ export default class WebSectionList extends React.PureComponent { onRefresh={this.onRefresh} /> } + //$FlowFixMe renderSectionHeader={shouldRenderHeader ? this.props.renderSectionHeader : this.getEmptySectionHeader} + //$FlowFixMe renderItem={isEmpty ? this.getEmptyRenderItem : this.props.renderItem} style={{minHeight: 300, width: '100%'}} stickySectionHeadersEnabled={this.props.stickyHeader} diff --git a/screens/About/AboutDependenciesScreen.js b/screens/About/AboutDependenciesScreen.js index e351280..06cdc33 100644 --- a/screens/About/AboutDependenciesScreen.js +++ b/screens/About/AboutDependenciesScreen.js @@ -5,13 +5,19 @@ import {FlatList} from "react-native"; import packageJson from '../../package'; import {List} from 'react-native-paper'; -function generateListFromObject(object) { +type listItem = { + name: string, + version: string +}; + +function generateListFromObject(object: { [string]: string }): Array { let list = []; let keys = Object.keys(object); let values = Object.values(object); for (let i = 0; i < keys.length; i++) { list.push({name: keys[i], version: values[i]}); } + //$FlowFixMe return list; } diff --git a/screens/About/DebugScreen.js b/screens/About/DebugScreen.js index 7c4700b..404353a 100644 --- a/screens/About/DebugScreen.js +++ b/screens/About/DebugScreen.js @@ -131,7 +131,12 @@ class DebugScreen extends React.Component { {Object.values(this.state.currentPreferences).map((object) => - {DebugScreen.getGeneralItem(() => this.showEditModal(object), undefined, object.key, 'Click to edit')} + {DebugScreen.getGeneralItem( + () => this.showEditModal(object), + undefined, + //$FlowFixMe + object.key, + 'Click to edit')} )} diff --git a/screens/Planning/PlanningDisplayScreen.js b/screens/Planning/PlanningDisplayScreen.js index 220aa19..a2bf9d5 100644 --- a/screens/Planning/PlanningDisplayScreen.js +++ b/screens/Planning/PlanningDisplayScreen.js @@ -33,14 +33,16 @@ class PlanningDisplayScreen extends React.Component { render() { // console.log("rendering planningDisplayScreen"); + let subtitle = PlanningEventManager.getFormattedEventTime( + this.displayData["date_begin"], this.displayData["date_end"]); + let dateString = PlanningEventManager.getDateOnlyString(this.displayData["date_begin"]); + if (dateString !== null) + subtitle += ' | ' + DateManager.getInstance().getTranslatedDate(dateString); return ( {this.displayData.logo !== null ? diff --git a/screens/Tetris/Tetromino.js b/screens/Tetris/Tetromino.js index 19359af..ba2c091 100644 --- a/screens/Tetris/Tetromino.js +++ b/screens/Tetris/Tetromino.js @@ -165,13 +165,13 @@ export default class Tetromino { static colors: Object; - currentType: Object; + currentType: number; currentShape: Object; currentRotation: number; position: Object; colors: Object; - constructor(type: Tetromino.types, colors: Object) { + constructor(type: number, colors: Object) { this.currentType = type; this.currentRotation = 0; this.currentShape = Tetromino.shapes[this.currentRotation][type]; @@ -181,15 +181,15 @@ export default class Tetromino { else this.position.x = 3; this.colors = colors; - Tetromino.colors = { - 0: colors.tetrisI, - 1: colors.tetrisO, - 2: colors.tetrisT, - 3: colors.tetrisS, - 4: colors.tetrisZ, - 5: colors.tetrisJ, - 6: colors.tetrisL, - }; + Tetromino.colors = [ + colors.tetrisI, + colors.tetrisO, + colors.tetrisT, + colors.tetrisS, + colors.tetrisZ, + colors.tetrisJ, + colors.tetrisL, + ]; } getColor() { @@ -210,7 +210,7 @@ export default class Tetromino { return coordinates; } - rotate(isForward) { + rotate(isForward: boolean) { if (isForward) this.currentRotation++; else diff --git a/utils/AsyncStorageManager.js b/utils/AsyncStorageManager.js index 46461ed..6dcac31 100644 --- a/utils/AsyncStorageManager.js +++ b/utils/AsyncStorageManager.js @@ -96,6 +96,7 @@ export default class AsyncStorageManager { let prefKeys = []; // Get all available keys for (let [key, value] of Object.entries(this.preferences)) { + //$FlowFixMe prefKeys.push(value.key); } // Get corresponding values