React Native字体轮廓/ textShadow [英] React Native font outline / textShadow
问题描述
是否可以在react native中为字体添加轮廓或textShadow来实现这样的效果(带有黑色轮廓的白色字体):
Is it possible to add an outline or textShadow to a font in react native to achieve something like this (white font with a black outline):
在Web上的CSS中,可以在字体中添加文本阴影或轮廓,从而为文本提供边框字体,如下所示:
In CSS on the web its possible to add a text shadow or an outline to a font, to give the text a border that follows the font, something like this:
h1 {
color: yellow;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}
<h1>Hello World</h1>
是否可以在本机反应中做类似的事情?
Is it possible to do something similar in react native?
我从此堆栈溢出帖子中获取了CCS代码段示例,了解如何使用CSS进行操作: CSS字体边框?
I took the CCS snippet example from this stack overflow post on how to do it with CSS: CSS Font Border?
编辑:更新了问题以使其更加清晰
推荐答案
是的,可以通过以下属性进行操作:
Yes it is possible through the following properties:
textShadowColor color
textShadowOffset ReactPropTypes.shape( {width: ReactPropTypes.number, height: ReactPropTypes.number} )
textShadowRadius ReactPropTypes.number
https ://facebook.github.io/react-native/docs/text.html
实际完成的提取请求:
https://github.com/facebook/react-native/pull/4975
Actual completed pull request: https://github.com/facebook/react-native/pull/4975
这篇关于React Native字体轮廓/ textShadow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!