AlwaysLoveme / capacitor-plugin-safe-area

capacitor plugin to get safeArea info on Android and IOS, support Capacitor6
MIT License
60 stars 14 forks source link

safe area not working on horizontal mode in IOS #32

Open yashoda-esb opened 1 month ago

yashoda-esb commented 1 month ago

Here is the code:


        await SafeArea.addListener('safeAreaChanged', (data:any) => {
            const { insets } = data;
            for (const [key, value] of Object.entries(insets)) {
                document.documentElement.style.setProperty(
                    `--safe-area-inset-${key}`,
                    `${value}px`,
                );
            }
        });
AlwaysLoveme commented 1 month ago

SafeArea.addListener

What model is your device?

yashoda-esb commented 1 month ago

SafeArea.addListener

What model is your device?

I've tested on an iPhone 15 Pro Max and an iPhone 12. In horizontal mode, the top value is always 0, while in vertical mode, the top value adjusts correctly based on the status bar. However, in horizontal mode, the values for top, left, right, and bottom are not accurate. Additionally, when changing orientation from vertical to horizontal, a black section appears at the top of the screen, and the status bar is not visible in horizontal mode on both devices. Here is an image showing the issue. on Android its working fine .

black-section-on-top-statusbar