File tree 2 files changed +7
-3
lines changed
react-native-purchases-ui/android/src/main/java/com/revenuecat/purchases/react/ui
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,12 @@ internal class PaywallViewManager : BasePaywallViewManager<PaywallView>() {
18
18
}
19
19
20
20
override fun createViewInstance (themedReactContext : ThemedReactContext ): PaywallView {
21
- return PaywallView (themedReactContext).also { view ->
22
- view.setPaywallListener(createPaywallListenerWrapper(themedReactContext, view))
23
- view.setDismissHandler(getDismissHandler(themedReactContext, view))
21
+ return PaywallView (themedReactContext).apply {
22
+ // Ensure the view is properly initialized before setting listeners
23
+ post {
24
+ setPaywallListener(createPaywallListenerWrapper(themedReactContext, this ))
25
+ setDismissHandler(getDismissHandler(themedReactContext, this ))
26
+ }
24
27
}
25
28
}
26
29
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ internal class RNPaywallsModule(reactContext: ReactApplicationContext) :
26
26
is FragmentActivity -> currentActivity
27
27
else -> {
28
28
Log .e(NAME , " RevenueCat paywalls require application to use a FragmentActivity" )
29
+ promise.reject(" E_ACTIVITY_NOT_FRAGMENT" , " Current activity is not a FragmentActivity" )
29
30
null
30
31
}
31
32
}
You can’t perform that action at this time.
0 commit comments