Discussions
RN Android adapty activation
almost 2 years ago by Oleg Novak
Good day, good sirs!
I am trying to activate adapty – react-native - android.
Behaviour description:
- If i try to activate adapty and get a paywall in useEffect in app.js, i get
AdaptyError {
"adaptyCode": "sdkNotActive",
"code": 403,
"localizedDescription": "Adapty SDK was not initialized",
}
Code Example:
useEffect(() => {
activateAdapty({sdkKey: 'public_live_1xBxwiDq.Hcf8j157rGUd1OtGw9Gv'});
async function fetchPaywall() {
const {paywalls} = await adapty.paywalls.getPaywalls();
const bestPaywall = paywalls.find(
paywall => paywall.developerId === 'testPayWall',
);
setPaywall(bestPaywall);
console.log(bestPaywall);
}
fetchPaywall();
}, []);
2.But if I use it without useEffect, it kinda works – adapty activates and i can see that i am receiving a paywall, but i have infinite rerenders.
Would you please be so kind to help me out in this weird scenario?