Skip to content
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

[CP Staging] Fix bug with Payment option reverts back to 'Pay with Expensify' #36115

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/SettlementButton.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sortBy from 'lodash/sortBy';
import React, {useEffect, useMemo} from 'react';
import type {GestureResponderEvent, StyleProp, ViewStyle} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
Expand Down Expand Up @@ -182,7 +183,7 @@ function SettlementButton({

// Put the preferred payment method to the front of the array, so it's shown as default
if (paymentMethod) {
return buttonOptions.sort((method) => (method.value === paymentMethod ? 0 : 1));
return sortBy(buttonOptions, (method) => (method.value === paymentMethod ? 0 : 1));
Julesssss marked this conversation as resolved.
Show resolved Hide resolved
}
return buttonOptions;
// We don't want to reorder the options when the preferred payment method changes while the button is still visible
Expand Down
Loading