-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android crash when unmounting PaywallFooterContainerView: java.lang.IllegalStateException: No ViewModelStoreOwner was provided via LocalViewModelStoreOwner #994
Comments
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out! |
Hey @carter-0 ! Thanks for reaching out, this error usually happens when LocalViewModelStoreOwner.current is set to null. Can you please verify that this doesn't get set to null, it could be because of something like a rerender being triggered by your code. This could be the result of something in your switch case causing an issue or the state not being re-rendered properly. Let me know if that helps! |
@michaelAtRC Thanks for the response but I can't figure out how to check this. Is LocalViewModelStoreOwner not a Kotlin native component handled by react-native-purchases-ui? or is there a way to access this from react native? Sorry for the ignorance, I'm pretty new to react native & app development😅 |
I'm experiencing this crash as well. Dismissing the paywall footer on Android causes the app to crash every time |
For what it's worth, I'm not using any custom UI with my footer. I'm simply displaying it inside a BottomSheet. @carter-0 I was able to stop this crash from happening by commenting out this line: Line 24 in 3299266
This is fine for my use-case because my view isn't ever updating since I'm not using custom UI with my footer, which is the purpose of that call. The crash is 100% happening somewhere inside the I think I'll just have to patch the library to comment that line to get my app working properly. |
Thanks @Watersdr, I can confirm commenting that line out also fixes the crash for me, even with custom ui in the footer. I haven't noticed any other effects so far so I'm also going to patch the lib as a temporary fix. |
Hey There, Glad to see that this was fixed and things are now working as planned. On a side note, we have updated the SDK which has had more bug improvements since this, so I recommend updating to the latest version to ensure you have all the fixes that we have put out since this. |
Hey There, I switched to 7.28.1, the issue still persists, I had to change the paywallfootermanager.kt to fix the crash, is it fixed in version 8.0? Because it is a breaking change I don't want to switch for now. |
The issue persist on 8.2.0 as well. |
Still same + |
Issue is still present in 8.2.1. Patching the PaywallFooterViewManager.kt (as described in #994 (comment)) does fix the crash. So far haven't noticed any side-effects for my use case, however I am pretty sure that in some cases this is not a good way to fix this. |
Hey there the issue still persist, any official fix planning for this? |
@michaelAtRC Hi Michael, |
Are there any updates on this? |
Is there any update about this issue @michaelAtRC ? |
Could someone with knowledge about this codebase check out this issue? @vegaro @michaelAtRC @aboedo Seems like the code that is causing this issue was added as a workaround as well facebook/react-native#17968 (comment) |
Still the same for me as well, I applied patch on the library and when I mount it to the navigator , I mount it cleaning the stack so it draws correctly before display, but as I use user prop based discounts after entering a discount code, if the paywall footer refreshes himself after that, the layout still gets out of order. It constantly persists even with the newest sdk release. |
It's really so interesting no one care this issue. |
Sorry about the management of this issue. We are taking a look. |
Hi everyone, same here, sorry for missing this issue. We were able to reproduce and find the cause of the issue. We have a fix in #1120 which should go out on the next release. Again sorry and thanks for reporting this issue!! |
This fixes #994 Basically when the footer is dismissed within the same view, it triggers a new layout, which since we call a remeasurement with a `post` call, this remeasurement may happen after the view has been removed from the window. This view requires access to the context to be able to obtain the `ViewModel` in the underlying composable, causing a crash.
Describe the bug
When unmounting the RevenueCatUI.PaywallFooterContainerView on Android devices,
java.lang.IllegalStateException: No ViewModelStoreOwner was provided via LocalViewModelStoreOwner
is thrown.Expected behaviour: Paywall footer will be shown and then hidden without any issues
Actual behaviour: Paywall footer is shown succesfully but crashes when unmounted.
Here is a video demonstration of the expected behaviour (on iOS) vs the actual behaviour (on Android) with the exact same code:
8mb.video-7Gv-j6y8b5cE.mp4
The text was updated successfully, but these errors were encountered: