repl.it
@dhruvdutt/

react-navigation screen mapping scope example

JavaScript

No description

fork
loading
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
const items = [
	{
		key: 'Home',
		params: undefined,
		routeName: 'Home',
	},
	{
		key: 'DataSearch_Basic',
		params: undefined,
		routeName: 'DataSearch_Basic',
	},
	{
		key: 'DataSearch_With Icon Position',
		params: undefined,
		routeName: 'DataSearch_With Icon Position',
	},
	{
		key: 'DataSearch_Without Search Icon',
		params: undefined,
		routeName: 'DataSearch_Without Search Icon',
	},
	{
		key: 'DataSearch_Without Autosuggest',
		params: undefined,
		routeName: 'DataSearch_Without Autosuggest',
	},
	{
		key: 'DataSearch_With Custom Styles',
		params: undefined,
		routeName: 'DataSearch_With Custom Styles',
	},
	{
		key: 'DataSearch_With Default Suggestions',
		params: undefined,
		routeName: 'DataSearch_With Default Suggestions',
	},
	{
		key: 'DataSearch_With Default Selected',
		params: undefined,
		routeName: 'DataSearch_With Default Selected',
	},
	{
		key: 'DataSearch_With Fuzziness As Auto',
		params: undefined,
		routeName: 'DataSearch_With Fuzziness As Auto',
	},
	{
		key: 'DataSearch_Playground',
		params: undefined,
		routeName: 'DataSearch_Playground',
	},
	{
		key: 'TextField_Basic',
		params: undefined,
		routeName: 'TextField_Basic',
	},
	{
		key: 'TextField_Without Placeholder',
		params: undefined,
		routeName: 'TextField_Without Placeholder',
	},
	{
		key: 'TextField_With DefaultSelected',
		params: undefined,
		routeName: 'TextField_With DefaultSelected',
	},
	{
		key: 'TextField_With CustomStyles',
		params: undefined,
		routeName: 'TextField_With CustomStyles',
	},
	{
		key: 'TextField_Playground',
		params: undefined,
		routeName: 'TextField_Playground',
	},
	{
		key: 'MultiDropdownList_Basic',
		params: undefined,
		routeName: 'MultiDropdownList_Basic',
	},
	{
		key: 'MultiDropdownList_Without Placeholder',
		params: undefined,
		routeName: 'MultiDropdownList_Without Placeholder',
	},
	{
		key: 'MultiDropdownList_With Size',
		params: undefined,
		routeName: 'MultiDropdownList_With Size',
	},
	{
		key: 'MultiDropdownList_With Custom Styles',
		params: undefined,
		routeName: 'MultiDropdownList_With Custom Styles',
	},
	{
		key: 'MultiDropdownList_Without Count',
		params: undefined,
		routeName: 'MultiDropdownList_Without Count',
	},
	{
		key: 'MultiDropdownList_With Sort Z->A',
		params: undefined,
		routeName: 'MultiDropdownList_With Sort Z->A',
	},
	{
		key: 'MultiDropdownList_With Select All',
		params: undefined,
		routeName: 'MultiDropdownList_With Select All',
	},
	{
		key: 'MultiDropdownList_With Default Selected',
		params: undefined,
		routeName: 'MultiDropdownList_With Default Selected',
	},
	{
		key: 'MultiDropdownList_Playground',
		params: undefined,
		routeName: 'MultiDropdownList_Playground',
	},
	{
		key: 'MultiDropdownRange_Basic',
		params: undefined,
		routeName: 'MultiDropdownRange_Basic',
	},
	{
		key: 'MultiDropdownRange_Without Placeholder',
		params: undefined,
		routeName: 'MultiDropdownRange_Without Placeholder',
	},
	{
		key: 'MultiDropdownRange_With Default Selected',
		params: undefined,
		routeName: 'MultiDropdownRange_With Default Selected',
	},
	{
		key: 'MultiDropdownRange_With Custom Styles',
		params: undefined,
		routeName: 'MultiDropdownRange_With Custom Styles',
	},
	{
		key: 'MultiDropdownRange_Playground',
		params: undefined,
		routeName: 'MultiDropdownRange_Playground',
	},
	{
		key: 'SingleDropdownList_Basic',
		params: undefined,
		routeName: 'SingleDropdownList_Basic',
	},
	{
		key: 'SingleDropdownList_WithoutPlaceholder',
		params: undefined,
		routeName: 'SingleDropdownList_WithoutPlaceholder',
	},
	{
		key: 'SingleDropdownList_With Max Size as 5',
		params: undefined,
		routeName: 'SingleDropdownList_With Max Size as 5',
	},
	{
		key: 'SingleDropdownList_Without Count',
		params: undefined,
		routeName: 'SingleDropdownList_Without Count',
	},
	{
		key: 'SingleDropdownList_With Custom Styles',
		params: undefined,
		routeName: 'SingleDropdownList_With Custom Styles',
	},
	{
		key: 'SingleDropdownList_With Sort Z->A',
		params: undefined,
		routeName: 'SingleDropdownList_With Sort Z->A',
	},
	{
		key: 'SingleDropdownList_With Select All Option',
		params: undefined,
		routeName: 'SingleDropdownList_With Select All Option',
	},
	{
		key: 'SingleDropdownList_With Default Selected',
		params: undefined,
		routeName: 'SingleDropdownList_With Default Selected',
	},
	{
		key: 'SingleDropdownList_Playground',
		params: undefined,
		routeName: 'SingleDropdownList_Playground',
	},
	{
		key: 'SingleDropdownRange_Basic',
		params: undefined,
		routeName: 'SingleDropdownRange_Basic',
	},
	{
		key: 'SingleDropdownRange_Without Placeholder',
		params: undefined,
		routeName: 'SingleDropdownRange_Without Placeholder',
	},
	{
		key: 'SingleDropdownRange_With Default Selected',
		params: undefined,
		routeName: 'SingleDropdownRange_With Default Selected',
	},
	{
		key: 'SingleDropdownRange_With Custom Styles',
		params: undefined,
		routeName: 'SingleDropdownRange_With Custom Styles',
	},
	{
		key: 'SingleDropdownRange_Playground',
		params: undefined,
		routeName: 'SingleDropdownRange_Playground',
	},
	{
		key: 'DatePicker_Basic',
		params: undefined,
		routeName: 'DatePicker_Basic',
	},
	{
		key: 'DatePicker_With Placeholder',
		params: undefined,
		routeName: 'DatePicker_With Placeholder',
	},
	{
		key: 'DatePicker_With Initial Month',
		params: undefined,
		routeName: 'DatePicker_With Initial Month',
	},
	{
		key: 'DatePicker_With Custom Styles',
		params: undefined,
		routeName: 'DatePicker_With Custom Styles',
	},
	{
		key: 'DatePicker_Playground',
		params: undefined,
		routeName: 'DatePicker_Playground',
	},
	{
		key: 'DateRange_Basic',
		params: undefined,
		routeName: 'DateRange_Basic',
	},
	{
		key: 'DateRange_With Placeholder',
		params: undefined,
		routeName: 'DateRange_With Placeholder',
	},
	{
		key: 'DateRange_With Default Selected',
		params: undefined,
		routeName: 'DateRange_With Default Selected',
	},
	{
		key: 'DateRange_With Custom Styles',
		params: undefined,
		routeName: 'DateRange_With Custom Styles',
	},
	{
		key: 'DateRange_With Query Format',
		params: undefined,
		routeName: 'DateRange_With Query Format',
	},
	{
		key: 'DateRange_Playground',
		params: undefined,
		routeName: 'DateRange_Playground',
	},
];

const evaluateOuterDrawerListItems = items => {
	const drawerItems = {};
	items.forEach((item, index) => {
		let { key } = item;
		// Delimeter _
		key = key.substr(0, key.indexOf('_'));
		if (key.length) {
			if (drawerItems.hasOwnProperty(key)) {
				drawerItems[key].end = index;
			} else {
				drawerItems[key] = {
					start: index,
					end: 0,
				};
			}
		}
	});
	return drawerItems;
};

const scopedItems = evaluateOuterDrawerListItems(items);

console.log(JSON.stringify(scopedItems, null, '\t'));
Native Browser JavaScript