fix(iOS): proper layout calculation#339
Conversation
|
Hey @IvanIhnatsiuk the changes look promising but we need to make sure absolutely no regressions are introduced. We cannot proceed with the PR no matter how big the performance gains if any of these re-emerge. If it comes to the measuring part, I'll check it on my end. |
|
@szydlovsky Sure and it's obviously clear to me 😄 . I will test all of these scenarios and comeback with update 🙂 |
Screen.Recording.2025-12-18.at.17.57.54.mov
Screen.Recording.2025-12-18.at.18.01.27.mov |
|
@IvanIhnatsiuk okay, we anyway want to test it out really thoroughly. Might be as late as at the beginning of the new year so we'll need some patience here 🙏 |
f72acb5 to
4caf62b
Compare
80a7eca to
f2537b2
Compare
|
@exploIF kind reminder 🙂 |
ed2300e to
6e00a9e
Compare
7764fdc to
a046e54
Compare
|
I've noticed one strange behavior (not something crucial but would be good to verify what's happening):
Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-01-13.at.14.46.46.mov |
a97d254 to
a4fb053
Compare
@exploIF fixed |
kacperzolkiewski
left a comment
There was a problem hiding this comment.
Input scroll works well 👏
Reverts #339 due to a iOS layout bug we found; The input sometimes becomes unscrollable when it's inside a scrollable bottom sheet (`@gorhom/bottom-sheet`), with a `KeyboardAwareScrollView` (`react-native-keyboard-controller`) turned into a proper bottom-sheet-scrollview component. The bug doesn't appear when testing a commit before the PR, but does happen on the exact merge commit of the said PR.
Summary
This PR simplifies and significantly optimizes text measurement + corrects textKit measurements.
Closes #332
Problems:
All these problems were because we used the
setContentViewmethod, which is not a UIKit method(it was a RN method) that required proper children caculation. However, in our scenario, we just need to know the current content size, and UIKit can calculate the UIScrollView bounds and text content automatically.Why did it happen?
InputTextView Content Size Measurement Issue
Problem Description
The issue was related to our
InputTextView.InputTextViewalways had zero bounds ({0,0}) during layout, which meant that TextKit did not know the actual size of the text container. As a result, TextKit attempted to measurecontentSizeusing an invalid (zero-width) container, which led to incorrect text measurement and layout behavior.This behavior can be verified by placing a breakpoint in the method responsible for computing
contentSizeinsideInputTextView: at that moment, TextKit had no knowledge of the real container size.Root Cause
updateLayoutMetricsdid not properly apply geometry toInputTextViewframe/boundsremained zerotextContainer.sizedid not reflect the actual width of the componentBecause of this,
contentSizewas calculated incorrectly, which caused issues such as:Benchmarks
for the text content like:
Test Plan
Provide clear steps so another contributor can reproduce the behavior or verify the feature works.
For example:
Screenshots / Videos
Initial layout + scrolling
Screen.Recording.2025-12-21.at.18.40.18.mov
Long single paragraph
Screen.Recording.2025-12-21.at.18.45.17.mov
New line insertion:
Please watch these videos at 0.25x speed.
Before
Screen.Recording.2025-12-21.at.18.48.49.mov
After
Screen.Recording.2025-12-21.at.18.46.10.mov
Content size layout measurement (Before)
Uploading Screen Recording 2025-12-21 at 18.55.16.mov…
Error that content size is ambiguous
Compatibility