adaptyteam / AdaptyUI-React-Native

Extension to the Adapty SDK that allows you to easily add purchase screens to your application
https://adapty.io
MIT License
26 stars 2 forks source link

Error presenting paywall: [Error: #3001 (wrongParam): AdaptyPaywall.viewConfiguration is nil] #15

Open huseyintamer opened 3 weeks ago

huseyintamer commented 3 weeks ago

I’m encountering an issue when trying to use the new paywall builder with the following setup:

Package.json

"@adapty/react-native-ui": "^2.11.0",
"react-native-adapty": "^2.11.0"

Code

import React from 'react';
import {View, Text, StyleSheet, Button} from 'react-native';
import {createPaywallView} from '@adapty/react-native-ui';
import {adapty} from 'react-native-adapty';

const OnboardPaywall = ({route, navigation}) => {
  const presentPaywall = async () => {
    try {
      const locale = 'en';
      const id = 'paywal_general';
      const paywall = await adapty.getPaywall(id, locale);
      const view = await createPaywallView(paywall);
      view.registerEventHandlers(); // handle close press, etc
      await view.present();
    } catch (error) {
      console.log('Error presenting paywall:', error);
    }
  };

  return (
    <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
      <Text>Welcome to the Paywall Screen</Text>
      <Button title="Show Paywall" onPress={presentPaywall} />
    </View>
  );
};`

Issue:

While the old paywall builder works without any issues, the new paywall builder throws an error when attempting to present the paywall.

The error occurs when calling await view.present(); within the presentPaywall function.

 DEBUG  [2024-08-17T14:08:11.741Z] [adapty@2.11.0] "createController": Calling method: OK {"error": [Error: #3001 (wrongParam): AdaptyPaywall.viewConfiguration is nil]}
 ERROR  Error presenting paywall: [Error: #3001 (wrongParam): AdaptyPaywall.viewConfiguration is nil]

Steps to Reproduce:

1.  Implement the provided code snippet in a React Native project.
2.  Use the new paywall builder by calling the createPaywallView method.
3.  Attempt to present the paywall using await view.present();.
li4e commented 3 weeks ago

Same problem

li4e commented 3 weeks ago

I figured out the issue. According to the documentation, the new Paywall Builder 3.0 is only supported by the new Adapty, AdaptyUI SDK versions 3.0.1. However, React Native Adapty uses the older versions. It seems we’ll have to wait for an update.

li4e commented 3 weeks ago

@huseyintamer, as a workaround, you can try using the legacy 2.0 paywall builder. It worked for me.

huseyintamer commented 3 weeks ago

@li4e Yes I already use legacy 2.0 paywall builder, it's worked. So waiting update to use New one. Thanks.

troberts-28 commented 1 week ago

any movement on this?

The docs/site shouldn't be pushing the new Paywall builder if the SDKs haven't been updated to work with it

evlinH commented 1 week ago

I contacted support on this issue. They told me to expect the release of the new SDK in September.

troberts-28 commented 1 week ago

I also spoke to support about this and got an additional steer that it will be in late September 👍