Browse Source

Removed remaining flow errors

Arnaud Vergnet 1 year ago
parent
commit
965ddd3cb2

+ 3
- 1
components/WebSectionList.js View File

@@ -37,7 +37,7 @@ export default class WebSectionList extends React.PureComponent<Props, State> {
37 37
     static defaultProps = {
38 38
         renderSectionHeader: null,
39 39
         stickyHeader: false,
40
-        updateData: null,
40
+        updateData: 0,
41 41
     };
42 42
 
43 43
     webDataManager: WebDataManager;
@@ -213,7 +213,9 @@ export default class WebSectionList extends React.PureComponent<Props, State> {
213 213
                             onRefresh={this.onRefresh}
214 214
                         />
215 215
                     }
216
+                    //$FlowFixMe
216 217
                     renderSectionHeader={shouldRenderHeader ? this.props.renderSectionHeader : this.getEmptySectionHeader}
218
+                    //$FlowFixMe
217 219
                     renderItem={isEmpty ? this.getEmptyRenderItem : this.props.renderItem}
218 220
                     style={{minHeight: 300, width: '100%'}}
219 221
                     stickySectionHeadersEnabled={this.props.stickyHeader}

+ 7
- 1
screens/About/AboutDependenciesScreen.js View File

@@ -5,13 +5,19 @@ import {FlatList} from "react-native";
5 5
 import packageJson from '../../package';
6 6
 import {List} from 'react-native-paper';
7 7
 
8
-function generateListFromObject(object) {
8
+type listItem = {
9
+    name: string,
10
+    version: string
11
+};
12
+
13
+function generateListFromObject(object: { [string]: string }): Array<listItem> {
9 14
     let list = [];
10 15
     let keys = Object.keys(object);
11 16
     let values = Object.values(object);
12 17
     for (let i = 0; i < keys.length; i++) {
13 18
         list.push({name: keys[i], version: values[i]});
14 19
     }
20
+    //$FlowFixMe
15 21
     return list;
16 22
 }
17 23
 

+ 6
- 1
screens/About/DebugScreen.js View File

@@ -131,7 +131,12 @@ class DebugScreen extends React.Component<Props, State> {
131 131
                         <Card.Content>
132 132
                             {Object.values(this.state.currentPreferences).map((object) =>
133 133
                                 <View>
134
-                                    {DebugScreen.getGeneralItem(() => this.showEditModal(object), undefined, object.key, 'Click to edit')}
134
+                                    {DebugScreen.getGeneralItem(
135
+                                        () => this.showEditModal(object),
136
+                                        undefined,
137
+                                        //$FlowFixMe
138
+                                        object.key,
139
+                                        'Click to edit')}
135 140
                                 </View>
136 141
                             )}
137 142
                         </Card.Content>

+ 6
- 4
screens/Planning/PlanningDisplayScreen.js View File

@@ -33,14 +33,16 @@ class PlanningDisplayScreen extends React.Component<Props> {
33 33
 
34 34
     render() {
35 35
         // console.log("rendering planningDisplayScreen");
36
+        let subtitle = PlanningEventManager.getFormattedEventTime(
37
+            this.displayData["date_begin"], this.displayData["date_end"]);
38
+        let dateString = PlanningEventManager.getDateOnlyString(this.displayData["date_begin"]);
39
+        if (dateString !== null)
40
+            subtitle += ' | ' + DateManager.getInstance().getTranslatedDate(dateString);
36 41
         return (
37 42
             <ScrollView style={{paddingLeft: 5, paddingRight: 5}}>
38 43
                 <Card.Title
39 44
                     title={this.displayData.title}
40
-                    subtitle={
41
-                        PlanningEventManager.getFormattedEventTime(this.displayData["date_begin"], this.displayData["date_end"])
42
-                        + ' | '
43
-                        + DateManager.getInstance().getTranslatedDate(PlanningEventManager.getDateOnlyString(this.displayData["date_begin"]))}
45
+                    subtitle={subtitle}
44 46
                 />
45 47
                 {this.displayData.logo !== null ?
46 48
                     <View style={{width: '100%', height: 300}}>

+ 12
- 12
screens/Tetris/Tetromino.js View File

@@ -165,13 +165,13 @@ export default class Tetromino {
165 165
 
166 166
     static colors: Object;
167 167
 
168
-    currentType: Object;
168
+    currentType: number;
169 169
     currentShape: Object;
170 170
     currentRotation: number;
171 171
     position: Object;
172 172
     colors: Object;
173 173
 
174
-    constructor(type: Tetromino.types, colors: Object) {
174
+    constructor(type: number, colors: Object) {
175 175
         this.currentType = type;
176 176
         this.currentRotation = 0;
177 177
         this.currentShape = Tetromino.shapes[this.currentRotation][type];
@@ -181,15 +181,15 @@ export default class Tetromino {
181 181
         else
182 182
             this.position.x = 3;
183 183
         this.colors = colors;
184
-        Tetromino.colors = {
185
-            0: colors.tetrisI,
186
-            1: colors.tetrisO,
187
-            2: colors.tetrisT,
188
-            3: colors.tetrisS,
189
-            4: colors.tetrisZ,
190
-            5: colors.tetrisJ,
191
-            6: colors.tetrisL,
192
-        };
184
+        Tetromino.colors = [
185
+            colors.tetrisI,
186
+            colors.tetrisO,
187
+            colors.tetrisT,
188
+            colors.tetrisS,
189
+            colors.tetrisZ,
190
+            colors.tetrisJ,
191
+            colors.tetrisL,
192
+        ];
193 193
     }
194 194
 
195 195
     getColor() {
@@ -210,7 +210,7 @@ export default class Tetromino {
210 210
         return coordinates;
211 211
     }
212 212
 
213
-    rotate(isForward) {
213
+    rotate(isForward: boolean) {
214 214
         if (isForward)
215 215
             this.currentRotation++;
216 216
         else

+ 1
- 0
utils/AsyncStorageManager.js View File

@@ -96,6 +96,7 @@ export default class AsyncStorageManager {
96 96
         let prefKeys = [];
97 97
         // Get all available keys
98 98
         for (let [key, value] of Object.entries(this.preferences)) {
99
+            //$FlowFixMe
99 100
             prefKeys.push(value.key);
100 101
         }
101 102
         // Get corresponding values

Loading…
Cancel
Save