Files
farfromrefuge 7e9be32e28 fix(android): prevent error while opening modal from background (#10570)
It is a known android "issue" that you cant commit/show a fragment while in background. The reason is, as explained [here](https://medium.com/@113408/avoid-fragment-illegalstateexception-can-not-perform-this-action-after-onsaveinstancestate-ba76ae4f00fe) or [here](https://stackoverflow.com/questions/15729138/on-showing-dialog-i-get-can-not-perform-this-action-after-onsaveinstancestate), that `onSaveInstanceState` is already called so any operation before activity start would be with state loss.
There are 2 solutions in this case:
* use `commitAllowingStateLoss`, `dismissAllowingStateLoss` ... but then you loose state ... This is what we are doing in N in many cases. We can do this with `show` too but we would need to override the `DialogFragment.show` method.
* delay the action until the activity is resumed.

This PR uses the second solution. We could add an option to `showModal` to use the first solution. The user experience is different. Solution 1:  when the app is resumed the modal is already shown and layed out. Solution 2: you see the modal opening on app resume
2024-07-03 12:23:01 -07:00
..
2020-11-11 08:46:36 -08:00
2023-03-23 10:55:38 -07:00
2024-04-07 19:35:01 -07:00
2024-07-02 11:16:11 -07:00
2023-11-25 10:58:41 -08:00

NativeScript

@nativescript/core

A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.

Learn more at docs.nativescript.org