React Native — Presenting visual paywalls
To present (show) a paywall view call view.present()
method. You can use view
from the previous step, we will introduce a new one:
import {createPaywallView} from '@adapty/react-native-ui';
const view = await createPaywallView(paywall);
view.registerEventHandlers(); // handle close press, etc
try {
await view.present();
} catch (error) {
// handle the error
}
Android view behavior
Note, that pressing back button on Android device, while a paywall view is visible, results in app hiding. That is a known behavior, and we currently suggest you to manually control back button the way you like using React Native BackHandler.
Dismissing a paywall view
You can dismiss (hide) a paywall view in 2 ways: either call a view.dismiss
method or return true
from any event handler.
try {
await view.dismiss();
} catch (error) {
// handle the error
}
Updated about 2 months ago