Skip to content

Commit caf91ae

Browse files
authored
Merge pull request #32665 from brunovjk/fix/31779
Fix Black Screen Transition Issue by Reusing didScreenTransitionEnd in MoneyRequestParticipantsSelector
2 parents ff6b134 + 6c649a3 commit caf91ae

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import useThemeStyles from '@hooks/useThemeStyles';
1717
import * as Report from '@libs/actions/Report';
1818
import * as DeviceCapabilities from '@libs/DeviceCapabilities';
1919
import * as OptionsListUtils from '@libs/OptionsListUtils';
20+
import * as ReportUtils from '@libs/ReportUtils';
2021
import reportPropTypes from '@pages/reportPropTypes';
2122
import CONST from '@src/CONST';
2223
import ONYXKEYS from '@src/ONYXKEYS';
@@ -54,16 +55,16 @@ const propTypes = {
5455
/** The request type, ie. manual, scan, distance */
5556
iouRequestType: PropTypes.oneOf(_.values(CONST.IOU.REQUEST_TYPE)).isRequired,
5657

57-
/** Whether we are searching for reports in the server */
58-
isSearchingForReports: PropTypes.bool,
58+
/** Whether the parent screen transition has ended */
59+
didScreenTransitionEnd: PropTypes.bool,
5960
};
6061

6162
const defaultProps = {
6263
participants: [],
6364
safeAreaPaddingBottomStyle: {},
6465
reports: {},
6566
betas: [],
66-
isSearchingForReports: false,
67+
didScreenTransitionEnd: false,
6768
};
6869

6970
function MoneyTemporaryForRefactorRequestParticipantsSelector({
@@ -75,7 +76,7 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({
7576
safeAreaPaddingBottomStyle,
7677
iouType,
7778
iouRequestType,
78-
isSearchingForReports,
79+
didScreenTransitionEnd,
7980
}) {
8081
const {translate} = useLocalize();
8182
const styles = useThemeStyles();
@@ -95,6 +96,9 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({
9596
*/
9697
const [sections, newChatOptions] = useMemo(() => {
9798
const newSections = [];
99+
if (!didScreenTransitionEnd) {
100+
return [newSections, {}];
101+
}
98102
let indexOffset = 0;
99103

100104
const chatOptions = OptionsListUtils.getFilteredOptions(
@@ -169,7 +173,7 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({
169173
}
170174

171175
return [newSections, chatOptions];
172-
}, [reports, personalDetails, betas, searchTerm, participants, iouType, iouRequestType, maxParticipantsReached, translate]);
176+
}, [didScreenTransitionEnd, reports, personalDetails, betas, searchTerm, participants, iouType, iouRequestType, maxParticipantsReached, translate]);
173177

174178
/**
175179
* Adds a single participant to the request
@@ -328,11 +332,13 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({
328332
[addParticipantToSelection, isAllowedToSplit, styles, translate],
329333
);
330334

335+
const isOptionsDataReady = useMemo(() => ReportUtils.isReportDataReady() && OptionsListUtils.isPersonalDetailsReady(personalDetails), [personalDetails]);
336+
331337
return (
332338
<View style={[styles.flex1, styles.w100, participants.length > 0 ? safeAreaPaddingBottomStyle : {}]}>
333339
<SelectionList
334340
onConfirm={handleConfirmSelection}
335-
sections={sections}
341+
sections={didScreenTransitionEnd && isOptionsDataReady ? sections : CONST.EMPTY_ARRAY}
336342
textInputValue={searchTerm}
337343
textInputLabel={translate('optionsSelector.nameEmailOrPhoneNumber')}
338344
textInputHint={offlineMessage}
@@ -341,7 +347,7 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({
341347
onSelectRow={addSingleParticipant}
342348
footerContent={footerContent}
343349
headerMessage={headerMessage}
344-
showLoadingPlaceholder={isSearchingForReports}
350+
showLoadingPlaceholder={!(didScreenTransitionEnd && isOptionsDataReady)}
345351
rightHandSideComponent={itemRightSideComponent}
346352
/>
347353
</View>
@@ -359,8 +365,4 @@ export default withOnyx({
359365
betas: {
360366
key: ONYXKEYS.BETAS,
361367
},
362-
isSearchingForReports: {
363-
key: ONYXKEYS.IS_SEARCHING_FOR_REPORTS,
364-
initWithStoredValues: false,
365-
},
366368
})(MoneyTemporaryForRefactorRequestParticipantsSelector);

src/pages/iou/request/step/IOURequestStepParticipants.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,16 @@ function IOURequestStepParticipants({
8787
testID={IOURequestStepParticipants.displayName}
8888
includeSafeAreaPaddingBottom
8989
>
90-
<MoneyRequestParticipantsSelector
91-
participants={participants}
92-
onParticipantsAdded={addParticipant}
93-
onFinish={goToNextStep}
94-
iouType={iouType}
95-
iouRequestType={iouRequestType}
96-
/>
90+
{({didScreenTransitionEnd}) => (
91+
<MoneyRequestParticipantsSelector
92+
participants={participants}
93+
onParticipantsAdded={addParticipant}
94+
onFinish={goToNextStep}
95+
iouType={iouType}
96+
iouRequestType={iouRequestType}
97+
didScreenTransitionEnd={didScreenTransitionEnd}
98+
/>
99+
)}
97100
</StepScreenWrapper>
98101
);
99102
}

0 commit comments

Comments
 (0)