Removed remaining flow errors

This commit is contained in:
Arnaud Vergnet 2020-03-22 17:02:00 +01:00
parent 38a52a9e95
commit 965ddd3cb2
6 changed files with 35 additions and 19 deletions

View file

@ -37,7 +37,7 @@ export default class WebSectionList extends React.PureComponent<Props, State> {
static defaultProps = {
renderSectionHeader: null,
stickyHeader: false,
updateData: null,
updateData: 0,
};
webDataManager: WebDataManager;
@ -213,7 +213,9 @@ export default class WebSectionList extends React.PureComponent<Props, State> {
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}

View file

@ -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<listItem> {
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;
}

View file

@ -131,7 +131,12 @@ class DebugScreen extends React.Component<Props, State> {
<Card.Content>
{Object.values(this.state.currentPreferences).map((object) =>
<View>
{DebugScreen.getGeneralItem(() => this.showEditModal(object), undefined, object.key, 'Click to edit')}
{DebugScreen.getGeneralItem(
() => this.showEditModal(object),
undefined,
//$FlowFixMe
object.key,
'Click to edit')}
</View>
)}
</Card.Content>

View file

@ -33,14 +33,16 @@ class PlanningDisplayScreen extends React.Component<Props> {
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 (
<ScrollView style={{paddingLeft: 5, paddingRight: 5}}>
<Card.Title
title={this.displayData.title}
subtitle={
PlanningEventManager.getFormattedEventTime(this.displayData["date_begin"], this.displayData["date_end"])
+ ' | '
+ DateManager.getInstance().getTranslatedDate(PlanningEventManager.getDateOnlyString(this.displayData["date_begin"]))}
subtitle={subtitle}
/>
{this.displayData.logo !== null ?
<View style={{width: '100%', height: 300}}>

View file

@ -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

View file

@ -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