react-native icon indicating copy to clipboard operation
react-native copied to clipboard

fix (iOS): Center aligning inline images in texts #41231

Open ehsemloh opened this issue 2 years ago • 2 comments

Summary:

Inline is on the critical path of rich text, for example, (a center aligned lozenge as shown bellow) Screenshot 2023-10-30 at 22 13 17 , 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.

Screenshot 2023-10-30 at 10 08 04

Changelog:

[IOS] [FIXED] - Mis-aligned inline images in texts across platforms

Test Plan:

  1. 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
  2. adding a view in paragraph 2.2. changing view sizes 2.3. changing view padding and margin
  3. changing font sizes
  4. changing text padding and margin
  5. changing text lineHeight
  6. changing textAlign

Test result: (Please feel free suggest more test cases) https://docs.google.com/spreadsheets/d/11fgvvw-yQqtJ-jtFPfY-yC5TD51FjoxwUj1lLXjx7Vc/edit?usp=sharing

ehsemloh avatar Oct 30 '23 00:10 ehsemloh

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

analysis-bot avatar Oct 30 '23 00:10 analysis-bot

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.

github-actions[bot] avatar Apr 28 '24 05:04 github-actions[bot]

This PR was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar May 05 '24 05:05 github-actions[bot]

@ehsemloh could you share a reproduceable gist ?

Biki-das avatar Jul 01 '24 13:07 Biki-das