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

revenue-cat-purchases-ui not linked in expo project #976

Closed eipark closed 2 months ago

eipark commented 2 months ago

Describe the bug A clear and concise description of what the bug is. The more detail you can provide the faster our team will be able to triage and resolve the issue. Do not remove any of the steps from the template below. If a step is not applicable to your issue, please leave that step empty.

  1. Environment
    1. Platform: iOS/Expo
    2. SDK version: react-native-purchases and react-native-purchases-ui both on 7.26.2
    3. OS version: ios 17+
    4. Xcode/Android Studio version:
    5. React Native version: 0.73.6
    6. SDK installation (CocoaPods + version or manual): Expo
    7. How widespread is the issue. Percentage of devices affected. all
  2. Debug logs that reproduce the issue
    
    ERROR  Error: The package 'react-native-purchases-ui' doesn't seem to be linked. Make sure:
  1. Steps to reproduce, with a description of expected vs. actual behavior

react-native-purchases-ui is not getting properly imported in my project.

  1. Added react-native-purchases and react-native-purchases-ui to package.json
  2. npx expo install. Properly installs
  3. Create revenueCat.ts:
    
    import RevenueCatUI, { PAYWALL_RESULT } from 'react-native-purchases-ui';

const presentPaywall = async (offering?: String): Promise => { // Present paywall logic here let paywallResult: PAYWALL_RESULT; if (offering) { paywallResult = await RevenueCatUI.presentPaywall({ offering }); } else { paywallResult = await RevenueCatUI.presentPaywall(); }

console.log('Paywall result: ', paywallResult);

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; } };

export { presentPaywall };

4. Run project (tried several methods including `npx expo run:ios`, removing `ios` directory, doing a clean build, etc)
5. Error output:

ERROR Error: The package 'react-native-purchases-ui' doesn't seem to be linked. Make sure:

If I remove the import to my revenueCat.ts file, the error goes away. I am not using Expo go.

  1. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

Additional context Add any other context about the problem here.

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!

eipark commented 2 months ago

I thought maybe it was the same as https://github.com/RevenueCat/react-native-purchases/issues/857, but that one was resolved by 7.18.0. I tried testing on just that version, thinking maybe it regressed by 7.26.2 but issue remains.

eipark commented 2 months ago

Apologies, please ignore. I had a bug in my build that was making it seem like things were re-compiling but it wasn't.

andruxnet commented 2 months ago

@eipark I'm seeing the same error, tried npx expo run:ios, removing ios directory, clean build, still see the error.. can you share what you did to get this solved?

andruxnet commented 2 months ago

actually nevermind... I guess I needed to do a new dev build with eas build --profile development --platform ios once more to get it working..