RevenueCat / react-native-purchases

React Native in-app purchases and subscriptions made easy. Support for iOS and Android.
https://www.revenuecat.com
MIT License
691 stars 77 forks source link

Android: close button is missing on paywall #979

Closed khlling closed 2 months ago

khlling commented 2 months ago

Describe the bug The paywall does not display the close button in Android but does in iOS. From diving into the code this should be default to true.

PRESENT_PAYWALL_DISPLAY_CLOSE_BUTTON: true

Even passing in displayCloseButton to the presentPaywall/presentPaywallIfNeeded doesn't enable the close button

/**
 * Open paywall
 * @returns result: boolean - result of paywall
 */
export async function presentPaywall(): Promise<boolean> {
  // Present paywall for current offering:
  const paywallResult: PAYWALL_RESULT = await RevenueCatUI.presentPaywall({displayCloseButton: true});
  const customerInfo = await Purchases.getCustomerInfo();

  switch (paywallResult) {
    case PAYWALL_RESULT.NOT_PRESENTED:
    case PAYWALL_RESULT.ERROR:
    case PAYWALL_RESULT.CANCELLED:
      return false;
    case PAYWALL_RESULT.PURCHASED:
      return true;
    case PAYWALL_RESULT.RESTORED:
      return true;
    default:
      return false;
  }
}

/**
 * Open paywall if not entitlement is detected
 * @returns result: boolean - result of paywall
 */
export async function presentPaywallIfNeeded(displayCloseButton = true) {
  // Present paywall for current offering:
  const paywallResult: PAYWALL_RESULT =
    await RevenueCatUI.presentPaywallIfNeeded({
      requiredEntitlementIdentifier: '...'
      displayCloseButton
    });

  switch (paywallResult) {
    case PAYWALL_RESULT.NOT_PRESENTED:
    case PAYWALL_RESULT.ERROR:
    case PAYWALL_RESULT.CANCELLED:
      return false;
    case PAYWALL_RESULT.PURCHASED:
    case PAYWALL_RESULT.RESTORED:
      return true;
    default:
      return false;
  }
}

I found the following on the Revenuecat community pages: https://community.revenuecat.com/general-questions-7/close-button-is-not-visible-on-android-4127

I've tried with alternative images that aren't black. However, no close button displays in Android

  1. Environment

    1. Platform: Android

    2. SDK version:

      "react-native-purchases": "^7.26.2", "react-native-purchases-ui": "^7.26.2",

    3. OS version: Mac OS

    4. React Native version: 0.69.10

Additional context Android:

Screenshot_1713817441

iOS: Simulator Screenshot - iPhone 13 - 2024-04-22 at 21 37 17 #2

RCGitBot commented 2 months ago

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

khlling commented 2 months ago

Oh, weirdly the close button has appeared to me now on Android. But in the top left in black.

Screenshot_1713860124

Hoping that we can change the color of this button in the future

vegaro commented 2 months ago

@khlling we have received the close button color feedback multiple times and already working on it. Not sure when it will arrive to React Native, but we are already working on adding the functionality to customize it to the dashboard.

The close button is in your first screenshot as well, but with very little contrast, which makes it almost impossible to see

Screenshot 2024-04-23 at 15 24 48
khlling commented 2 months ago

@vegaro thanks for the follow-up. I must have missed it! - I was expecting it to be on the right-hand side like in iOS. Configuring it via the dashboard works just fine in my use case. I've used a different picture for now :)