Skip to content

Conversation

@insacc
Copy link

@insacc insacc commented Nov 28, 2025

Summary:

-Changes the shadow style span from a CharacterStyle to a ReplacementSpan in order the fix the issue on android where the shadow is cut off even with added padding as the characterStyle doesnt account for the shadow.

This accounts for the shadow but also moves the text back to its original position so on the UI there wouldn't be any shifts when the shadow is applied.

  • Updates the gradient span to make sure that it matches the ios implementation

  • Updates the strokeWidth for the text stroke span to make sure that it matches the ios implementation

Test Plan:

  • Tested locally on android with different states to make sure that it works as expected

@insacc insacc force-pushed the fix/text-shadow-android-cutoff branch from e10841c to 11ead1c Compare December 3, 2025 19:52
Attemp to fix text shadow cutoff

Update the text shadow on android to prevent cutoff

Expand the shadow on if padding is provided

Add the missing import

Add some logging

Make shadow span use padding

Attempt to fix text shadow cutoff on android

Another attempt at fixing the text shadow cutoff

Another attempt at fixing the text shadow cutoff issue on Android.

Add more logging

Add more logs

Add more and more logs

Implement shadow offset compensation in ReactTextView

Make sure to keep the text position stable when the shadow is added.

Update linear gradient span to match iOS behavior.

Address gradient issues

Another attempt to fix the text stroke width

Revert some of the gradient changes

Update shader mode

Update the implementation once more

Revert to width expansion approach - shadow cutoff confirmed without it

Add more logging to the ReactTextView

Remove debug logging

Remove remaining debug logs from text rendering files

Remove unused padding parameters from ShadowStyleSpan

- Remove padding constructor parameters that were never used in getSize() or draw()
- Remove updatePadding() method that was never called
- Remove padding retrieval code from ReactBaseTextShadowNode
- Both old and new architectures now consistently use 4-parameter constructor

Align new arch (Fabric) shadow handling with old arch (Paper)

- Remove shadowTopOffset from PreparedLayoutTextView
- Vertical shadow space is already handled via font metrics adjustment
- Both architectures now only compensate horizontally
- Matches old arch behavior and comment: 'vertical doesn't need compensation'

Remove unused getShadowDy() method and min import

- getShadowDy() was only used for vertical compensation which we removed
- kotlin.math.min import is not used anywhere in the file
@insacc insacc force-pushed the fix/text-shadow-android-cutoff branch from ff956d7 to 9a5ad54 Compare December 5, 2025 22:55
@insacc insacc marked this pull request as ready for review December 5, 2025 22:58
@insacc insacc changed the title Fix/text shadow android cutoff Fix text shadow cutoff on android Dec 5, 2025
@insacc insacc requested a review from Flewp December 5, 2025 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants