-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6272 from rushatgabhane/fix-6131
Fix Search - Arrow navigation on search stops working
- Loading branch information
Showing
4 changed files
with
163 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React, {forwardRef} from 'react'; | ||
import BaseOptionsList from './BaseOptionsList'; | ||
import withWindowDimensions from '../withWindowDimensions'; | ||
import {propTypes, defaultProps} from './optionsListPropTypes'; | ||
|
||
const OptionsList = forwardRef((props, ref) => ( | ||
<BaseOptionsList | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...props} | ||
ref={ref} | ||
keyboardDismissMode={props.isSmallScreenWidth ? 'on-drag' : 'none'} | ||
/> | ||
)); | ||
|
||
OptionsList.propTypes = propTypes; | ||
OptionsList.defaultProps = defaultProps; | ||
OptionsList.displayName = 'OptionsList'; | ||
|
||
export default withWindowDimensions(OptionsList); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React, {forwardRef} from 'react'; | ||
import {Keyboard} from 'react-native'; | ||
import BaseOptionsList from './BaseOptionsList'; | ||
import {propTypes, defaultProps} from './optionsListPropTypes'; | ||
|
||
const OptionsList = forwardRef((props, ref) => ( | ||
<BaseOptionsList | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...props} | ||
ref={ref} | ||
onScrollBeginDrag={() => Keyboard.dismiss()} | ||
/> | ||
)); | ||
|
||
OptionsList.propTypes = propTypes; | ||
OptionsList.defaultProps = defaultProps; | ||
OptionsList.displayName = 'OptionsList'; | ||
|
||
export default OptionsList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import PropTypes from 'prop-types'; | ||
import SectionList from '../SectionList'; | ||
import styles from '../../styles/styles'; | ||
import optionPropTypes from '../optionPropTypes'; | ||
|
||
const propTypes = { | ||
/** option Background Color */ | ||
optionBackgroundColor: PropTypes.string, | ||
|
||
/** option flexStyle for the options list container */ | ||
listContainerStyles: PropTypes.arrayOf(PropTypes.object), | ||
|
||
/** Style for hovered state */ | ||
// eslint-disable-next-line react/forbid-prop-types | ||
optionHoveredStyle: PropTypes.object, | ||
|
||
/** Extra styles for the section list container */ | ||
contentContainerStyles: PropTypes.arrayOf(PropTypes.object), | ||
|
||
/** Sections for the section list */ | ||
sections: PropTypes.arrayOf(PropTypes.shape({ | ||
/** Title of the section */ | ||
title: PropTypes.string, | ||
|
||
/** The initial index of this section given the total number of options in each section's data array */ | ||
indexOffset: PropTypes.number, | ||
|
||
/** Array of options */ | ||
data: PropTypes.arrayOf(optionPropTypes), | ||
|
||
/** Whether this section should show or not */ | ||
shouldShow: PropTypes.bool, | ||
})), | ||
|
||
/** Index for option to focus on */ | ||
focusedIndex: PropTypes.number, | ||
|
||
/** Array of already selected options */ | ||
selectedOptions: PropTypes.arrayOf(optionPropTypes), | ||
|
||
/** Whether we can select multiple options or not */ | ||
canSelectMultipleOptions: PropTypes.bool, | ||
|
||
/** Whether to show headers above each section or not */ | ||
hideSectionHeaders: PropTypes.bool, | ||
|
||
/** Whether to allow option focus or not */ | ||
disableFocusOptions: PropTypes.bool, | ||
|
||
/** A flag to indicate whether to show additional optional states, such as pin and draft icons */ | ||
hideAdditionalOptionStates: PropTypes.bool, | ||
|
||
/** Force the text style to be the unread style on all rows */ | ||
forceTextUnreadStyle: PropTypes.bool, | ||
|
||
/** Callback to fire when a row is selected */ | ||
onSelectRow: PropTypes.func, | ||
|
||
/** Optional header message */ | ||
headerMessage: PropTypes.string, | ||
|
||
/** Passed via forwardRef so we can access the SectionList ref */ | ||
innerRef: PropTypes.oneOfType([ | ||
PropTypes.func, | ||
PropTypes.shape({current: PropTypes.instanceOf(SectionList)}), | ||
]), | ||
|
||
/** Whether to show the title tooltip */ | ||
showTitleTooltip: PropTypes.bool, | ||
|
||
/** Toggle between compact and default view of the option */ | ||
optionMode: PropTypes.oneOf(['compact', 'default']), | ||
|
||
/** Whether to disable the interactivity of the list's option row(s) */ | ||
disableRowInteractivity: PropTypes.bool, | ||
|
||
/** Callback to execute when the SectionList lays out */ | ||
onLayout: PropTypes.func, | ||
}; | ||
|
||
const defaultProps = { | ||
optionBackgroundColor: undefined, | ||
optionHoveredStyle: undefined, | ||
contentContainerStyles: [], | ||
listContainerStyles: [styles.flex1], | ||
sections: [], | ||
focusedIndex: 0, | ||
selectedOptions: [], | ||
canSelectMultipleOptions: false, | ||
hideSectionHeaders: false, | ||
disableFocusOptions: false, | ||
hideAdditionalOptionStates: false, | ||
forceTextUnreadStyle: false, | ||
onSelectRow: () => {}, | ||
headerMessage: '', | ||
innerRef: null, | ||
showTitleTooltip: false, | ||
optionMode: undefined, | ||
disableRowInteractivity: false, | ||
onLayout: undefined, | ||
}; | ||
|
||
export {propTypes, defaultProps}; |