Browse Source

Fixed some Flow errors

keplyx 4 years ago
parent
commit
d9c07f5df0

+ 5
- 3
components/BaseContainer.js View File

@@ -45,12 +45,14 @@ export default class BaseContainer extends React.Component<Props, State> {
45 45
         isHeaderVisible: true,
46 46
     };
47 47
 
48
+    onDrawerPress: Function;
49
+
48 50
     constructor() {
49 51
         super();
50
-        this.toggle = this.toggle.bind(this);
52
+        this.onDrawerPress = this.onDrawerPress.bind(this);
51 53
     }
52 54
 
53
-    toggle() {
55
+    onDrawerPress() {
54 56
         this.props.navigation.toggleDrawer();
55 57
     }
56 58
 
@@ -111,7 +113,7 @@ export default class BaseContainer extends React.Component<Props, State> {
111 113
                         leftButton={
112 114
                             <Touchable
113 115
                                 style={{padding: 6}}
114
-                                onPress={this.toggle}>
116
+                                onPress={this.onDrawerPress}>
115 117
                                 <CustomMaterialIcon
116 118
                                     color={Platform.OS === 'ios' ? ThemeManager.getCurrentThemeVariables().brandPrimary : "#fff"}
117 119
                                     icon="menu"/>

+ 3
- 1
components/CustomHeader.js View File

@@ -44,6 +44,8 @@ export default class CustomHeader extends React.Component<Props> {
44 44
         hasTabs: false,
45 45
     };
46 46
 
47
+    onPressBack: Function;
48
+
47 49
     constructor() {
48 50
         super();
49 51
         this.onPressBack = this.onPressBack.bind(this);
@@ -80,7 +82,7 @@ export default class CustomHeader extends React.Component<Props> {
80 82
                         color={ThemeManager.getCurrentThemeVariables().toolbarBtnColor}/>
81 83
                     <Input
82 84
                         ref="searchInput"
83
-                        placeholder={i18n.t('proximoScreen.search')}
85
+                        placeholder={i18n.t('proximoScreen.onSearchStringChange')}
84 86
                         placeholderTextColor={ThemeManager.getCurrentThemeVariables().toolbarPlaceholderColor}
85 87
                         onChangeText={this.props.searchCallback}/>
86 88
                 </Item>

+ 13
- 7
components/FetchedDataSectionList.js View File

@@ -41,12 +41,18 @@ export default class FetchedDataSectionList extends React.Component<Props, State
41 41
         machinesWatched: [],
42 42
     };
43 43
 
44
+    onRefresh: Function;
45
+    renderSectionHeaderEmpty: Function;
46
+    renderSectionHeaderNotEmpty: Function;
47
+    renderItemEmpty: Function;
48
+    renderItemNotEmpty: Function;
49
+
44 50
     constructor(fetchUrl: string, refreshTime: number) {
45 51
         super();
46 52
         this.webDataManager = new WebDataManager(fetchUrl);
47 53
         this.refreshTime = refreshTime;
48 54
         // creating references to functions used in render()
49
-        this._onRefresh = this._onRefresh.bind(this);
55
+        this.onRefresh = this.onRefresh.bind(this);
50 56
         this.renderSectionHeaderEmpty = this.renderSectionHeader.bind(this, true);
51 57
         this.renderSectionHeaderNotEmpty = this.renderSectionHeader.bind(this, false);
52 58
         this.renderItemEmpty = this.renderItem.bind(this, true);
@@ -96,9 +102,9 @@ export default class FetchedDataSectionList extends React.Component<Props, State
96 102
      * Refresh data when focusing the screen and setup a refresh interval if asked to
97 103
      */
98 104
     onScreenFocus() {
99
-        this._onRefresh();
105
+        this.onRefresh();
100 106
         if (this.refreshTime > 0)
101
-            this.refreshInterval = setInterval(this._onRefresh.bind(this), this.refreshTime)
107
+            this.refreshInterval = setInterval(this.onRefresh.bind(this), this.refreshTime)
102 108
     }
103 109
 
104 110
     /**
@@ -122,7 +128,7 @@ export default class FetchedDataSectionList extends React.Component<Props, State
122 128
      * Refresh data and show a toast if any error occurred
123 129
      * @private
124 130
      */
125
-    _onRefresh() {
131
+    onRefresh() {
126 132
         let canRefresh;
127 133
         if (this.lastRefresh !== undefined)
128 134
             canRefresh = (new Date().getTime() - this.lastRefresh.getTime()) / 1000 > this.minTimeBetweenRefresh;
@@ -284,13 +290,13 @@ export default class FetchedDataSectionList extends React.Component<Props, State
284 290
     }
285 291
 
286 292
 
287
-    renderSectionHeader(isEmpty, {section: {title}}) {
293
+    renderSectionHeader(isEmpty: boolean, {section: {title}} : Object) {
288 294
         return isEmpty ?
289 295
             <View/> :
290 296
             this.getRenderSectionHeader(title)
291 297
     }
292 298
 
293
-    renderItem(isEmpty, {item, section}) {
299
+    renderItem(isEmpty: boolean, {item, section}: Object) {
294 300
         return isEmpty ?
295 301
             this.getEmptyRenderItem(item.text, item.isSpinner, item.icon) :
296 302
             this.getRenderItem(item, section)
@@ -313,7 +319,7 @@ export default class FetchedDataSectionList extends React.Component<Props, State
313 319
                 refreshControl={
314 320
                     <RefreshControl
315 321
                         refreshing={this.state.refreshing}
316
-                        onRefresh={this._onRefresh}
322
+                        onRefresh={this.onRefresh}
317 323
                     />
318 324
                 }
319 325
                 renderSectionHeader={isEmpty ? this.renderSectionHeaderEmpty : this.renderSectionHeaderNotEmpty}

+ 4
- 2
components/Sidebar.js View File

@@ -30,6 +30,8 @@ export default class SideBar extends React.Component<Props, State> {
30 30
         active: 'Home',
31 31
     };
32 32
 
33
+    getRenderItem: Function;
34
+
33 35
     /**
34 36
      * Generate the datasets
35 37
      *
@@ -111,7 +113,7 @@ export default class SideBar extends React.Component<Props, State> {
111 113
     }
112 114
 
113 115
 
114
-    onListItemPress(item) {
116
+    onListItemPress(item: Object) {
115 117
         if (item.link !== undefined)
116 118
             Linking.openURL(item.link).catch((err) => console.error('Error opening link', err));
117 119
         else
@@ -119,7 +121,7 @@ export default class SideBar extends React.Component<Props, State> {
119 121
     }
120 122
 
121 123
 
122
-    listKeyExtractor(item) {
124
+    listKeyExtractor(item: Object) {
123 125
         return item.route;
124 126
     }
125 127
 

+ 4
- 4
screens/About/AboutScreen.js View File

@@ -210,7 +210,7 @@ export default class AboutScreen extends React.Component<Props, State> {
210 210
                     data={this.appData}
211 211
                     extraData={this.state}
212 212
                     keyExtractor={(item) => item.icon}
213
-                    listKey={(item) => "app"}
213
+                    listKey={"app"}
214 214
                     renderItem={({item}) =>
215 215
                         this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron, item.showOnlyDebug)
216 216
                     }
@@ -241,7 +241,7 @@ export default class AboutScreen extends React.Component<Props, State> {
241 241
                     data={this.authorData}
242 242
                     extraData={this.state}
243 243
                     keyExtractor={(item) => item.icon}
244
-                    listKey={(item) => "team1"}
244
+                    listKey={"team1"}
245 245
                     renderItem={({item}) =>
246 246
                         this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron, item.showOnlyDebug)
247 247
                     }
@@ -253,7 +253,7 @@ export default class AboutScreen extends React.Component<Props, State> {
253 253
                     data={this.additionalDevData}
254 254
                     extraData={this.state}
255 255
                     keyExtractor={(item) => item.icon}
256
-                    listKey={(item) => "team2"}
256
+                    listKey={"team2"}
257 257
                     renderItem={({item}) =>
258 258
                         this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron, item.showOnlyDebug)
259 259
                     }
@@ -272,7 +272,7 @@ export default class AboutScreen extends React.Component<Props, State> {
272 272
                     data={this.technoData}
273 273
                     extraData={this.state}
274 274
                     keyExtractor={(item) => item.icon}
275
-                    listKey={(item) => "techno"}
275
+                    listKey={"techno"}
276 276
                     renderItem={({item}) =>
277 277
                         this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron, item.showOnlyDebug)
278 278
                     }

+ 30
- 25
screens/HomeScreen.js View File

@@ -38,12 +38,33 @@ function openWebLink(link) {
38 38
  */
39 39
 export default class HomeScreen extends FetchedDataSectionList {
40 40
 
41
+    onProxiwashClick: Function;
42
+    onTutorInsaClick: Function;
43
+    onMenuClick: Function;
44
+    onProximoClick: Function;
45
+
41 46
     constructor() {
42 47
         super(DATA_URL, REFRESH_TIME);
43
-        this.proxiwashClickAction = this.proxiwashClickAction.bind(this);
44
-        this.tutorinsaClickAction = this.tutorinsaClickAction.bind(this);
45
-        this.menuClickAction = this.menuClickAction.bind(this);
46
-        this.proximoClickAction = this.proximoClickAction.bind(this);
48
+        this.onProxiwashClick = this.onProxiwashClick.bind(this);
49
+        this.onTutorInsaClick = this.onTutorInsaClick.bind(this);
50
+        this.onMenuClick = this.onMenuClick.bind(this);
51
+        this.onProximoClick = this.onProximoClick.bind(this);
52
+    }
53
+
54
+    onProxiwashClick() {
55
+        this.props.navigation.navigate('Proxiwash');
56
+    }
57
+
58
+    onTutorInsaClick() {
59
+        this.props.navigation.navigate('TutorInsaScreen');
60
+    }
61
+
62
+    onProximoClick() {
63
+        this.props.navigation.navigate('Proximo');
64
+    }
65
+
66
+    onMenuClick() {
67
+        this.props.navigation.navigate('SelfMenuScreen');
47 68
     }
48 69
 
49 70
     /**
@@ -293,7 +314,7 @@ export default class HomeScreen extends FetchedDataSectionList {
293 314
     }
294 315
 
295 316
 
296
-    clickAction(isAvailable, displayEvent) {
317
+    clickAction(isAvailable: boolean, displayEvent: Object) {
297 318
         if (isAvailable)
298 319
             this.props.navigation.navigate('PlanningDisplayScreen', {data: displayEvent});
299 320
         else
@@ -338,14 +359,6 @@ export default class HomeScreen extends FetchedDataSectionList {
338 359
         );
339 360
     }
340 361
 
341
-    proximoClickAction() {
342
-        this.props.navigation.navigate('Proximo');
343
-    }
344
-
345
-    menuClickAction() {
346
-        this.props.navigation.navigate('SelfMenuScreen');
347
-    }
348
-
349 362
 
350 363
     getDashboardBottomItem(content: Array<Object>) {
351 364
         let proximoData = content[0]['data'];
@@ -391,7 +404,7 @@ export default class HomeScreen extends FetchedDataSectionList {
391 404
                     subtitle={menuSubtitle}
392 405
                     color={menuColor}
393 406
                     icon={menuIcon}
394
-                    clickAction={this.menuClickAction}
407
+                    clickAction={this.onMenuClick}
395 408
                     title={menuTitle}
396 409
                     isAvailable={isMenuAvailable}
397 410
                     isSquareLeft={true}/>
@@ -400,21 +413,13 @@ export default class HomeScreen extends FetchedDataSectionList {
400 413
                     subtitle={proximoSubtitle}
401 414
                     color={proximoColor}
402 415
                     icon={proximoIcon}
403
-                    clickAction={this.proximoClickAction}
416
+                    clickAction={this.onProximoClick}
404 417
                     title={proximoTitle}
405 418
                     isAvailable={isProximoAvailable}/>
406 419
             </View>
407 420
         );
408 421
     }
409 422
 
410
-    proxiwashClickAction() {
411
-        this.props.navigation.navigate('Proxiwash');
412
-    }
413
-
414
-    tutorinsaClickAction() {
415
-        this.props.navigation.navigate('TutorInsaScreen');
416
-    }
417
-
418 423
 
419 424
     getDashboardMiddleItem(content: Array<Object>) {
420 425
         let proxiwashData = content[0]['data'];
@@ -502,7 +507,7 @@ export default class HomeScreen extends FetchedDataSectionList {
502 507
                     subtitle={proxiwashSubtitle}
503 508
                     color={proxiwashColor}
504 509
                     icon={proxiwashIcon}
505
-                    clickAction={this.proxiwashClickAction}
510
+                    clickAction={this.onProxiwashClick}
506 511
                     title={proxiwashTitle}
507 512
                     isAvailable={proxiwashIsAvailable}
508 513
                     isSquareLeft={true}/>
@@ -511,7 +516,7 @@ export default class HomeScreen extends FetchedDataSectionList {
511 516
                     subtitle={tutorinsaSubtitle}
512 517
                     color={tutorinsaColor}
513 518
                     icon={tutorinsaIcon}
514
-                    clickAction={this.tutorinsaClickAction}
519
+                    clickAction={this.onTutorInsaClick}
515 520
                     title={tutorinsaTitle}
516 521
                     isAvailable={tutorinsaIsAvailable}/>
517 522
             </View>

+ 0
- 1
screens/PlanningDisplayScreen.js View File

@@ -8,7 +8,6 @@ import ThemeManager from "../utils/ThemeManager";
8 8
 import HTML from "react-native-render-html";
9 9
 import {Linking} from "expo";
10 10
 import PlanningEventManager from '../utils/PlanningEventManager';
11
-import i18n from 'i18n-js';
12 11
 
13 12
 type Props = {
14 13
     navigation: Object,

+ 17
- 19
screens/PlanningScreen.js View File

@@ -5,7 +5,6 @@ import {BackHandler, Image} from 'react-native';
5 5
 import {H3, Text, View} from 'native-base';
6 6
 import i18n from "i18n-js";
7 7
 import ThemeManager from "../utils/ThemeManager";
8
-import {Linking} from "expo";
9 8
 import BaseContainer from "../components/BaseContainer";
10 9
 import {Agenda, LocaleConfig} from 'react-native-calendars';
11 10
 import Touchable from 'react-native-platform-touchable';
@@ -36,14 +35,6 @@ const FETCH_URL = "https://amicale-insat.fr/event/json/list";
36 35
 const AGENDA_MONTH_SPAN = 6;
37 36
 
38 37
 /**
39
- * Opens a link in the device's browser
40
- * @param link The link to open
41
- */
42
-function openWebLink(link) {
43
-    Linking.openURL(link).catch((err) => console.error('Error opening link', err));
44
-}
45
-
46
-/**
47 38
  * Class defining the app's planning screen
48 39
  */
49 40
 export default class PlanningScreen extends React.Component<Props, State> {
@@ -63,6 +54,14 @@ export default class PlanningScreen extends React.Component<Props, State> {
63 54
         calendarShowing: false,
64 55
     };
65 56
 
57
+    onRefresh: Function;
58
+    onCalendarToggled: Function;
59
+    getRenderItem: Function;
60
+    getRenderEmptyDate: Function;
61
+    onAgendaRef: Function;
62
+    onCalendarToggled: Function;
63
+    onBackButtonPressAndroid: Function;
64
+
66 65
     constructor(props: any) {
67 66
         super(props);
68 67
         this.webDataManager = new WebDataManager(FETCH_URL);
@@ -79,12 +78,11 @@ export default class PlanningScreen extends React.Component<Props, State> {
79 78
         }
80 79
 
81 80
         // Create references for functions required in the render function
82
-        this._onRefresh = this._onRefresh.bind(this);
81
+        this.onRefresh = this.onRefresh.bind(this);
83 82
         this.onCalendarToggled = this.onCalendarToggled.bind(this);
84 83
         this.getRenderItem = this.getRenderItem.bind(this);
85 84
         this.getRenderEmptyDate = this.getRenderEmptyDate.bind(this);
86
-        this.setAgendaRef = this.setAgendaRef.bind(this);
87
-        this.onCalendarToggled = this.onCalendarToggled.bind(this);
85
+        this.onAgendaRef = this.onAgendaRef.bind(this);
88 86
         this.onCalendarToggled = this.onCalendarToggled.bind(this);
89 87
         this.onBackButtonPressAndroid = this.onBackButtonPressAndroid.bind(this);
90 88
     }
@@ -96,7 +94,7 @@ export default class PlanningScreen extends React.Component<Props, State> {
96 94
     }
97 95
 
98 96
     componentDidMount() {
99
-        this._onRefresh();
97
+        this.onRefresh();
100 98
         this.willBlurSubscription = this.props.navigation.addListener(
101 99
             'willBlur',
102 100
             () =>
@@ -213,7 +211,7 @@ export default class PlanningScreen extends React.Component<Props, State> {
213 211
      * Refresh data and show a toast if any error occurred
214 212
      * @private
215 213
      */
216
-    _onRefresh = () => {
214
+    onRefresh = () => {
217 215
         let canRefresh;
218 216
         if (this.lastRefresh !== undefined)
219 217
             canRefresh = (new Date().getTime() - this.lastRefresh.getTime()) / 1000 > this.minTimeBetweenRefresh;
@@ -265,12 +263,12 @@ export default class PlanningScreen extends React.Component<Props, State> {
265 263
         }
266 264
     }
267 265
 
268
-    setAgendaRef(ref) {
266
+    onAgendaRef(ref: Agenda) {
269 267
         this.agendaRef = ref;
270 268
     }
271 269
 
272
-    onCalendarToggled(calendarOpened) {
273
-        this.setState({calendarShowing: calendarOpened});
270
+    onCalendarToggled(isCalendarOpened: boolean) {
271
+        this.setState({calendarShowing: isCalendarOpened});
274 272
     }
275 273
 
276 274
     currentDate = this.getCurrentDate();
@@ -293,7 +291,7 @@ export default class PlanningScreen extends React.Component<Props, State> {
293 291
                     // Max amount of months allowed to scroll to the future. Default = 50
294 292
                     futureScrollRange={AGENDA_MONTH_SPAN}
295 293
                     // If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality. Make sure to also set the refreshing prop correctly.
296
-                    onRefresh={this._onRefresh}
294
+                    onRefresh={this.onRefresh}
297 295
                     // callback that fires when the calendar is opened or closed
298 296
                     onCalendarToggled={this.onCalendarToggled}
299 297
                     // Set this true while waiting for new data from a refresh
@@ -304,7 +302,7 @@ export default class PlanningScreen extends React.Component<Props, State> {
304 302
                     // If firstDay=1 week starts from Monday. Note that dayNames and dayNamesShort should still start from Sunday.
305 303
                     firstDay={1}
306 304
                     // ref to this agenda in order to handle back button event
307
-                    ref={this.setAgendaRef}
305
+                    ref={this.onAgendaRef}
308 306
                     // agenda theme
309 307
                     theme={{
310 308
                         backgroundColor: ThemeManager.getCurrentThemeVariables().agendaBackgroundColor,

+ 1
- 1
screens/Proximo/ProximoAboutScreen.js View File

@@ -1,7 +1,7 @@
1 1
 // @flow
2 2
 
3 3
 import * as React from 'react';
4
-import {Image, Linking, View} from 'react-native';
4
+import {Image, View} from 'react-native';
5 5
 import {Card, CardItem, Container, Content, H2, Left, Text} from 'native-base';
6 6
 import CustomHeader from "../../components/CustomHeader";
7 7
 import i18n from "i18n-js";

+ 30
- 20
screens/Proximo/ProximoListScreen.js View File

@@ -70,16 +70,25 @@ export default class ProximoListScreen extends React.Component<Props, State> {
70 70
         sortNameIcon: '',
71 71
         modalCurrentDisplayItem: {},
72 72
     };
73
-    _menu: Menu;
73
+    sortMenuRef: Menu;
74
+
75
+    onMenuRef: Function;
76
+    onSearchStringChange: Function;
77
+    onSelectSortModeName: Function;
78
+    onSelectSortModePrice: Function;
79
+    onSortMenuPress: Function;
80
+    renderItem: Function;
74 81
 
75 82
     constructor(props: any) {
76 83
         super(props);
77 84
         this.modalRef = React.createRef();
78 85
         this.originalData = this.navData['data'];
79
-        this.search = this.search.bind(this);
80
-        this.selectSortModeName = this.selectSortModeName.bind(this);
81
-        this.selectSortModePrice = this.selectSortModePrice.bind(this);
82
-        this.showMenu = this.showMenu.bind(this);
86
+
87
+        this.onMenuRef = this.onMenuRef.bind(this);
88
+        this.onSearchStringChange = this.onSearchStringChange.bind(this);
89
+        this.onSelectSortModeName = this.onSelectSortModeName.bind(this);
90
+        this.onSelectSortModePrice = this.onSelectSortModePrice.bind(this);
91
+        this.onSortMenuPress = this.onSortMenuPress.bind(this);
83 92
         this.renderItem = this.renderItem.bind(this);
84 93
     }
85 94
 
@@ -88,8 +97,8 @@ export default class ProximoListScreen extends React.Component<Props, State> {
88 97
      *
89 98
      * @param ref The menu reference
90 99
      */
91
-    setMenuRef = (ref: Menu) => {
92
-        this._menu = ref;
100
+    onMenuRef(ref: Menu) {
101
+        this.sortMenuRef = ref;
93 102
     };
94 103
 
95 104
     /**
@@ -136,7 +145,7 @@ export default class ProximoListScreen extends React.Component<Props, State> {
136 145
                 break;
137 146
         }
138 147
         this.setupSortIcons(mode, isReverse);
139
-        this._menu.hide();
148
+        this.sortMenuRef.hide();
140 149
     }
141 150
 
142 151
     /**
@@ -219,7 +228,7 @@ export default class ProximoListScreen extends React.Component<Props, State> {
219 228
         return filteredData;
220 229
     }
221 230
 
222
-    search(str: string) {
231
+    onSearchStringChange(str: string) {
223 232
         this.setState({
224 233
             currentlyDisplayedData: this.filterData(str)
225 234
         })
@@ -265,27 +274,27 @@ export default class ProximoListScreen extends React.Component<Props, State> {
265 274
         }
266 275
     }
267 276
 
268
-    selectSortModeName() {
277
+    onSelectSortModeName() {
269 278
         this.sortModeSelected(sortMode.name);
270 279
     }
271 280
 
272
-    selectSortModePrice() {
281
+    onSelectSortModePrice() {
273 282
         this.sortModeSelected(sortMode.price);
274 283
     }
275 284
 
276
-    showMenu() {
277
-        this._menu.show();
285
+    onSortMenuPress() {
286
+        this.sortMenuRef.show();
278 287
     }
279 288
 
280 289
 
281 290
     getSortMenu() {
282 291
         return (
283 292
             <Menu
284
-                ref={this.setMenuRef}
293
+                ref={this.onMenuRef}
285 294
                 button={
286 295
                     <Touchable
287 296
                         style={{padding: 6}}
288
-                        onPress={this.showMenu}>
297
+                        onPress={this.onSortMenuPress}>
289 298
                         <CustomMaterialIcon
290 299
                             color={Platform.OS === 'ios' ? ThemeManager.getCurrentThemeVariables().brandPrimary : "#fff"}
291 300
                             icon={'sort'}/>
@@ -293,12 +302,12 @@ export default class ProximoListScreen extends React.Component<Props, State> {
293 302
                 }
294 303
             >
295 304
                 <MenuItem
296
-                    onPress={this.selectSortModeName}>
305
+                    onPress={this.onSelectSortModeName}>
297 306
                     {this.state.sortNameIcon}
298 307
                     {i18n.t('proximoScreen.sortName')}
299 308
                 </MenuItem>
300 309
                 <MenuItem
301
-                    onPress={this.selectSortModePrice}>
310
+                    onPress={this.onSelectSortModePrice}>
302 311
                     {this.state.sortPriceIcon}
303 312
                     {i18n.t('proximoScreen.sortPrice')}
304 313
                 </MenuItem>
@@ -306,7 +315,8 @@ export default class ProximoListScreen extends React.Component<Props, State> {
306 315
         );
307 316
     }
308 317
 
309
-    renderItem({item}) {
318
+    renderItem({item}: Object) {
319
+        console.log(item);
310 320
         return (<ListItem
311 321
             thumbnail
312 322
             onPress={() => {
@@ -335,7 +345,7 @@ export default class ProximoListScreen extends React.Component<Props, State> {
335 345
         </ListItem>);
336 346
     }
337 347
 
338
-    keyExtractor(item) {
348
+    keyExtractor(item: Object) {
339 349
         return item.name + item.code;
340 350
     }
341 351
 
@@ -353,7 +363,7 @@ export default class ProximoListScreen extends React.Component<Props, State> {
353 363
                     hasBackButton={true}
354 364
                     navigation={nav}
355 365
                     hasSearchField={true}
356
-                    searchCallback={this.search}
366
+                    searchCallback={this.onSearchStringChange}
357 367
                     shouldFocusSearchBar={this.shouldFocusSearchBar}
358 368
                     rightButton={this.getSortMenu()}
359 369
                 />

+ 3
- 0
screens/Proximo/ProximoMainScreen.js View File

@@ -18,6 +18,9 @@ const DATA_URL = "https://srv-falcon.etud.insa-toulouse.fr/~proximo/data/stock-v
18 18
  */
19 19
 export default class ProximoMainScreen extends FetchedDataSectionList {
20 20
 
21
+    onPressSearchBtn: Function;
22
+    onPressAboutBtn: Function;
23
+
21 24
     constructor() {
22 25
         super(DATA_URL, 0);
23 26
         this.onPressSearchBtn = this.onPressSearchBtn.bind(this);

+ 5
- 3
screens/Proxiwash/ProxiwashScreen.js View File

@@ -36,6 +36,8 @@ const REFRESH_TIME = 1000 * 10; // Refresh every 10 seconds
36 36
  */
37 37
 export default class ProxiwashScreen extends FetchedDataSectionList {
38 38
 
39
+    onAboutPress: Function;
40
+
39 41
     /**
40 42
      * Creates machine state parameters using current theme and translations
41 43
      */
@@ -76,7 +78,7 @@ export default class ProxiwashScreen extends FetchedDataSectionList {
76 78
         };
77 79
         this.setMinTimeRefresh(30);
78 80
 
79
-        this.navigateToAboutScreen = this.navigateToAboutScreen.bind(this);
81
+        this.onAboutPress = this.onAboutPress.bind(this);
80 82
     }
81 83
 
82 84
     /**
@@ -274,7 +276,7 @@ export default class ProxiwashScreen extends FetchedDataSectionList {
274 276
         );
275 277
     }
276 278
 
277
-    navigateToAboutScreen() {
279
+    onAboutPress() {
278 280
         this.props.navigation.navigate('ProxiwashAboutScreen');
279 281
     }
280 282
 
@@ -282,7 +284,7 @@ export default class ProxiwashScreen extends FetchedDataSectionList {
282 284
         return (
283 285
             <Touchable
284 286
                 style={{padding: 6}}
285
-                onPress={this.navigateToAboutScreen}>
287
+                onPress={this.onAboutPress}>
286 288
                 <CustomMaterialIcon
287 289
                     color={Platform.OS === 'ios' ? ThemeManager.getCurrentThemeVariables().brandPrimary : "#fff"}
288 290
                     icon="information"/>

Loading…
Cancel
Save