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

Fix middle-anchoring for lines of multiple TSpans

Open mjmasn opened this issue 6 years ago • 1 comments

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)

mjmasn avatar Nov 28 '19 22:11 mjmasn

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.

mjmasn avatar Nov 29 '19 10:11 mjmasn