BUG | useScreenSafeArea
| Safe area values not reactive on initial load
#4783
Labels
useScreenSafeArea
| Safe area values not reactive on initial load
#4783
Describe the bug
When using
useScreenSafeArea
anduseCssVar
together as shown below:only the direct CSS variables are set or updated during the initial load of a native iOS PWA running inside a
WebView
. The VueUse reactive values remain empty or zero until a resize or orientation event occurs.Observed output:
The current event listeners (e.g.,
resize
) used inuseScreenSafeArea
vueuse/packages/core/useScreenSafeArea/index.ts
Line 35 in 04933c9
are likely insufficient to detect safe area inset changes during
WebView
initialization or the initial load on iOS. As a result, the reactive values do not update until a subsequent event, such as an orientation change, triggers an update.Reproduction
https://playground.vueuse.org/#eNp9VMFy2jAQ/ZUdXezM2HBoTwwwTTM5pIe2U9JeEAfXXsCJLHkkGZjx+N+zksAhYHKTd/e9ffu0csvu63q0a5BN2NTkuqwtGLRNDSKTmxln1nA257KsaqUttLDPbL6FDtZaVRARMDpLNgYXuUaUi2yN9xqzxIUejPmX6R7zjUAUHedKOzCXuZLGoa2qJ0DJv8RyxD+rmnCza+L47oQzx8iTJN1Uv7C6lJuACZ3jKE1Dz9QVpxlVp9QsSkA2QiTUWv03qHc4AasbhI7IufSTxlwCLOM7mM2vpY12mWgwgZAeFhJqVonjiZcS95cGUSjIXCWwVKK4zFPomPddWkcE4GZXAkdCbeJo6aWuBrzLt3SLWExo1AHqKJ07Dy410fQ3W9xw+2OfoPeMPwQ8b+edaKGsKizKzPaec0n56TjsIG0cfVisakEl9AUwLcqdP3w4wvXQE2jboTWiDh48vkE0PJpnuzH1NeXpNB332llCb4i8XJeb0YtRkh6av0POclXVpUD9q7Ylec0Z9QqEnGVCqP0PH3P2eNM8Zov560D8xRxcjLPfGv0qc9bnbKY3aEP6cfETD3Tuk5UqGkHVnyT/IO1B4zSGsu+NLEj2WZ1X++T/AuTLs3k8WJTmNJQT+n71nNHdPHwy+rvcL6OvHsdlx7o3V8mUzQ==
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: