Skip to content

Commit

Permalink
Handle offline case
Browse files Browse the repository at this point in the history
  • Loading branch information
marcaaron committed Oct 26, 2023
1 parent bd48b13 commit 66b0f89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import personalDetailsPropType from '../../../personalDetailsPropType';
import reportPropTypes from '../../../reportPropTypes';
import refPropTypes from '../../../../components/refPropTypes';
import * as Report from '../../../../libs/actions/Report';
import useNetwork from '../../../../hooks/useNetwork';

const propTypes = {
/** Beta features list */
Expand Down Expand Up @@ -98,6 +99,7 @@ function MoneyRequestParticipantsSelector({
personalDetails: [],
userToInvite: null,
});
const {isOffline} = useNetwork();

const maxParticipantsReached = participants.length === CONST.REPORT.MAXIMUM_PARTICIPANTS;

Expand Down Expand Up @@ -284,6 +286,7 @@ function MoneyRequestParticipantsSelector({
confirmButtonText={translate('iou.addToSplit')}
onConfirmSelection={navigateToSplit}
textInputLabel={translate('optionsSelector.nameEmailOrPhoneNumber')}
textInputAlert={isOffline ? `${translate('common.youAppearToBeOffline')} ${translate('search.resultsAreLimited')}` : ''}
safeAreaPaddingBottomStyle={safeAreaPaddingBottomStyle}
shouldShowOptions={isOptionsDataReady}
shouldPreventDefaultFocusOnSelectRow={!Browser.isMobile()}
Expand Down
3 changes: 3 additions & 0 deletions src/pages/tasks/TaskShareDestinationSelectorModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import * as Task from '../../libs/actions/Task';
import * as ReportUtils from '../../libs/ReportUtils';
import ROUTES from '../../ROUTES';
import * as Report from '../../libs/actions/Report';
import useNetwork from '../../hooks/useNetwork';

const propTypes = {
/* Onyx Props */
Expand Down Expand Up @@ -52,6 +53,7 @@ function TaskShareDestinationSelectorModal(props) {
const [filteredRecentReports, setFilteredRecentReports] = useState([]);
const {isSearchingForReports} = props;
const optionRef = useRef();
const {isOffline} = useNetwork();

const filteredReports = useMemo(() => {
const reports = {};
Expand Down Expand Up @@ -146,6 +148,7 @@ function TaskShareDestinationSelectorModal(props) {
showTitleTooltip
shouldShowOptions={didScreenTransitionEnd}
textInputLabel={props.translate('optionsSelector.nameEmailOrPhoneNumber')}
textInputAlert={isOffline ? `${props.translate('common.youAppearToBeOffline')} ${props.translate('search.resultsAreLimited')}` : ''}
safeAreaPaddingBottomStyle={safeAreaPaddingBottomStyle}
autoFocus={false}
ref={optionRef}
Expand Down

0 comments on commit 66b0f89

Please sign in to comment.