|
| 1 | +# Overlay Closing Portal Notes |
| 2 | + |
| 3 | +Status: `WIP / parked for now` |
| 4 | +Date: `2026-03-04` |
| 5 | + |
| 6 | +## Goal |
| 7 | + |
| 8 | +During message overlay close animations, keep selected UI (for example message input, header) visually above the animating message by teleporting those views into overlay-hosted slots. |
| 9 | + |
| 10 | +## What We Agreed |
| 11 | + |
| 12 | +1. The overall idea is valid and should be kept. |
| 13 | +2. Current implementation is too unstable/perf-heavy on Android and is parked for now. |
| 14 | +3. The long-term direction is: |
| 15 | + - keep less state in JS, |
| 16 | + - keep more geometry/animation state on the UI thread (Reanimated shared values), |
| 17 | + - keep JS coordination minimal. |
| 18 | + |
| 19 | +## Current Constraints |
| 20 | + |
| 21 | +1. Avoid frequent `measureInWindow` calls during close animation on Android (perf issues). |
| 22 | +2. If measuring is needed, prefer one-time measurement with explicit invalidation points. |
| 23 | +3. `onLayout` local coordinates (`x/y`) are not sufficient for absolute overlay placement. |
| 24 | +4. Safe-area handling differs on Android and must be normalized consistently with overlay coordinate space. |
| 25 | + |
| 26 | +## Known Problems Encountered |
| 27 | + |
| 28 | +1. Registration/render timing issues when portals/hosts switch during close. |
| 29 | +2. Coordinate-space mismatch (`onLayout` local coords vs absolute screen placement). |
| 30 | +3. Android jank when repeatedly measuring/updating layout in JS during animation. |
| 31 | + |
| 32 | +## Implementation Direction (Next Iteration) |
| 33 | + |
| 34 | +1. Keep JS as registration/metadata layer only. |
| 35 | +2. Move live layout + transition math to UI thread shared values. |
| 36 | +3. Use stable, persistent portal hosts where possible; avoid mount/unmount races at close time. |
| 37 | +4. Add a lightweight debug mode to visualize slot rectangles and host resolution. |
| 38 | + |
| 39 | +## Explicitly Parked |
| 40 | + |
| 41 | +The current Android behavior for generalized closing portal teleports is not production-ready and is intentionally not being shipped as-is. |
| 42 | + |
| 43 | +## Session Handoff |
| 44 | + |
| 45 | +When resuming, reference this file and continue from the “Implementation Direction (Next Iteration)” section. |
0 commit comments