Skip to content

Commit

Permalink
Add comments to clarify indexOffset logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Barun Pandey committed Mar 17, 2021
1 parent fb34951 commit f085f11
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class IOUParticipantsRequest extends Component {
title: 'CONTACTS',
data: this.state.personalDetails,
shouldShow: this.state.personalDetails.length > 0,
indexOffset: sections.reduce((prev, {data}) => prev + data.length, 0),
indexOffset: 0,
});

if (this.state.userToInvite) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,19 @@ class IOUParticipantsSplit extends Component {
title: 'RECENTS',
data: this.state.recentReports,
shouldShow: this.state.recentReports.length > 0,

// takes the sum off the length of all data
// (this.state.selectedOptions) in previous sections
indexOffset: sections.reduce((prev, {data}) => prev + data.length, 0),
});

sections.push({
title: 'CONTACTS',
data: this.state.personalDetails,
shouldShow: this.state.personalDetails.length > 0,

// takes the sum off the length of all data
// (this.state.selectedOptions, this.state.recentReports) in previous sections
indexOffset: sections.reduce((prev, {data}) => prev + data.length, 0),
});

Expand Down
1 change: 0 additions & 1 deletion src/pages/iou/steps/IOUParticipantsPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const defaultProps = {
};

const IOUParticipantsPage = (props) => {
console.debug(props.participants);
if (props.iou.loading) {
return (
<View style={styles.pageWrapper}>
Expand Down

0 comments on commit f085f11

Please sign in to comment.