planetary-social / nos

nos.social social media for all of us, using nostr
https://nos.social
Mozilla Public License 2.0
122 stars 14 forks source link

[Bug] Strange behavior in Image Viewer after rotating #1440

Open joshuatbrown opened 2 months ago

joshuatbrown commented 2 months ago

When rotating the device from landscape to portrait and back, there's a gap at the bottom of the image. Steps to reproduce:

  1. Navigate to Settings
  2. Toggle Enable new media display to "On"
  3. Put the device in landscape orientation
  4. Find a post with an image (any kind, including GIF)
  5. Tap to view the image in the full-screen image viewer. (If it's a GIF, you'll have to tap to play the animation, then tap again to get the image viewer.)
  6. Observe the bottom of the image -- it's lined up with the bottom of the screen.
  7. Rotate the device to portrait
  8. Rotate the device to landscape
  9. Observe the bottom of the image -- there's a gap (black bar) between the bottom of the image and the bottom of the screen.

Expected: the image should fill the screen even after rotating the device.

Actual: there's a small gap (black bar) below the image.

Additionally, if you zoom out while in landscape and then rotate back to portrait, there's a gap on the side of the image, so it's not centered in the frame.

simulator_screenshot_D2B917D8-C841-4752-A6B2-B20D7439CEDC

This was first discovered by Matt and documented in a PR comment:

https://github.com/user-attachments/assets/715fd4cd-68db-4cac-b676-99aab06034f5

https://github.com/user-attachments/assets/b80e2b45-fc64-4c0c-bc46-261bf313f6b0

Originally posted by @mplorentz in https://github.com/planetary-social/nos/pull/1437#pullrequestreview-2269106241

joshuatbrown commented 2 months ago

Technical notes

Is the frame of the scroll view changing? Not according to my debugging. On both the first view in landscape and then when it's back in landscape, the scroll view frame is the same size.

Is the scroll view content inset changing? Nope.

Is the scroll view content offset changing? Nope.

Is the scroll view content size changing? Nope.

Further research is needed.