capacitor-plugin-safe-area icon indicating copy to clipboard operation
capacitor-plugin-safe-area copied to clipboard

question: possible collab

Open tafelnl opened this issue 9 months ago • 3 comments

Nice plugin!

I was in need of a plugin that allowed me to use the edge-to-edge functionality on Android just as we're able to use it on iOS. I ended up writing this plugin: https://github.com/capacitor-community/safe-area

Only then I discovered your plugin. The approach is similar, however still a tad bit different. Some differences:

  • I only cared about detecting the native safe area insets on Android, because on iOS they (should) already work out of the box
  • I'm writing the CSS variables to the browser directly from the native side. So it's not needed to set any listeners on web or whatever to keep them in sync
  • I'm using WindowCompat - which supports older Android versions out of the box - preventing the need of if-else-structures and maintaining deprecated code.
  • I'm listening to safe area changes by using setOnApplyWindowInsetsListener
  • I'm taking into account to IME (keyboard) offsets. TBH, I haven't tested your implementation, but by the quick looks of it, that could be a bug in yours.
  • I'm calculating the insets in a way that's a bit different compared to your strategy. Refer to the code in repository for details on that.
  • I'm providing some utility methods for styling the system bars

I'd like to hear your opinion and experience on these things. Hit me up if you want to. We could also start a collaboration if you want

tafelnl avatar May 03 '24 10:05 tafelnl