Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26814] iOS: safeAreaPadding is all zeros if "extendsSafeArea" is false

GitHub Issuen/a
TypeBug
PriorityMedium
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 8.0.0
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterHans Knöchel
AssigneeUnknown
Created2019-02-09T08:23:14.000+0000
Updated2019-02-19T20:15:43.000+0000

Description

We are currently trying to migrate our manually set safe area values to the SDK 8+ "safeAreaPadding" property. Unfortunately, it does not work if "extendSafeArea" is false. It should also work for normal views like a window inside a tabgroup or navigation-window, since the bottom-spacing is still of high interest to, e.g. for calculating the keyboard bottom height.

Comments

  1. Joshua Quick 2019-02-11

    Regarding "safeAreaPadding", this is not a bug. This is the correct behavior. Padding is only applicable if "extendSafeArea" is set true. If "extendSafeArea" is set false, then the window's root view will auto-size itself within the safe-area. This means no padding is needed. The "safeAreaPadding" returned is relative to the window's root view which is why it returns all zeros in this case. The idea here is a view can blindly apply safe-area padding without having to worry about the state of the "extendSafeArea" property. Now, if you set "extendSafeArea" false and you see views being overlapped by insets, then that sounds like a layout bug. *Is this the issue you are seeing?* Regarding the virtual keyboard, I'm pretty sure iOS does not provide its height as an inset (there is a different native API for this). And this impossible to do on Android since there is no reliable way to fetch the virtual keyboard height on that platform (it's better to use the "adjustSize" or "adjustPan" window settings instead and let the Android OS handle it).
  2. Joshua Quick 2019-02-11

  3. Joshua Quick 2019-02-12

    For the virtual keyboard, you can use Ti.App event "keyboardframechanged"... https://docs.appcelerator.com/platform/latest/#!/api/Titanium.App-event-keyboardframechanged
  4. Joshua Quick 2019-02-19

    [~hknoechel], I just noticed that setting "extendSafeArea" to false on iOS 10 and older versions the top status bar will wrongly overlap the window's content. On iOS 11 and higher, the top status bar does not overlap the window's content. This is definitely a bug, although it's probably not what you're running into.

JSON Source