Skip to content

Commit

Permalink
Merge pull request #47488 from bernhardoj/fix/47187-pay-invoice-as-bu…
Browse files Browse the repository at this point in the history
…siness-show-console-error
  • Loading branch information
francoisl authored Aug 15, 2024
2 parents a07cce4 + 01a1ed3 commit 5b83a4b
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit 5b83a4b

Please sign in to comment.