Repository navigation
[24476] Participants list is not hidden anymore on small screen devices. #26179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import React, {useEffect, useState, useCallback, useRef} from 'react'; | ||
| import {View} from 'react-native'; | ||
| import {ScrollView, View} from 'react-native'; | ||
| import PropTypes from 'prop-types'; | ||
| import lodashGet from 'lodash/get'; | ||
| import _ from 'underscore'; | ||
|
|
@@ -200,7 +200,7 @@ function MoneyRequestAmountForm({amount, currency, isEditing, forwardedRef, onCu | |
| const buttonText = isEditing ? translate('common.save') : translate('common.next'); | ||
|
|
||
| return ( | ||
| <> | ||
| <ScrollView contentContainerStyle={styles.flexGrow1}> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need |
||
| <View | ||
| nativeID={AMOUNT_VIEW_ID} | ||
| onMouseDown={(event) => onMouseDown(event, [AMOUNT_VIEW_ID])} | ||
|
|
@@ -253,7 +253,7 @@ function MoneyRequestAmountForm({amount, currency, isEditing, forwardedRef, onCu | |
| text={buttonText} | ||
| /> | ||
| </View> | ||
| </> | ||
| </ScrollView> | ||
| ); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import React, {useCallback, useEffect, useMemo, useRef} from 'react'; | ||
| import {View} from 'react-native'; | ||
| import {ScrollView, View} from 'react-native'; | ||
| import PropTypes from 'prop-types'; | ||
| import {withOnyx} from 'react-native-onyx'; | ||
| import _ from 'underscore'; | ||
|
|
@@ -22,6 +22,8 @@ import reportPropTypes from '../../reportPropTypes'; | |
| import personalDetailsPropType from '../../personalDetailsPropType'; | ||
| import * as FileUtils from '../../../libs/fileDownload/FileUtils'; | ||
| import * as Policy from '../../../libs/actions/Policy'; | ||
| import useWindowDimensions from '../../../hooks/useWindowDimensions'; | ||
| import * as StyleUtils from '../../../styles/StyleUtils'; | ||
| import {iouPropTypes, iouDefaultProps} from '../propTypes'; | ||
|
|
||
| const propTypes = { | ||
|
|
@@ -56,6 +58,7 @@ const defaultProps = { | |
| }; | ||
|
|
||
| function MoneyRequestConfirmPage(props) { | ||
| const {windowHeight} = useWindowDimensions(); | ||
| const prevMoneyRequestId = useRef(props.iou.id); | ||
| const iouType = useRef(lodashGet(props.route, 'params.iouType', '')); | ||
| const reportID = useRef(lodashGet(props.route, 'params.reportID', '')); | ||
|
|
@@ -223,38 +226,51 @@ function MoneyRequestConfirmPage(props) { | |
| title={props.translate('iou.cash')} | ||
| onBackButtonPress={navigateBack} | ||
| /> | ||
| <MoneyRequestConfirmationList | ||
| hasMultipleParticipants={iouType.current === CONST.IOU.MONEY_REQUEST_TYPE.SPLIT} | ||
| selectedParticipants={participants} | ||
| iouAmount={props.iou.amount} | ||
| iouComment={props.iou.comment} | ||
| iouCurrencyCode={props.iou.currency} | ||
| onConfirm={createTransaction} | ||
| onSendMoney={sendMoney} | ||
| onSelectParticipant={(option) => { | ||
| const newParticipants = _.map(props.iou.participants, (participant) => { | ||
| if (participant.accountID === option.accountID) { | ||
| return {...participant, selected: !participant.selected}; | ||
| } | ||
| return participant; | ||
| }); | ||
| IOU.setMoneyRequestParticipants(newParticipants); | ||
| }} | ||
| receiptPath={props.iou.receiptPath} | ||
| receiptSource={props.iou.receiptSource} | ||
| iouType={iouType.current} | ||
| reportID={reportID.current} | ||
| // The participants can only be modified when the action is initiated from directly within a group chat and not the floating-action-button. | ||
| // This is because when there is a group of people, say they are on a trip, and you have some shared expenses with some of the people, | ||
| // but not all of them (maybe someone skipped out on dinner). Then it's nice to be able to select/deselect people from the group chat bill | ||
| // split rather than forcing the user to create a new group, just for that expense. The reportID is empty, when the action was initiated from | ||
| // the floating-action-button (since it is something that exists outside the context of a report). | ||
| canModifyParticipants={!_.isEmpty(reportID.current)} | ||
| policyID={props.report.policyID} | ||
| bankAccountRoute={ReportUtils.getBankAccountRoute(props.report)} | ||
| iouMerchant={props.iou.merchant} | ||
| iouCreated={props.iou.created} | ||
| /> | ||
| {/* | ||
| * The MoneyRequestConfirmationList 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 MoneyRequestConfirmationList component with a horizontal ScrollView. | ||
| */} | ||
| <ScrollView> | ||
| <ScrollView | ||
| horizontal | ||
| contentContainerStyle={[styles.flex1, styles.flexColumn]} | ||
| > | ||
|
Comment on lines
+229
to
+238
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see the problem or the need for the double ScrollView. The VirtualizedList does not seem to be directly nested. Can you please double checked whether this is needed?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @s77rt It is needed because
Running the app on iOS/Android will throw a runtime error and may also break up some functionality as seen in this video: mobile.mp4
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see you are testing with a vertical ScrollView. What I meant is to use one horizontal ScrollView. Can we use that?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My bad here. We need a vertical scrollview. Thanks for your quick responses!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, we can't. The
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No problem! Sorry for the delay, I was out of town over the weekend and just got home. I would have replied sooner if I could, sorry again! |
||
| <MoneyRequestConfirmationList | ||
| hasMultipleParticipants={iouType.current === CONST.IOU.MONEY_REQUEST_TYPE.SPLIT} | ||
| selectedParticipants={participants} | ||
| iouAmount={props.iou.amount} | ||
| iouComment={props.iou.comment} | ||
| iouCurrencyCode={props.iou.currency} | ||
| onConfirm={createTransaction} | ||
| onSendMoney={sendMoney} | ||
| onSelectParticipant={(option) => { | ||
| const newParticipants = _.map(props.iou.participants, (participant) => { | ||
| if (participant.accountID === option.accountID) { | ||
| return {...participant, selected: !participant.selected}; | ||
| } | ||
| return participant; | ||
| }); | ||
| IOU.setMoneyRequestParticipants(newParticipants); | ||
| }} | ||
| receiptPath={props.iou.receiptPath} | ||
| receiptSource={props.iou.receiptSource} | ||
| iouType={iouType.current} | ||
| reportID={reportID.current} | ||
| // The participants can only be modified when the action is initiated from directly within a group chat and not the floating-action-button. | ||
| // This is because when there is a group of people, say they are on a trip, and you have some shared expenses with some of the people, | ||
| // but not all of them (maybe someone skipped out on dinner). Then it's nice to be able to select/deselect people from the group chat bill | ||
| // split rather than forcing the user to create a new group, just for that expense. The reportID is empty, when the action was initiated from | ||
| // the floating-action-button (since it is something that exists outside the context of a report). | ||
| canModifyParticipants={!_.isEmpty(reportID.current)} | ||
| policyID={props.report.policyID} | ||
| bankAccountRoute={ReportUtils.getBankAccountRoute(props.report)} | ||
| iouMerchant={props.iou.merchant} | ||
| iouCreated={props.iou.created} | ||
| listStyles={[StyleUtils.getMaximumHeight(windowHeight / 3)]} | ||
| /> | ||
| </ScrollView> | ||
| </ScrollView> | ||
| </View> | ||
| )} | ||
| </ScreenWrapper> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nestedScrollEnabledis true by default on iOSnestedScrollEnabledis false by default on Android, and it was added in API 21 which is exactly the lowest we support right now.nestedScrollEnabledshould have no effect on browsers.Leaving it to true as default here would put both iOS and Android on the same line, and it should have no negative effect in the application for any platform. I've looked over places where this component is used, and couldn't find any new bugs/different behaviors.