Fix middle-anchoring for lines of multiple TSpans
Summary
Fixes https://github.com/react-native-community/react-native-svg/issues/1205
Not really intended as the final fix for this issue, I only dabble in Java so I'm sure there is probably a better way to do it. Happy to make changes as required :)
Test Plan
Check that lines comprising multiple <TSpan>s are centred correctly as in the 'after' screenshot:
| Before | After |
|---|---|
![]() |
![]() |
What's required for testing (prerequisites)?
Clone the repo here: https://github.com/mjmasn/TSpanIssue Install react-native-svg from git branch / yarn link etc.
What are the steps to reproduce (after prerequisites)?
Run the app before and after installing this patch.
Compatibility
| OS | Implemented |
|---|---|
| iOS | n/a (issue not tested on iOS) |
| Android | ✅ |
Checklist
- [x] I have tested this on a device
- [ ] and a simulator
- [ ] I added the documentation in
README.md - [ ] I mentioned this change in
CHANGELOG.md - [ ] I updated the typed files (TS and Flow)
- [ ] I added a sample use of the API in the example project (
example/App.js)
Hmm, so this doesn't actually work if the spans have different fontSizes. Can't seem to work out how to get the font for each span from getSubtreeTextChunksTotalAdvance of another span.

