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

Fix console error when paying invoice as business #47488

Merged
Changes from all 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
7 changes: 5 additions & 2 deletions src/components/PopoverMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import lodashIsEqual from 'lodash/isEqual';
import type {RefObject} from 'react';
import React, {useEffect, useState} from 'react';
import React, {useLayoutEffect, useState} from 'react';
import {StyleSheet, View} from 'react-native';
import type {ModalProps} from 'react-native-modal';
import useArrowKeyFocusManager from '@hooks/useArrowKeyFocusManager';
Expand Down Expand Up @@ -194,7 +194,10 @@ function PopoverMenu({
setFocusedIndex(-1);
};

useEffect(() => {
// When the menu items are changed, we want to reset the sub-menu to make sure
// we are not accessing the wrong sub-menu parent or possibly undefined when rendering the back button.
// We use useLayoutEffect so the reset happens before the repaint
useLayoutEffect(() => {
if (menuItems.length === 0) {
return;
}
Expand Down
Loading