Browse Source

Added documentation

keplyx 4 years ago
parent
commit
0bdcf5a4ba

+ 8
- 3
components/CustomHeader.js View File

@@ -13,14 +13,19 @@ type Props = {
13 13
     navigation: Object,
14 14
 };
15 15
 
16
-
16
+/**
17
+ * Custom component defining a header using native base
18
+ *
19
+ * @prop backButton {boolean} Whether to show a back button or a burger menu. Use burger if unspecified
20
+ * @prop rightMenu {React.Node} Element to place at the right of the header. Use nothing if unspecified
21
+ * @prop title {string} This header title
22
+ * @prop navigation {Object} The navigation object from react navigation
23
+ */
17 24
 export default class CustomHeader extends React.Component<Props> {
18 25
 
19 26
     static defaultProps = {
20 27
         backButton: false,
21 28
         rightMenu: <Right/>,
22
-        fontSize: 26,
23
-        width: 30,
24 29
     };
25 30
 
26 31
     render() {

+ 9
- 0
components/CustomMaterialIcon.js View File

@@ -12,6 +12,15 @@ type Props = {
12 12
     width: number,
13 13
 }
14 14
 
15
+/**
16
+ * Custom component defining a material icon using native base
17
+ *
18
+ * @prop active {boolean} Whether to set the icon color to active
19
+ * @prop icon {string} The icon string to use from MaterialCommunityIcons
20
+ * @prop color {string} The icon color. Use default theme color if unspecified
21
+ * @prop fontSize {number} The icon size. Use 26 if unspecified
22
+ * @prop width {number} The icon width. Use 30 if unspecified
23
+ */
15 24
 export default class CustomMaterialIcon extends React.Component<Props> {
16 25
 
17 26
     static defaultProps = {

+ 16
- 3
components/SideMenu.js View File

@@ -20,15 +20,24 @@ type State = {
20 20
     active: string,
21 21
 };
22 22
 
23
+/**
24
+ * Class used to define a navigation drawer
25
+ */
23 26
 export default class SideBar extends React.Component<Props, State> {
24 27
 
25 28
     dataSet: Array<Object>;
26 29
 
30
+    state = {
31
+        active: 'Home',
32
+    };
33
+
34
+    /**
35
+     * Generate the datasets
36
+     *
37
+     * @param props
38
+     */
27 39
     constructor(props: Props) {
28 40
         super(props);
29
-        this.state = {
30
-            active: 'Home',
31
-        };
32 41
         this.dataSet = [
33 42
             {
34 43
                 name: i18n.t('screens.home'),
@@ -82,6 +91,10 @@ export default class SideBar extends React.Component<Props, State> {
82 91
         ];
83 92
     }
84 93
 
94
+    /**
95
+     * Navigate to the selected route, close the drawer, and mark the correct item as selected
96
+     * @param route {string} The route name to navigate to
97
+     */
85 98
     navigateToScreen(route: string) {
86 99
         this.props.navigation.navigate(route);
87 100
         this.props.navigation.closeDrawer();

+ 3
- 0
navigation/AppNavigator.js View File

@@ -6,6 +6,9 @@ import MainDrawerNavigator from './MainDrawerNavigator';
6 6
 import ProximoListScreen from '../screens/Proximo/ProximoListScreen';
7 7
 import AboutDependenciesScreen from '../screens/About/AboutDependenciesScreen';
8 8
 
9
+/**
10
+ * Create a stack navigator using the drawer to handle navigation between screens
11
+ */
9 12
 export default createAppContainer(
10 13
     createStackNavigator({
11 14
             Main: MainDrawerNavigator,

+ 3
- 1
navigation/MainDrawerNavigator.js View File

@@ -11,7 +11,9 @@ import SettingsScreen from '../screens/SettingsScreen';
11 11
 import AboutScreen from '../screens/About/AboutScreen';
12 12
 import SideMenu from "../components/SideMenu";
13 13
 
14
-
14
+/**
15
+ * Creates the drawer navigation stack
16
+ */
15 17
 export default createDrawerNavigator({
16 18
         Home: {screen: HomeScreen},
17 19
         Planning: {screen: PlanningScreen,},

+ 3
- 0
screens/About/AboutDependenciesScreen.js View File

@@ -20,6 +20,9 @@ type Props = {
20 20
     navigation: Object
21 21
 }
22 22
 
23
+/**
24
+ * Class defining a screen showing the list of libraries used by the app, taken from package.json
25
+ */
23 26
 export default class AboutDependenciesScreen extends React.Component<Props> {
24 27
 
25 28
     render() {

+ 29
- 5
screens/About/AboutScreen.js View File

@@ -26,13 +26,22 @@ type Props = {
26 26
     navigation: Object,
27 27
 };
28 28
 
29
-
29
+/**
30
+ * Opens a link in the device's browser
31
+ * @param link The link to open
32
+ */
30 33
 function openWebLink(link) {
31 34
     Linking.openURL(link).catch((err) => console.error('Error opening link', err));
32 35
 }
33 36
 
37
+/**
38
+ * Class defining an about screen. This screen shows the user information about the app and it's author.
39
+ */
34 40
 export default class AboutScreen extends React.Component<Props> {
35 41
 
42
+    /**
43
+     * Data to be displayed in the app card
44
+     */
36 45
     appData: Array<Object> = [
37 46
         {
38 47
             onPressCallback: () => openWebLink(Platform.OS === "ios" ? links.appstore : links.playstore),
@@ -66,6 +75,9 @@ export default class AboutScreen extends React.Component<Props> {
66 75
         },
67 76
     ];
68 77
 
78
+    /**
79
+     * Data to be displayed in the author card
80
+     */
69 81
     authorData: Array<Object> = [
70 82
         {
71 83
             onPressCallback: () => Alert.alert('Coucou', 'Whaou'),
@@ -93,6 +105,9 @@ export default class AboutScreen extends React.Component<Props> {
93 105
         },
94 106
     ];
95 107
 
108
+    /**
109
+     * Data to be displayed in the technologies card
110
+     */
96 111
     technoData: Array<Object> = [
97 112
         {
98 113
             onPressCallback: () => openWebLink(links.react),
@@ -108,7 +123,16 @@ export default class AboutScreen extends React.Component<Props> {
108 123
         },
109 124
     ];
110 125
 
111
-    getCardItem(onPressCallback: Function, icon: string, text: string, showChevron: boolean) {
126
+    /**
127
+     * Get a clickable card item to be rendered inside a card.
128
+     *
129
+     * @param onPressCallback The callback to use when the item is clicked
130
+     * @param icon The icon name to use from MaterialCommunityIcons
131
+     * @param text The text to show
132
+     * @param showChevron Whether to show a chevron indicating this button will change screen
133
+     * @returns {React.Node}
134
+     */
135
+    static getCardItem(onPressCallback: Function, icon: string, text: string, showChevron: boolean) {
112 136
         return (
113 137
             <CardItem button
114 138
                       onPress={onPressCallback}>
@@ -150,7 +174,7 @@ export default class AboutScreen extends React.Component<Props> {
150 174
                             data={this.appData}
151 175
                             keyExtractor={(item) => item.icon}
152 176
                             renderItem={({item}) =>
153
-                                this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron)
177
+                                AboutScreen.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron)
154 178
                             }
155 179
                         />
156 180
                     </Card>
@@ -163,7 +187,7 @@ export default class AboutScreen extends React.Component<Props> {
163 187
                             data={this.authorData}
164 188
                             keyExtractor={(item) => item.icon}
165 189
                             renderItem={({item}) =>
166
-                                this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron)
190
+                                AboutScreen.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron)
167 191
                             }
168 192
                         />
169 193
                     </Card>
@@ -176,7 +200,7 @@ export default class AboutScreen extends React.Component<Props> {
176 200
                             data={this.technoData}
177 201
                             keyExtractor={(item) => item.icon}
178 202
                             renderItem={({item}) =>
179
-                                this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron)
203
+                                AboutScreen.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron)
180 204
                             }
181 205
                         />
182 206
                     </Card>

+ 3
- 0
screens/HomeScreen.js View File

@@ -10,6 +10,9 @@ type Props = {
10 10
     navigation: Object,
11 11
 }
12 12
 
13
+/**
14
+ * Class defining the app's home screen
15
+ */
13 16
 export default class HomeScreen extends React.Component<Props> {
14 17
     render() {
15 18
         const nav = this.props.navigation;

+ 3
- 0
screens/PlanningScreen.js View File

@@ -9,6 +9,9 @@ type Props = {
9 9
     navigation: Object,
10 10
 }
11 11
 
12
+/**
13
+ * Class defining the app's planning screen
14
+ */
12 15
 export default class PlanningScreen extends React.Component<Props> {
13 16
     render() {
14 17
         const nav = this.props.navigation;

+ 33
- 5
screens/Proximo/ProximoListScreen.js View File

@@ -16,7 +16,6 @@ const sortMode = {
16 16
     name: '1',
17 17
 };
18 18
 
19
-
20 19
 function sortPrice(a, b) {
21 20
     return a.price - b.price;
22 21
 }
@@ -53,7 +52,10 @@ type State = {
53 52
     sortNameIcon: React.Node,
54 53
 };
55 54
 
56
-export default class ProximoMainScreen extends React.Component<Props, State> {
55
+/**
56
+ * Class defining proximo's article list of a certain category.
57
+ */
58
+export default class ProximoListScreen extends React.Component<Props, State> {
57 59
 
58 60
     state = {
59 61
         navData: this.props.navigation.getParam('data', []).sort(sortPrice),
@@ -65,11 +67,22 @@ export default class ProximoMainScreen extends React.Component<Props, State> {
65 67
 
66 68
     _menu: Menu;
67 69
 
70
+    /**
71
+     * Saves the reference to the sort menu for later use
72
+     *
73
+     * @param ref The menu reference
74
+     */
68 75
     setMenuRef = (ref: Menu) => {
69 76
         this._menu = ref;
70 77
     };
71 78
 
72
-    toggleSortMode(mode: string) {
79
+    /**
80
+     * Sets the sort mode based on the one selected.
81
+     * If the selected mode is the current one, reverse it.
82
+     *
83
+     * @param mode The string representing the mode
84
+     */
85
+    sortModeSelected(mode: string) {
73 86
         let isReverse = this.state.isSortReversed;
74 87
         if (mode === this.state.currentSortMode) // reverse mode
75 88
             isReverse = !isReverse; // this.state not updating on this function cycle
@@ -78,6 +91,12 @@ export default class ProximoMainScreen extends React.Component<Props, State> {
78 91
         this.setSortMode(mode, isReverse);
79 92
     }
80 93
 
94
+    /**
95
+     * Set the current sort mode.
96
+     *
97
+     * @param mode The string representing the mode
98
+     * @param isReverse Whether to use a reverse sort
99
+     */
81 100
     setSortMode(mode: string, isReverse: boolean) {
82 101
         this.setState({
83 102
             currentSortMode: mode,
@@ -107,10 +126,19 @@ export default class ProximoMainScreen extends React.Component<Props, State> {
107 126
         this._menu.hide();
108 127
     }
109 128
 
129
+    /**
130
+     * Set the sort mode from state when components are ready
131
+     */
110 132
     componentDidMount() {
111 133
         this.setSortMode(this.state.currentSortMode, this.state.isSortReversed);
112 134
     }
113 135
 
136
+    /**
137
+     * Set the sort menu icon based on the given mode.
138
+     *
139
+     * @param mode The string representing the mode
140
+     * @param isReverse Whether to use a reversed icon
141
+     */
114 142
     setupSortIcons(mode: string, isReverse: boolean) {
115 143
         const downSortIcon =
116 144
             <Icon
@@ -166,12 +194,12 @@ export default class ProximoMainScreen extends React.Component<Props, State> {
166 194
                             }
167 195
                         >
168 196
                             <MenuItem
169
-                                onPress={() => this.toggleSortMode(sortMode.name)}>
197
+                                onPress={() => this.sortModeSelected(sortMode.name)}>
170 198
                                 {this.state.sortNameIcon}
171 199
                                 {i18n.t('proximoScreen.sortName')}
172 200
                             </MenuItem>
173 201
                             <MenuItem
174
-                                onPress={() => this.toggleSortMode(sortMode.price)}>
202
+                                onPress={() => this.sortModeSelected(sortMode.price)}>
175 203
                                 {this.state.sortPriceIcon}
176 204
                                 {i18n.t('proximoScreen.sortPrice')}
177 205
                             </MenuItem>

+ 32
- 2
screens/Proximo/ProximoMainScreen.js View File

@@ -27,6 +27,10 @@ type State = {
27 27
     data: Object,
28 28
 };
29 29
 
30
+/**
31
+ * Class defining the main proximo screen. This screen shows the different categories of articles
32
+ * offered by proximo.
33
+ */
30 34
 export default class ProximoMainScreen extends React.Component<Props, State> {
31 35
 
32 36
     state = {
@@ -35,7 +39,15 @@ export default class ProximoMainScreen extends React.Component<Props, State> {
35 39
         data: {},
36 40
     };
37 41
 
38
-    static generateDataset(types: Array<string>, data: Object) {
42
+    /**
43
+     * Generate the dataset using types and data.
44
+     * This will group items under the same type.
45
+     *
46
+     * @param types An array containing the types available (categories)
47
+     * @param data The array of articles represented by objects
48
+     * @returns {Array} The formatted dataset
49
+     */
50
+    static generateDataset(types: Array<string>, data: Array<Object>) {
39 51
         let finalData = [];
40 52
         for (let i = 0; i < types.length; i++) {
41 53
             finalData.push({
@@ -51,6 +63,11 @@ export default class ProximoMainScreen extends React.Component<Props, State> {
51 63
         return finalData;
52 64
     }
53 65
 
66
+    /**
67
+     * Async function reading data from the proximo website and setting the state to rerender the list
68
+     *
69
+     * @returns {Promise<void>}
70
+     */
54 71
     async readData() {
55 72
         try {
56 73
             let response = await fetch(DATA_URL);
@@ -68,10 +85,18 @@ export default class ProximoMainScreen extends React.Component<Props, State> {
68 85
         }
69 86
     }
70 87
 
88
+    /**
89
+     * Refresh the list on first screen load
90
+     */
71 91
     componentDidMount() {
72 92
         this._onRefresh();
73 93
     }
74 94
 
95
+    /**
96
+     * Display a loading indicator and fetch data from the internet
97
+     *
98
+     * @private
99
+     */
75 100
     _onRefresh = () => {
76 101
         this.setState({refreshing: true});
77 102
         this.readData().then(() => {
@@ -88,7 +113,12 @@ export default class ProximoMainScreen extends React.Component<Props, State> {
88 113
         });
89 114
     };
90 115
 
91
-
116
+    /**
117
+     * Renders the proximo categories list.
118
+     * If we are loading for the first time, change the data for the SectionList to display a loading message.
119
+     *
120
+     * @returns {react.Node}
121
+     */
92 122
     render() {
93 123
         const nav = this.props.navigation;
94 124
         const data = [

+ 72
- 3
screens/ProxiwashScreen.js View File

@@ -38,6 +38,10 @@ type State = {
38 38
     machinesWatched: Array<Object>
39 39
 };
40 40
 
41
+/**
42
+ * Class defining the app's proxiwash screen. This screen shows information about washing machines and
43
+ * dryers, taken from a scrapper reading proxiwash website
44
+ */
41 45
 export default class ProxiwashScreen extends React.Component<Props, State> {
42 46
 
43 47
     state = {
@@ -47,6 +51,11 @@ export default class ProxiwashScreen extends React.Component<Props, State> {
47 51
         machinesWatched: [],
48 52
     };
49 53
 
54
+    /**
55
+     * Creates machine state parameters using current theme and translations
56
+     *
57
+     * @param props
58
+     */
50 59
     constructor(props: Props) {
51 60
         super(props);
52 61
         let colors = ThemeManager.getInstance().getCurrentThemeVariables();
@@ -63,6 +72,11 @@ export default class ProxiwashScreen extends React.Component<Props, State> {
63 72
         stateStrings[MACHINE_STATES.ERREUR] = i18n.t('proxiwashScreen.states.error');
64 73
     }
65 74
 
75
+    /**
76
+     * Read the data from the proxiwash scrapper and set it to current state to reload the screen
77
+     *
78
+     * @returns {Promise<void>}
79
+     */
66 80
     async readData() {
67 81
         try {
68 82
             let response = await fetch(DATA_URL);
@@ -75,6 +89,11 @@ export default class ProxiwashScreen extends React.Component<Props, State> {
75 89
         }
76 90
     }
77 91
 
92
+    /**
93
+     * Get which machines have notifications enabled before loading the screen
94
+     *
95
+     * @returns {Promise<void>}
96
+     */
78 97
     async componentWillMount() {
79 98
         let dataString = await AsyncStorage.getItem(WATCHED_MACHINES_PREFKEY);
80 99
         if (dataString === null)
@@ -84,11 +103,18 @@ export default class ProxiwashScreen extends React.Component<Props, State> {
84 103
         });
85 104
     }
86 105
 
87
-
106
+    /**
107
+     * Refresh the data on first screen load
108
+     */
88 109
     componentDidMount() {
89 110
         this._onRefresh();
90 111
     }
91 112
 
113
+    /**
114
+     * Show the refresh inddicator and wait for data to be fetched from the scrapper
115
+     *
116
+     * @private
117
+     */
92 118
     _onRefresh = () => {
93 119
         this.setState({refreshing: true});
94 120
         this.readData().then(() => {
@@ -105,6 +131,14 @@ export default class ProxiwashScreen extends React.Component<Props, State> {
105 131
         });
106 132
     };
107 133
 
134
+    /**
135
+     * Get the time remaining based on start/end time and done percent
136
+     *
137
+     * @param startString The string representing the start time. Format: hh:mm
138
+     * @param endString The string representing the end time. Format: hh:mm
139
+     * @param percentDone The percentage done
140
+     * @returns {number} How many minutes are remaining for this machine
141
+     */
108 142
     static getRemainingTime(startString: string, endString: string, percentDone: string): number {
109 143
         let startArray = startString.split(':');
110 144
         let endArray = endString.split(':');
@@ -117,6 +151,15 @@ export default class ProxiwashScreen extends React.Component<Props, State> {
117 151
         return parseInt(time);
118 152
     }
119 153
 
154
+    /**
155
+     * Setup notifications for the machine with the given ID.
156
+     * One notification will be sent at the end of the program.
157
+     * Another will be send a few minutes before the end, based on the value of reminderNotifTime
158
+     *
159
+     * @param machineId The machine's ID
160
+     * @param remainingTime The time remaining for this machine
161
+     * @returns {Promise<void>}
162
+     */
120 163
     async setupNotifications(machineId: string, remainingTime: number) {
121 164
         if (!this.isMachineWatched(machineId)) {
122 165
             let endNotifID = await NotificationsManager.scheduleNotification(
@@ -148,6 +191,12 @@ export default class ProxiwashScreen extends React.Component<Props, State> {
148 191
             this.disableNotification(machineId);
149 192
     }
150 193
 
194
+    /**
195
+     * Stop scheduled notifications for the machine of the given ID.
196
+     * This will also remove the notification if it was already shown.
197
+     *
198
+     * @param machineId The machine's ID
199
+     */
151 200
     disableNotification(machineId: string) {
152 201
         let data: Object = this.state.machinesWatched;
153 202
         if (data.length > 0) {
@@ -164,12 +213,26 @@ export default class ProxiwashScreen extends React.Component<Props, State> {
164 213
         }
165 214
     }
166 215
 
167
-    isMachineWatched(number: string) {
216
+    /**
217
+     * Checks whether the machine of the given ID has scheduled notifications
218
+     *
219
+     * @param machineID The machine's ID
220
+     * @returns {boolean}
221
+     */
222
+    isMachineWatched(machineID: string) {
168 223
         return this.state.machinesWatched.find(function (elem) {
169
-            return elem.machineNumber === number
224
+            return elem.machineNumber === machineID
170 225
         }) !== undefined;
171 226
     }
172 227
 
228
+    /**
229
+     * Get list item to be rendered
230
+     *
231
+     * @param item The object containing the item's data
232
+     * @param section The object describing the current SectionList section
233
+     * @param data The full data used by the SectionList
234
+     * @returns {React.Node}
235
+     */
173 236
     renderItem(item: Object, section: Object, data: Object) {
174 237
         return (
175 238
             <ListItem
@@ -226,6 +289,12 @@ export default class ProxiwashScreen extends React.Component<Props, State> {
226 289
             </ListItem>);
227 290
     }
228 291
 
292
+    /**
293
+     * Renders the machines list.
294
+     * If we are loading for the first time, change the data for the SectionList to display a loading message.
295
+     *
296
+     * @returns {react.Node}
297
+     */
229 298
     render() {
230 299
         const nav = this.props.navigation;
231 300
         const data = [

+ 46
- 5
screens/SettingsScreen.js View File

@@ -33,12 +33,20 @@ type State = {
33 33
     proxiwashNotifPickerSelected: string,
34 34
 };
35 35
 
36
+/**
37
+ * Class defining the Settings screen. This screen shows controls to modify app preferences.
38
+ */
36 39
 export default class SettingsScreen extends React.Component<Props, State> {
37 40
     state = {
38 41
         nightMode: ThemeManager.getInstance().getNightMode(),
39 42
         proxiwashNotifPickerSelected: "5"
40 43
     };
41 44
 
45
+    /**
46
+     * Gets data from preferences before rendering components
47
+     *
48
+     * @returns {Promise<void>}
49
+     */
42 50
     async componentWillMount() {
43 51
         let val = await AsyncStorage.getItem(proxiwashNotifKey);
44 52
         if (val === null)
@@ -48,7 +56,11 @@ export default class SettingsScreen extends React.Component<Props, State> {
48 56
         });
49 57
     }
50 58
 
51
-
59
+    /**
60
+     * Save the value for the proxiwash reminder notification time
61
+     *
62
+     * @param value The value to store
63
+     */
52 64
     onProxiwashNotifPickerValueChange(value: string) {
53 65
         AsyncStorage.setItem(proxiwashNotifKey, value);
54 66
         this.setState({
@@ -56,6 +68,11 @@ export default class SettingsScreen extends React.Component<Props, State> {
56 68
         });
57 69
     }
58 70
 
71
+    /**
72
+     * Returns a picker allowing the user to select the proxiwash reminder notification time
73
+     *
74
+     * @returns {React.Node}
75
+     */
59 76
     getProxiwashNotifPicker() {
60 77
         return (
61 78
             <Picker
@@ -77,6 +94,9 @@ export default class SettingsScreen extends React.Component<Props, State> {
77 94
         );
78 95
     }
79 96
 
97
+    /**
98
+     * Toggle night mode and save it to preferences
99
+     */
80 100
     toggleNightMode() {
81 101
         ThemeManager.getInstance().setNightMode(!this.state.nightMode);
82 102
         this.setState({nightMode: !this.state.nightMode});
@@ -84,6 +104,9 @@ export default class SettingsScreen extends React.Component<Props, State> {
84 104
         this.resetStack();
85 105
     }
86 106
 
107
+    /**
108
+     * Reset react navigation stack to allow for a theme reset
109
+     */
87 110
     resetStack() {
88 111
         const resetAction = StackActions.reset({
89 112
             index: 0,
@@ -94,7 +117,16 @@ export default class SettingsScreen extends React.Component<Props, State> {
94 117
         this.props.navigation.navigate('Settings');
95 118
     }
96 119
 
97
-    getToggleItem(onPressCallback: Function, icon: string, text: string, subtitle: string) {
120
+    /**
121
+     * Get a list item using a checkbox control
122
+     *
123
+     * @param onPressCallback The callback when the checkbox state changes
124
+     * @param icon The icon name to display on the list item
125
+     * @param title The text to display as this list item title
126
+     * @param subtitle The text to display as this list item subtitle
127
+     * @returns {React.Node}
128
+     */
129
+    getToggleItem(onPressCallback: Function, icon: string, title: string, subtitle: string) {
98 130
         return (
99 131
             <ListItem
100 132
                 button
@@ -106,7 +138,7 @@ export default class SettingsScreen extends React.Component<Props, State> {
106 138
                 </Left>
107 139
                 <Body>
108 140
                     <Text>
109
-                        {text}
141
+                        {title}
110 142
                     </Text>
111 143
                     <Text note>
112 144
                         {subtitle}
@@ -120,7 +152,16 @@ export default class SettingsScreen extends React.Component<Props, State> {
120 152
         );
121 153
     }
122 154
 
123
-    static getGeneralItem(control: React.Node, icon: string, text: string, subtitle: string) {
155
+    /**
156
+     * Get a list item using the specified control
157
+     *
158
+     * @param control The custom control to use
159
+     * @param icon The icon name to display on the list item
160
+     * @param title The text to display as this list item title
161
+     * @param subtitle The text to display as this list item subtitle
162
+     * @returns {React.Node}
163
+     */
164
+    static getGeneralItem(control: React.Node, icon: string, title: string, subtitle: string) {
124 165
         return (
125 166
             <ListItem
126 167
                 thumbnail
@@ -130,7 +171,7 @@ export default class SettingsScreen extends React.Component<Props, State> {
130 171
                 </Left>
131 172
                 <Body>
132 173
                     <Text>
133
-                        {text}
174
+                        {title}
134 175
                     </Text>
135 176
                     <Text note>
136 177
                         {subtitle}

Loading…
Cancel
Save