Text TSpan dy behaves differently on Android and iOS
See original GitHub issueNotice the relative size difference between the text and the <Rect/>
on iOS and Android:
import React from 'react';
import { View } from 'react-native';
import Svg, { Rect, Text, TSpan } from "react-native-svg";
export default class App extends React.Component {
render() {
return (
<View>
<Svg
height="160"
width="200"
>
<Rect fill="blue" x="0" y="25" width="5" height="42" />
<Text y="20" dx="5 5">
<TSpan x="10" >tspan line 1</TSpan>
<TSpan x="10" dy="15">tspan line 2</TSpan>
<TSpan x="10" dx="10" dy="15">tspan line 3</TSpan>
</Text>
</Svg>
</View>
);
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:48
Top Results From Across the Web
Text TSpan dy behaves differently on Android and iOS #377
It is now possible to make it render similar output in both chrome and react-native in android, but native sometimes needs different font-size,...
Read more ><tspan> - SVG: Scalable Vector Graphics - MDN Web Docs
The SVG <tspan> element defines a subtext within a <text> element ... dy. Shifts the text position vertically from a previous text element....
Read more >Duplication of SVG text-paths on iOS/Safari - Stack Overflow
Here the text is duplicated below the paths. See the image below for what I mean by "duplicated". Any idea on why Safari...
Read more >Exporting Diagram with custom Shape shows text outside the ...
When exporting Diagram with a custom shape in iOS (iPad v.15) the text inside that custom shape is not placed inside the shape....
Read more >Safari Technology Preview Release Notes - Apple Developer
Many of the new Safari 16 features are now available in Safari Technology Preview 147: Live Text. Select and interact with text in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@chrisbolin I have letter-spacing and kerning implemented now as well (even chrome doesn’t support the kerning attribute in svg yet). I’ve removed all magical constant and other strange things.
It is now possible to make it render similar output in both chrome and react-native in android, but native sometimes needs different font-size, letter-spacing, and start-offset values, seemingly depending on the length of the path referenced in the href attribute of the textpath element.
Except for that, it now seems at least possible to get essentially pixel perfect results for text, tspan and textpath, merely requiring scaling of some values for the native rendering.
@chrisbolin @gpeal @OzoTek There is now a new version and pull request, with some of the fixes from android ported to ios: https://github.com/react-native-community/react-native-svg/pull/430