Skip to content

Commit

Permalink
Merge pull request #46317 from jacobkim9881/44919
Browse files Browse the repository at this point in the history
 fix clicking pay button for invoices raise an null error
  • Loading branch information
Gonals authored Aug 2, 2024
2 parents c72f7a9 + 411cf41 commit 8ebf085
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/ButtonWithDropdownMenu/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type {MutableRefObject} from 'react';
import React, {useEffect, useRef, useState} from 'react';
import {View} from 'react-native';
import Button from '@components/Button';
Expand Down Expand Up @@ -48,6 +49,7 @@ function ButtonWithDropdownMenu<IValueType>({
const selectedItem = options[selectedItemIndex] || options[0];
const innerStyleDropButton = StyleUtils.getDropDownButtonHeight(buttonSize);
const isButtonSizeLarge = buttonSize === CONST.DROPDOWN_BUTTON_SIZE.LARGE;
const nullCheckRef = (ref: MutableRefObject<View | null>) => ref ?? null;

useEffect(() => {
if (!dropdownAnchor.current) {
Expand Down Expand Up @@ -149,7 +151,7 @@ function ButtonWithDropdownMenu<IValueType>({
onModalShow={onOptionsMenuShow}
onItemSelected={() => setIsMenuVisible(false)}
anchorPosition={popoverAnchorPosition}
anchorRef={dropdownAnchor}
anchorRef={nullCheckRef(dropdownAnchor)}
withoutOverlay
anchorAlignment={anchorAlignment}
headerText={menuHeaderText}
Expand Down

0 comments on commit 8ebf085

Please sign in to comment.