'React navigation- Opening Modal when we presses tab bar

When I pressed a tab bar it will open a modal and if we close that modal and again presses on same tab.Nothing will happen.I expected that the modal should be visible again but it is not.

<Tab.Screen
      name="Order"
      component={OrderPage}
      options={{headerShown: false}}
      listeners={props => ({
        tabPress: e => {
          if (shoppingCart.cartItems.length === 0) {
            e.preventDefault();
            if (!isInOrder) {
              isUserLoggedIn
                ? toggleModal()
                : props.navigation.navigate('AuthStack');
            }
          }
        },
      })}
    />


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source