react-native
react-native copied to clipboard
fix (iOS): Center aligning inline images in texts #41231
Summary:
Inline is on the critical path of rich text, for example, (a center aligned lozenge as shown bellow)
, where alignment is at its essence. This PR is to provide a by default centered inline and to foster smoother developer experience (a bit).
Problem
On Android, inline images are aligned with center of the text which is good, while on iOS, they are aligned by line bottom.
On the consumer side, this discrepancy causes extra platform specific code to further layout of inline graphics (and custom views) in rich text field, which is fixed in this PR.
Changelog:
[IOS] [FIXED] - Mis-aligned inline images in texts across platforms
Test Plan:
- adding an image in the middle of a paragraph 1.2. placing the image to the beginning of the paragraph 1.3. placing the image to the paragraph end 1.4. changing image sizes 1.5. changing image padding and margin
- adding a view in paragraph 2.2. changing view sizes 2.3. changing view padding and margin
- changing font sizes
- changing text padding and margin
- changing text lineHeight
- changing textAlign
Test result: (Please feel free suggest more test cases) https://docs.google.com/spreadsheets/d/11fgvvw-yQqtJ-jtFPfY-yC5TD51FjoxwUj1lLXjx7Vc/edit?usp=sharing
| Platform | Engine | Arch | Size (bytes) | Diff |
|---|---|---|---|---|
| android | hermes | arm64-v8a | 17,657,534 | +1 |
| android | hermes | armeabi-v7a | n/a | -- |
| android | hermes | x86 | n/a | -- |
| android | hermes | x86_64 | n/a | -- |
| android | jsc | arm64-v8a | 21,039,206 | -9 |
| android | jsc | armeabi-v7a | n/a | -- |
| android | jsc | x86 | n/a | -- |
| android | jsc | x86_64 | n/a | -- |
Base commit: 118e651bc28d089f72e2ea3696ca711f21d7ada6 Branch: main
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This PR was closed because it has been stalled for 7 days with no activity.
@ehsemloh could you share a reproduceable gist ?