-
Notifications
You must be signed in to change notification settings - Fork 3k
/
Copy pathBaseOptionsSelector.js
executable file
·676 lines (602 loc) · 26.9 KB
/
BaseOptionsSelector.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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
import lodashGet from 'lodash/get';
import PropTypes from 'prop-types';
import React, {Component} from 'react';
import {ScrollView, View} from 'react-native';
import _ from 'underscore';
import ArrowKeyFocusManager from '@components/ArrowKeyFocusManager';
import Button from '@components/Button';
import FixedFooter from '@components/FixedFooter';
import FormHelpMessage from '@components/FormHelpMessage';
import Icon from '@components/Icon';
import {Info} from '@components/Icon/Expensicons';
import OptionsList from '@components/OptionsList';
import {PressableWithoutFeedback} from '@components/Pressable';
import ShowMoreButton from '@components/ShowMoreButton';
import Text from '@components/Text';
import TextInput from '@components/TextInput';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import withNavigationFocus from '@components/withNavigationFocus';
import withTheme, {withThemePropTypes} from '@components/withTheme';
import withThemeStyles, {withThemeStylesPropTypes} from '@components/withThemeStyles';
import compose from '@libs/compose';
import getPlatform from '@libs/getPlatform';
import KeyboardShortcut from '@libs/KeyboardShortcut';
import Navigation from '@libs/Navigation/Navigation';
import setSelection from '@libs/setSelection';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import {defaultProps as optionsSelectorDefaultProps, propTypes as optionsSelectorPropTypes} from './optionsSelectorPropTypes';
const propTypes = {
/** padding bottom style of safe area */
safeAreaPaddingBottomStyle: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
/** Content container styles for OptionsList */
contentContainerStyles: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
/** List container styles for OptionsList */
listContainerStyles: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
/** List styles for OptionsList */
listStyles: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
/** Whether navigation is focused */
isFocused: PropTypes.bool.isRequired,
/** Whether referral CTA should be displayed */
shouldShowReferralCTA: PropTypes.bool,
/** Referral content type */
referralContentType: PropTypes.string,
...optionsSelectorPropTypes,
...withLocalizePropTypes,
...withThemeStylesPropTypes,
...withThemePropTypes,
};
const defaultProps = {
shouldDelayFocus: false,
shouldShowReferralCTA: false,
referralContentType: CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND,
safeAreaPaddingBottomStyle: {},
contentContainerStyles: [],
listContainerStyles: undefined,
listStyles: [],
...optionsSelectorDefaultProps,
};
class BaseOptionsSelector extends Component {
constructor(props) {
super(props);
this.updateFocusedIndex = this.updateFocusedIndex.bind(this);
this.scrollToIndex = this.scrollToIndex.bind(this);
this.selectRow = this.selectRow.bind(this);
this.handleReferralModal = this.handleReferralModal.bind(this);
this.selectFocusedOption = this.selectFocusedOption.bind(this);
this.addToSelection = this.addToSelection.bind(this);
this.updateSearchValue = this.updateSearchValue.bind(this);
this.incrementPage = this.incrementPage.bind(this);
this.sliceSections = this.sliceSections.bind(this);
this.calculateAllVisibleOptionsCount = this.calculateAllVisibleOptionsCount.bind(this);
this.relatedTarget = null;
const allOptions = this.flattenSections();
const sections = this.sliceSections();
const focusedIndex = this.getInitiallyFocusedIndex(allOptions);
this.state = {
sections,
allOptions,
focusedIndex,
shouldDisableRowSelection: false,
shouldShowReferralModal: false,
errorMessage: '',
paginationPage: 1,
};
}
componentDidMount() {
this.subscribeToKeyboardShortcut();
if (this.props.isFocused && this.props.autoFocus && this.textInput) {
this.focusTimeout = setTimeout(() => {
this.textInput.focus();
}, CONST.ANIMATED_TRANSITION);
}
this.scrollToIndex(this.props.selectedOptions.length ? 0 : this.state.focusedIndex, false);
}
componentDidUpdate(prevProps, prevState) {
if (prevProps.isFocused !== this.props.isFocused) {
if (this.props.isFocused) {
this.subscribeToKeyboardShortcut();
} else {
this.unSubscribeFromKeyboardShortcut();
}
}
// Screen coming back into focus, for example
// when doing Cmd+Shift+K, then Cmd+K, then Cmd+Shift+K.
// Only applies to platforms that support keyboard shortcuts
if ([CONST.PLATFORM.DESKTOP, CONST.PLATFORM.WEB].includes(getPlatform()) && !prevProps.isFocused && this.props.isFocused && this.props.autoFocus && this.textInput) {
setTimeout(() => {
this.textInput.focus();
}, CONST.ANIMATED_TRANSITION);
}
if (prevState.paginationPage !== this.state.paginationPage) {
const newSections = this.sliceSections();
this.setState({
sections: newSections,
});
}
if (_.isEqual(this.props.sections, prevProps.sections)) {
return;
}
const newSections = this.sliceSections();
const newOptions = this.flattenSections();
if (prevProps.preferredLocale !== this.props.preferredLocale) {
this.setState({
sections: newSections,
allOptions: newOptions,
});
return;
}
const newFocusedIndex = this.props.selectedOptions.length;
const isNewFocusedIndex = newFocusedIndex !== this.state.focusedIndex;
// eslint-disable-next-line react/no-did-update-set-state
this.setState(
{
sections: newSections,
allOptions: newOptions,
focusedIndex: _.isNumber(this.props.focusedIndex) ? this.props.focusedIndex : newFocusedIndex,
},
() => {
// If we just toggled an option on a multi-selection page or cleared the search input, scroll to top
if (this.props.selectedOptions.length !== prevProps.selectedOptions.length || (!!prevProps.value && !this.props.value)) {
this.scrollToIndex(0);
return;
}
// Otherwise, scroll to the focused index (as long as it's in range)
if (this.state.allOptions.length <= this.state.focusedIndex || !isNewFocusedIndex) {
return;
}
this.scrollToIndex(this.state.focusedIndex);
},
);
}
componentWillUnmount() {
if (this.focusTimeout) {
clearTimeout(this.focusTimeout);
}
this.unSubscribeFromKeyboardShortcut();
}
/**
* @param {Array<Object>} allOptions
* @returns {Number}
*/
getInitiallyFocusedIndex(allOptions) {
let defaultIndex;
if (this.props.shouldTextInputAppearBelowOptions) {
defaultIndex = allOptions.length;
} else if (this.props.focusedIndex >= 0) {
defaultIndex = this.props.focusedIndex;
} else {
defaultIndex = this.props.selectedOptions.length;
}
if (_.isUndefined(this.props.initiallyFocusedOptionKey)) {
return defaultIndex;
}
const indexOfInitiallyFocusedOption = _.findIndex(allOptions, (option) => option.keyForList === this.props.initiallyFocusedOptionKey);
if (indexOfInitiallyFocusedOption >= 0) {
return indexOfInitiallyFocusedOption;
}
return defaultIndex;
}
/**
* Maps sections to render only allowed count of them per section.
*
* @returns {Objects[]}
*/
sliceSections() {
return _.map(this.props.sections, (section) => {
if (_.isEmpty(section.data)) {
return section;
}
return {
...section,
data: section.data.slice(0, CONST.MAX_OPTIONS_SELECTOR_PAGE_LENGTH * lodashGet(this.state, 'paginationPage', 1)),
};
});
}
/**
* Calculates all currently visible options based on the sections that are currently being shown
* and the number of items of those sections.
*
* @returns {Number}
*/
calculateAllVisibleOptionsCount() {
let count = 0;
_.forEach(this.state.sections, (section) => {
count += lodashGet(section, 'data.length', 0);
});
return count;
}
updateSearchValue(value) {
this.setState({
paginationPage: 1,
errorMessage: value.length > this.props.maxLength ? this.props.translate('common.error.characterLimitExceedCounter', {length: value.length, limit: this.props.maxLength}) : '',
});
this.props.onChangeText(value);
}
handleReferralModal() {
this.setState((prevState) => ({shouldShowReferralModal: !prevState.shouldShowReferralModal}));
}
subscribeToKeyboardShortcut() {
const enterConfig = CONST.KEYBOARD_SHORTCUTS.ENTER;
this.unsubscribeEnter = KeyboardShortcut.subscribe(
enterConfig.shortcutKey,
this.selectFocusedOption,
enterConfig.descriptionKey,
enterConfig.modifiers,
true,
() => !this.state.allOptions[this.state.focusedIndex],
);
const CTRLEnterConfig = CONST.KEYBOARD_SHORTCUTS.CTRL_ENTER;
this.unsubscribeCTRLEnter = KeyboardShortcut.subscribe(
CTRLEnterConfig.shortcutKey,
() => {
if (this.props.canSelectMultipleOptions) {
this.props.onConfirmSelection();
return;
}
const focusedOption = this.state.allOptions[this.state.focusedIndex];
if (!focusedOption) {
return;
}
this.selectRow(focusedOption);
},
CTRLEnterConfig.descriptionKey,
CTRLEnterConfig.modifiers,
true,
);
}
unSubscribeFromKeyboardShortcut() {
if (this.unsubscribeEnter) {
this.unsubscribeEnter();
}
if (this.unsubscribeCTRLEnter) {
this.unsubscribeCTRLEnter();
}
}
selectFocusedOption() {
const focusedOption = this.state.allOptions[this.state.focusedIndex];
if (!focusedOption || !this.props.isFocused) {
return;
}
if (this.props.canSelectMultipleOptions) {
this.selectRow(focusedOption);
} else if (!this.state.shouldDisableRowSelection) {
this.setState({shouldDisableRowSelection: true});
let result = this.selectRow(focusedOption);
if (!(result instanceof Promise)) {
result = Promise.resolve();
}
setTimeout(() => {
result.finally(() => {
this.setState({shouldDisableRowSelection: false});
});
}, 500);
}
}
focus() {
if (!this.textInput) {
return;
}
this.textInput.focus();
}
/**
* Flattens the sections into a single array of options.
* Each object in this array is enhanced to have:
*
* 1. A `sectionIndex`, which represents the index of the section it came from
* 2. An `index`, which represents the index of the option within the section it came from.
*
* @returns {Array<Object>}
*/
flattenSections() {
const allOptions = [];
this.disabledOptionsIndexes = [];
let index = 0;
_.each(this.props.sections, (section, sectionIndex) => {
_.each(section.data, (option, optionIndex) => {
allOptions.push({
...option,
sectionIndex,
index: optionIndex,
});
if (section.isDisabled || option.isDisabled) {
this.disabledOptionsIndexes.push(index);
}
index += 1;
});
});
return allOptions;
}
/**
* @param {Number} index
*/
updateFocusedIndex(index) {
this.setState({focusedIndex: index}, () => this.scrollToIndex(index));
}
/**
* Scrolls to the focused index within the SectionList
*
* @param {Number} index
* @param {Boolean} animated
*/
scrollToIndex(index, animated = true) {
const option = this.state.allOptions[index];
if (!this.list || !option) {
return;
}
const itemIndex = option.index;
const sectionIndex = option.sectionIndex;
if (!lodashGet(this.state.sections, `[${sectionIndex}].data[${itemIndex}]`, null)) {
return;
}
// Note: react-native's SectionList automatically strips out any empty sections.
// So we need to reduce the sectionIndex to remove any empty sections in front of the one we're trying to scroll to.
// Otherwise, it will cause an index-out-of-bounds error and crash the app.
let adjustedSectionIndex = sectionIndex;
for (let i = 0; i < sectionIndex; i++) {
if (_.isEmpty(lodashGet(this.state.sections, `[${i}].data`))) {
adjustedSectionIndex--;
}
}
this.list.scrollToLocation({sectionIndex: adjustedSectionIndex, itemIndex, animated});
}
/**
* Completes the follow-up actions after a row is selected
*
* @param {Object} option
* @param {Object} ref
* @returns {Promise}
*/
selectRow(option, ref) {
return new Promise((resolve) => {
if (this.props.shouldShowTextInput && this.props.shouldPreventDefaultFocusOnSelectRow) {
if (this.relatedTarget && ref === this.relatedTarget) {
this.textInput.focus();
this.relatedTarget = null;
}
if (this.textInput.isFocused()) {
setSelection(this.textInput, 0, this.props.value.length);
}
}
const selectedOption = this.props.onSelectRow(option);
resolve(selectedOption);
if (!this.props.canSelectMultipleOptions) {
return;
}
// Focus the first unselected item from the list (i.e: the best result according to the current search term)
this.setState({
focusedIndex: this.props.selectedOptions.length,
});
});
}
/**
* Completes the follow-up action after clicking on multiple select button
* @param {Object} option
*/
addToSelection(option) {
if (this.props.shouldShowTextInput && this.props.shouldPreventDefaultFocusOnSelectRow) {
this.textInput.focus();
if (this.textInput.isFocused()) {
setSelection(this.textInput, 0, this.props.value.length);
}
}
this.props.onAddToSelection(option);
}
/**
* Increments a pagination page to show more items
*/
incrementPage() {
this.setState((prev) => ({
paginationPage: prev.paginationPage + 1,
}));
}
render() {
const shouldShowShowMoreButton = this.state.allOptions.length > CONST.MAX_OPTIONS_SELECTOR_PAGE_LENGTH * this.state.paginationPage;
const shouldShowFooter =
!this.props.isReadOnly && (this.props.shouldShowConfirmButton || this.props.footerContent) && !(this.props.canSelectMultipleOptions && _.isEmpty(this.props.selectedOptions));
const defaultConfirmButtonText = _.isUndefined(this.props.confirmButtonText) ? this.props.translate('common.confirm') : this.props.confirmButtonText;
const shouldShowDefaultConfirmButton = !this.props.footerContent && defaultConfirmButtonText;
const safeAreaPaddingBottomStyle = shouldShowFooter ? undefined : this.props.safeAreaPaddingBottomStyle;
const listContainerStyles = this.props.listContainerStyles || [this.props.themeStyles.flex1];
const textInput = (
<TextInput
ref={(el) => (this.textInput = el)}
value={this.props.value}
label={this.props.textInputLabel}
accessibilityLabel={this.props.textInputLabel}
role={CONST.ACCESSIBILITY_ROLE.TEXT}
onChangeText={this.updateSearchValue}
errorText={this.state.errorMessage}
onSubmitEditing={this.selectFocusedOption}
placeholder={this.props.placeholderText}
maxLength={this.props.maxLength + CONST.ADDITIONAL_ALLOWED_CHARACTERS}
keyboardType={this.props.keyboardType}
onBlur={(e) => {
if (!this.props.shouldPreventDefaultFocusOnSelectRow) {
return;
}
this.relatedTarget = e.relatedTarget;
}}
selectTextOnFocus
blurOnSubmit={Boolean(this.state.allOptions.length)}
spellCheck={false}
shouldInterceptSwipe={this.props.shouldTextInputInterceptSwipe}
isLoading={this.props.isLoadingNewOptions}
/>
);
const optionsList = (
<OptionsList
ref={(el) => (this.list = el)}
optionHoveredStyle={this.props.optionHoveredStyle || this.props.themeStyles.hoveredComponentBG}
onSelectRow={this.props.onSelectRow ? this.selectRow : undefined}
sections={this.state.sections}
focusedIndex={this.state.focusedIndex}
selectedOptions={this.props.selectedOptions}
canSelectMultipleOptions={this.props.canSelectMultipleOptions}
shouldShowMultipleOptionSelectorAsButton={this.props.shouldShowMultipleOptionSelectorAsButton}
multipleOptionSelectorButtonText={this.props.multipleOptionSelectorButtonText}
onAddToSelection={this.addToSelection}
hideSectionHeaders={this.props.hideSectionHeaders}
headerMessage={this.state.errorMessage ? '' : this.props.headerMessage}
boldStyle={this.props.boldStyle}
showTitleTooltip={this.props.showTitleTooltip}
isDisabled={this.props.isDisabled}
shouldHaveOptionSeparator={this.props.shouldHaveOptionSeparator}
highlightSelectedOptions={this.props.highlightSelectedOptions}
onLayout={() => {
if (this.props.selectedOptions.length === 0) {
this.scrollToIndex(this.state.focusedIndex, false);
}
if (this.props.onLayout) {
this.props.onLayout();
}
}}
contentContainerStyles={[safeAreaPaddingBottomStyle, ...this.props.contentContainerStyles]}
sectionHeaderStyle={this.props.sectionHeaderStyle}
listContainerStyles={listContainerStyles}
listStyles={this.props.listStyles}
isLoading={!this.props.shouldShowOptions}
showScrollIndicator={this.props.showScrollIndicator}
isRowMultilineSupported={this.props.isRowMultilineSupported}
isLoadingNewOptions={this.props.isLoadingNewOptions}
shouldPreventDefaultFocusOnSelectRow={this.props.shouldPreventDefaultFocusOnSelectRow}
nestedScrollEnabled={this.props.nestedScrollEnabled}
bounces={!this.props.shouldTextInputAppearBelowOptions || !this.props.shouldAllowScrollingChildren}
renderFooterContent={() =>
shouldShowShowMoreButton && (
<ShowMoreButton
containerStyle={{...this.props.themeStyles.mt2, ...this.props.themeStyles.mb5}}
currentCount={CONST.MAX_OPTIONS_SELECTOR_PAGE_LENGTH * this.state.paginationPage}
totalCount={this.state.allOptions.length}
onPress={this.incrementPage}
/>
)
}
/>
);
const optionsAndInputsBelowThem = (
<>
<View
style={[
this.props.themeStyles.flexGrow0,
this.props.themeStyles.flexShrink1,
this.props.themeStyles.flexBasisAuto,
this.props.themeStyles.w100,
this.props.themeStyles.flexRow,
]}
>
{optionsList}
</View>
<View
style={
this.props.shouldUseStyleForChildren
? [this.props.themeStyles.ph5, this.props.themeStyles.pv5, this.props.themeStyles.flexGrow1, this.props.themeStyles.flexShrink0]
: []
}
>
{this.props.children}
{this.props.shouldShowTextInput && textInput}
</View>
</>
);
return (
<ArrowKeyFocusManager
disabledIndexes={this.disabledOptionsIndexes}
focusedIndex={this.state.focusedIndex}
maxIndex={this.calculateAllVisibleOptionsCount() - 1}
onFocusedIndexChanged={this.props.disableArrowKeysActions ? () => {} : this.updateFocusedIndex}
shouldResetIndexOnEndReached={false}
>
<View style={[this.props.themeStyles.flexGrow1, this.props.themeStyles.flexShrink1, this.props.themeStyles.flexBasisAuto]}>
{/*
* The OptionsList component uses a SectionList which uses a VirtualizedList internally.
* VirtualizedList cannot be directly nested within ScrollViews of the same orientation.
* To work around this, we wrap the OptionsList component with a horizontal ScrollView.
*/}
{this.props.shouldTextInputAppearBelowOptions && this.props.shouldAllowScrollingChildren && (
<ScrollView contentContainerStyle={[this.props.themeStyles.flexGrow1]}>
<ScrollView
horizontal
bounces={false}
contentContainerStyle={[this.props.themeStyles.flex1, this.props.themeStyles.flexColumn]}
>
{optionsAndInputsBelowThem}
</ScrollView>
</ScrollView>
)}
{this.props.shouldTextInputAppearBelowOptions && !this.props.shouldAllowScrollingChildren && optionsAndInputsBelowThem}
{!this.props.shouldTextInputAppearBelowOptions && (
<>
<View style={this.props.shouldUseStyleForChildren ? [this.props.themeStyles.ph5, this.props.themeStyles.pb3] : []}>
{this.props.children}
{this.props.shouldShowTextInput && textInput}
{Boolean(this.props.textInputAlert) && (
<FormHelpMessage
message={this.props.textInputAlert}
style={[this.props.themeStyles.mb3]}
isError={false}
/>
)}
</View>
{optionsList}
</>
)}
</View>
{this.props.shouldShowReferralCTA && (
<View style={[this.props.themeStyles.ph5, this.props.themeStyles.pb5, this.props.themeStyles.flexShrink0]}>
<PressableWithoutFeedback
onPress={() => {
Navigation.navigate(ROUTES.REFERRAL_DETAILS_MODAL.getRoute(this.props.referralContentType));
}}
style={[
this.props.themeStyles.p5,
this.props.themeStyles.w100,
this.props.themeStyles.br2,
this.props.themeStyles.highlightBG,
this.props.themeStyles.flexRow,
this.props.themeStyles.justifyContentBetween,
this.props.themeStyles.alignItemsCenter,
{gap: 10},
]}
accessibilityLabel="referral"
role={CONST.ACCESSIBILITY_ROLE.BUTTON}
>
<Text>
{this.props.translate(`referralProgram.${this.props.referralContentType}.buttonText1`)}
<Text
color={this.props.theme.success}
style={this.props.themeStyles.textStrong}
>
{this.props.translate(`referralProgram.${this.props.referralContentType}.buttonText2`)}
</Text>
</Text>
<Icon
src={Info}
height={20}
width={20}
/>
</PressableWithoutFeedback>
</View>
)}
{shouldShowFooter && (
<FixedFooter>
{shouldShowDefaultConfirmButton && (
<Button
success
style={[this.props.themeStyles.w100]}
text={defaultConfirmButtonText}
onPress={this.props.onConfirmSelection}
pressOnEnter
enterKeyEventListenerPriority={1}
/>
)}
{this.props.footerContent}
</FixedFooter>
)}
</ArrowKeyFocusManager>
);
}
}
BaseOptionsSelector.defaultProps = defaultProps;
BaseOptionsSelector.propTypes = propTypes;
export default compose(withLocalize, withNavigationFocus, withThemeStyles, withTheme)(BaseOptionsSelector);